Jump to content
Mike Rockett

Auto Append/Prepend to Template

Recommended Posts

If this can already be done, then shoot me. ;)

I often find myself specifying the header/footer (prepend/append) for each template on every site I make. I think this could be automated, if asked to be by the developer/designer.

This could be done by means of a check box for each. "Prepend this file to all templates" and "Append this file..."

Feasible?

Share this post


Link to post
Share on other sites
/**
 * Prepend template file 
 * 
 * PHP file in /site/templates/ that will be loaded before each page's template file.
 *
 * #notes Example: _init.php
 * @var string
 *
 */
$config->prependTemplateFile = '';

/**
 * Append template file 
 * 
 * PHP file in /site/templates/ that will be loaded after each page's template file.
 * 
 * #notes Example: _main.php
 * @var string
 *
 */
$config->appendTemplateFile = '';

Additionally there are settings about changing / preventing these configs in the template edit section.

Share this post


Link to post
Share on other sites

The just isn't a global configuration gui in ProcessWire right now. (Read below) But it shouldn't be hard to just pack all those $config variables in a module with some forms. I think to remember that Ryan some time ago said it's this way so /site/config.php doesn't have to be writeable or something like that.

Share this post


Link to post
Share on other sites

There's a process configuration now where you can have ui of config.php. read the blog.

Share this post


Link to post
Share on other sites

Oh, that's where I read about it. Somehow I thought this would become part of the core and therefore I thought it would be not ready yet.

Share this post


Link to post
Share on other sites

It is ready in the dev branch :-)...No its not.....at least not yet....see below

Edited by kongondo

Share this post


Link to post
Share on other sites

It's not really in the dev branch. It's still an extra module to install by now even though it looks like it would be in the core if one just reads over the first lines. That's what confused me about it, because I thought I would have noticed it sometimes as a core module.

Share this post


Link to post
Share on other sites

Yeah, even with the config module, there's still separation. That said, it's not a heavy separation - i.e. between back-end and code. Would be cool if there was a proper way to manage these links/attachments in terms of a global scope.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...