plugin:autostartpage
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:autostartpage [2018-01-15 09:55] – [Discussion] redge76 | plugin:autostartpage [2020-04-14 14:51] (current) – fix for php7 error flexjoly | ||
---|---|---|---|
Line 24: | Line 24: | ||
===== Installation ===== | ===== Installation ===== | ||
- | Install | + | Search and install |
===== Usage ===== | ===== Usage ===== | ||
Line 91: | Line 91: | ||
===== Discussion ===== | ===== Discussion ===== | ||
+ | |||
+ | **Update for php7** \\ | ||
+ | Hi, (I hope I do this right) \\ | ||
+ | The plugin has a minor error with php7 and a pull-request is open for some year now. So I made a fork and committed the [[https:// | ||
+ | |||
Registers as [[: | Registers as [[: | ||
Line 106: | Line 111: | ||
On " | On " | ||
--- [[user> | --- [[user> | ||
+ | |||
+ | |||
+ | **excellent - very useful plugin** | ||
+ | I notice you comment that one of the todo's is the ability to have different start page templates for different places. | ||
+ | |||
+ | well - I wanted that too - so made a few minor amendments - code is hopefully self explanatory - happy if you want to include these changes or if others want to do a similar mod - I am just using a local edit of the plugin on my system - works nice! (also removed a couple of &s so that it would work on php 7.1) | ||
+ | |||
+ | . | ||
+ | . | ||
+ | . | ||
+ | . | ||
+ | public function autostartpage_handle(Doku_Event $event, $param) { | ||
+ | global $conf; | ||
+ | global $INFO; | ||
+ | $ns=$event-> | ||
+ | | ||
+ | $passed_template = $this-> | ||
+ | $templatefile = wikiFN($this-> | ||
+ | | ||
+ | if (substr_count($passed_template, | ||
+ | /* | ||
+ | This if statement checks to see whether the start page template set in the configuration manager includes a ":" | ||
+ | If it does then this is an absolute startpage template to be used for all new namespaces and the logic progresses as per original plugin | ||
+ | If there is no ":" | ||
+ | first the newly created namespace' | ||
+ | if the parent doesnt contain a template then the grandparent is checked by moving the current parent to the temp namespace name | ||
+ | and we go round the loop again. Processing continues till we hit the top level folder. | ||
+ | */ | ||
+ | $instance = substr_count($ns, | ||
+ | $ns_sepchar = ":"; | ||
+ | $ns_temp = $ns; | ||
+ | | ||
+ | do { | ||
+ | $parent=implode($ns_sepchar, | ||
+ | $parent_template = $parent .":" | ||
+ | $parent_templatefile = wikiFN($parent_template, | ||
+ | if(@file_exists($parent_templatefile)){ | ||
+ | $wikitext=io_readFile($parent_templatefile); | ||
+ | break; | ||
+ | } else { | ||
+ | $ns_temp = $parent ; | ||
+ | --$instance; | ||
+ | } | ||
+ | } | ||
+ | while ($instance > 0); | ||
+ | |||
+ | } else { | ||
+ | if(@file_exists($templatefile)){ | ||
+ | $wikitext=io_readFile($templatefile); | ||
+ | } | ||
+ | } | ||
+ | /* | ||
+ | NO FURTHER CHANGES AFTER HERE | ||
+ | */ | ||
+ | $ns_type=$event-> | ||
+ | if($ns_type === " |
plugin/autostartpage.1516006505.txt.gz · Last modified: 2018-01-15 09:55 by redge76