add condition in case the file of the page does not exist.
This commit is contained in:
parent
adb7294323
commit
f7fadb9b7e
17
action.php
17
action.php
@ -33,15 +33,18 @@ class action_plugin_usetheme extends DokuWiki_Action_Plugin {
|
|||||||
public function _handleConf(Doku_Event $event, $param) {
|
public function _handleConf(Doku_Event $event, $param) {
|
||||||
global $ID, $ACT, $conf;
|
global $ID, $ACT, $conf;
|
||||||
$dataFile = wikiFN(cleanID($ID));
|
$dataFile = wikiFN(cleanID($ID));
|
||||||
$fp = fopen($dataFile,"r");
|
if(is_file($dataFile)) {
|
||||||
$firstLine = fgets($fp,512);
|
$fp = fopen($dataFile,"r");
|
||||||
fclose($fp);
|
$firstLine = fgets($fp,512);
|
||||||
preg_match('/~~USETHEME:(.*?)~~/', $firstLine, $match);
|
fclose($fp);
|
||||||
$template = trim($match[1]);
|
preg_match('/~~USETHEME:(.*?)~~/', $firstLine, $match);
|
||||||
if($template) {
|
$template = trim($match[1]);
|
||||||
$conf['template'] = $template;
|
if($template) {
|
||||||
|
$conf['template'] = $template;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim:ts=4:sw=4:
|
// vim:ts=4:sw=4:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user