Modifying the template_chooser plugin

Creating and modifying plugins.
Post Reply
T
Regular
Posts: 48
Joined: Tue Feb 20, 2007 11:24 pm

Modifying the template_chooser plugin

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Modifying the template_chooser plugin

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
T
Regular
Posts: 48
Joined: Tue Feb 20, 2007 11:24 pm

Re: Modifying the template_chooser plugin

Post 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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Modifying the template_chooser plugin

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply