Page 1 of 1

PHP Tutorial: Basic Template System

Posted: Tue May 17, 2011 6:05 am
by nyo
Hi,

I am going over the basic template system tutorial: http://betterphp.co.uk/playlist.html?pi ... 1A4FB3EE40 and I have a question here.

How can I add page titles? In the current version, all page titles are "Better PHP: Template System". But in a real site, it should be like "Home - Better PHP: Template System", "News - Better PHP: Template System", etc. different for each page.

Maybe Jacek could add a short video to the series about that.

Re: PHP Tutorial: Basic Template System

Posted: Tue May 17, 2011 9:08 am
by jacek
You could base the page title on the page...
<title><?php echo ucwords(str_replace('_', ' ', $_GET['page'])); ?></title>
is something I have used before.

Making it properly dynamic would be quite a major edit ;)

Re: PHP Tutorial: Basic Template System

Posted: Tue May 17, 2011 9:41 am
by nyo
jacek wrote:You could base the page title on the page...
<title><?php echo ucwords(str_replace('_', ' ', $_GET['page'])); ?></title>
is something I have used before.

Making it properly dynamic would be quite a major edit ;)
Good idea, thanks a lot. This will be enough for me at the moment.