erichar11 Posted October 23, 2007 Share Posted October 23, 2007 Hi all, looking for suggestion on the best way to create unique title tags within a templated system. In other words, I have a standard header, footer, left nav, for each of the pages I create. Works extremely well. The only problem is that the title tag in the header is the same for every page. Suggestions or thoughts as to how make each page have a unique title tag would be great. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/74474-dynamic-title-tags-within-a-template/ Share on other sites More sharing options...
GingerRobot Posted October 23, 2007 Share Posted October 23, 2007 Well that rather depends on how you are doing things at present. There are many ways to achieve a consistant look to your page so its rather difficult to guess how you're doing things. If, as i would guess, you are including various files in each of your pages, you could defined a $title variable before you include the header, echoing this variable in your header page. If this isn't how you are doin things, then perhaps you could post a sample page. Quote Link to comment https://forums.phpfreaks.com/topic/74474-dynamic-title-tags-within-a-template/#findComment-376351 Share on other sites More sharing options...
erichar11 Posted October 23, 2007 Author Share Posted October 23, 2007 Hi GingerRobot, thanks for the response. As you guessed I have something like the following: <?php include("nav/header/header.php"); ?> <div> Content Here </div> <?php include("nav/footer/footer.php"); ?> I've looked at a couple of different methods basically using define <?php define ('TITLE', 'Page Title Here'); and then calling the define in the header. Seems like what you suggestion is basically doing the same thing. Forgive my ignorance, I'm new to php. But I'm not sure how to echo or get the title tag to show up in the header. Quote Link to comment https://forums.phpfreaks.com/topic/74474-dynamic-title-tags-within-a-template/#findComment-376366 Share on other sites More sharing options...
erichar11 Posted October 23, 2007 Author Share Posted October 23, 2007 quick update, I created a <?php define ('TITLE', 'title | mysite.com'); ?> above my header.php. Added some code in the title tag to detect this and all seems to be well. GingerRobot, thanks for the inspiration. Quote Link to comment https://forums.phpfreaks.com/topic/74474-dynamic-title-tags-within-a-template/#findComment-376384 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.