Jump to content
Larry Ullman's Book Forums

How To Use The $Page_Title Variable In All Chapters


Recommended Posts

I am almost finished the book, and I am not totally clear on how to use the $page_title variable that appears throughout the book, do we have to include the following code in the title tag of each php script in order to use $page_title. <?php echo $page_title; ?>. In most of the examples in this book the $page_title variable is used in the script without showing the code used in the title tag. Also since the $page_title variable appears below the title tag when I load the php script in my browser I get an error message saying that $page_title isn't a valid variable. 

 

Can someone explain to me how to properly use the $page_title variable when writing php scripts. Or is it just easier to write the title in the title tag without using this variable. 

Link to comment
Share on other sites

As far as I recall, Larry makes an include file called header.php, which includes the title tags. So long as you declare the $page_title variable before you include the header file, the variable will be set and properly set the text to use between the title tags.

Does that make sense?

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...