Setting page titles/meta tags on a per-page basis
| From: | Peter Bowyer | Date: | Fri, 05 Apr 2002 08:57:23 +0000 |
| Subject: | Setting page titles/meta tags on a per-page basis | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3505@lists.php.net to get a copy of this message | ||
Hi,
Does anyone have any advice as to how to pass page titles etc from each page to the outer template?
If I had built the CMS using {include file="header.tpl"} on each page then obviously it would be easy to do, but to save time when creating pages I suck the template into a variable using $smarty->fetch(); and then assign it to another variable - {$CONTENT} which resides in a template containing all the HTML (except for in the content area obviously). Now obviously I'm stuck as to how to set the page title, meta tags etc...
Maybe I'm just making things difficult for myself and should just use {include file="header.tpl"} and {include file="footer.tpl"} but I'd be interested to hear the approach that the rest of you take. FYI, this is for a CMS in case that makes any difference ;-)
While I'm sending a post to the list, has anyone written some script to simplify the delivery of static (eg without using database calls etc) pages using Smarty - pages where the only thing needing doing is the inclusion of the header/footer files for example. I get a little bored writing
<?php
require_once "prepend.php";
$smarty = new Smarty;
$smarty->display("somepage.tpl");
?>
over and over again for every static page. If I could write this once and then all static pages used it then I could save time when I needed to change anything.
Thanks,
Peter.
--oOo--
Narrow Gauge on the web - news, photos, railway directory and discussion forums!
http://www.narrow-gauge.co.uk
--oOo--