plugin:autostartpage
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:autostartpage [2013-09-21 18:58] – chnagelog rss Aleksandr | plugin:autostartpage [2020-04-14 14:51] (current) – fix for php7 error flexjoly | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
---- plugin ---- | ---- plugin ---- | ||
Line 6: | Line 6: | ||
email : charles@rabidaudio.com | email : charles@rabidaudio.com | ||
type : action | type : action | ||
- | lastupdate : 2013-07-19 | + | lastupdate : 2015-01-02 |
- | compatible : weatherwax | + | compatible : hrun, weatherwax, elenor of tsort, detritus, frusterick manners |
depends | depends | ||
conflicts | conflicts | ||
Line 24: | Line 24: | ||
===== Installation ===== | ===== Installation ===== | ||
- | Install | + | Search and install |
===== Usage ===== | ===== Usage ===== | ||
Line 31: | Line 31: | ||
This functions a little differently from [[: | This functions a little differently from [[: | ||
+ | |||
+ | Note that creating top-level pages doesn' | ||
==== A note about permissions ==== | ==== A note about permissions ==== | ||
- | These pages are created by the server, //not// the current | + | As of the most recent update, these pages are created by the user who created the first page in the namespace. |
===== Syntax ===== | ===== Syntax ===== | ||
Line 54: | Line 56: | ||
^ @DATE@ | ^ @DATE@ | ||
- | I've added a few more for namespaces: | + | I've added a few more custom ones: |
- | + | ||
- | ^ @!NS@ | namespace of the page (with spaces) but with the first character uppercased | + | |
- | ^ @!!NS@ | + | |
- | ^ @!!NS!@ | + | |
+ | ^ @!NS@ | namespace of the page (with spaces) but with the first character uppercased | ||
+ | ^ @!!NS@ | ||
+ | ^ @!!NS!@ | ||
+ | ^ @PARENT@ | ||
+ | ^ @DATE=STRFTIME@ | ||
===== Configuration ===== | ===== Configuration ===== | ||
Line 73: | Line 76: | ||
* **2013-07-19** | * **2013-07-19** | ||
* Initial release | * Initial release | ||
+ | * **2015-01-02** | ||
+ | * New shortcut: '' | ||
+ | * New shortcut: '' | ||
+ | * Pages now are created as user | ||
+ | * Added force create option | ||
+ | * Fixed constantly outdated issue | ||
+ | * Other minor fixes | ||
=== ToDo/Wish List === | === ToDo/Wish List === | ||
- | * I plan to add support for strftime dates like [[: | + | * <del>I plan to add support for strftime dates like [[: |
* I also want to be able to have different templates for different namespaces | * I also want to be able to have different templates for different namespaces | ||
+ | * < | ||
===== 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 [[: | ||
+ | > At first: Thanks for your plugin =) It helped me a lot. | ||
+ | > I've seen you have written, that we should trigger io_wikipage_write if we can. | ||
+ | > How about setting your function " | ||
+ | > Then we could use the function | ||
+ | saveWikiText($id, | ||
+ | > which triggers that event... | ||
+ | > Greetings | ||
+ | >> Hi Stefan, thanks for the suggestion. I'm not sure why I didn't do that in the first place. | ||
+ | >> It's been fixed now, and the docs have been updated. Cheers, [[user> | ||
+ | |||
+ | On " | ||
+ | --- [[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.1379782717.txt.gz · Last modified: 2013-09-21 18:58 by Aleksandr