Wiki source for SelectTemplateOnPageCreation


Show raw source

=====Select Template on Page Creation=====
>>Working for 1.3.6>>Users of mine wished a simple solution for selecting a template to work with during page creation process. Here I'll document the changes needed to make it work.

This contribution allows to create templates as pages ending on "Template" or any other suffix configured in the config option 'template_suffices'. 'template_suffices' is a list of suffices seperated by colon, semicolon, or comma. This way you can configure template pages more fitting to your language. Users only have access to those templates they have read access on. If you don't set this value, the suffix defaults to 'Template'

This contribution also allows to pre-select a template based on simple PHP scripts in ##config::'handler_path'/template##. I supply a script matching against calendar names.

====Edit edit.php====
Edit your version of edit.php in ##plugins/handlers/edit/edit.php##

In the preview section right before
%%(php)
$output .= '</div>'."\n"; #683
%%add%%(php)
if(isset($_POST['active_template'])) $output .=
'<input type="hidden" name="active_template" value="'.$this->GetSafeVar('active_template','post').'" />'."\n";
%%

Then, in the edit section right before ##$edit_buttons## add
%%(php)
%%

tbc

::c::----
CategoryUserContributions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki