PHP Tutorial: Basic Template System

Post here is you are having problems with any of the tutorials.
Post Reply
nyo
Posts: 124
Joined: Mon May 09, 2011 1:55 pm
Location: Mobile

PHP Tutorial: Basic Template System

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: PHP Tutorial: Basic Template System

Post 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 ;)
Image
nyo
Posts: 124
Joined: Mon May 09, 2011 1:55 pm
Location: Mobile

Re: PHP Tutorial: Basic Template System

Post 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.
Post Reply