Page 1 of 1
Modifying the template_chooser plugin
Posted: Tue Feb 03, 2009 2:05 pm
by T
OK, here we are...
I'm trying to modify the template_chooser plugin so that, when a user switches templates, he is also redirected to a particular entry (so not only layout, but also content changes).
Any suggestions?
Re: Modifying the template_chooser plugin
Posted: Tue Feb 03, 2009 2:08 pm
by garvinhicking
Hi!
Hm, the most important question would be how to maintain which template is related to which entry. A couple of options come to my mind:
1. Put a file like "forward.url" into each template directory, containing th eURL that it should forward to
2. Create a config option for each available template in the introspection method of the plugin and let the user fill out an input field for the redirection target
3. simply fixate the target URLs inside a custom plugin.
You'll need to enter the forward location header simply at the end of the frontend_configure hook inside serendipity_event_templatechooser.php. However I'd suggest to create your own copy of the plugin to keep it from getting updated from a new s9y release.
Regards,
Garvin
Re: Modifying the template_chooser plugin
Posted: Tue Feb 03, 2009 2:15 pm
by T
Sorry, I used the wrong name. I'm actually using the template dropdown plugin, so the file that needs editing is serendipity_plugin_templatedropdown.php.
Does this change things?
Re: Modifying the template_chooser plugin
Posted: Tue Feb 03, 2009 3:27 pm
by garvinhicking
Hi!
That's about the same; you can either use the event plugin for HTTP redirection, or you can patch the sidebar plugin for immediately targeting the <form> to the article you might want.
Regards,
Garvin