Abstract
One of the great payoffs of using PHP is that it can save you a lot of repetitive work. Figure 4-1 shows how four elements of a static web page benefit from a little PHP magic.
The menu and copyright notice appear on each page. Wouldn’t it be wonderful if you could make changes to just one page and see them propagate throughout the site in the same way as with CSS? You can with PHP includes. You can even get the menu to display the correct style to indicate which page the visitor is on. Similar PHP wizardry automatically changes the date on the copyright notice and the text in the page title. PHP can also add variety by displaying a random image. JavaScript solutions fail if JavaScript is disabled, but with PHP your script is guaranteed to work all the time. The images don’t all need to be the same size; PHP inserts the correct width and height attributes in your <img> tag. And with a little extra scripting, you can add a caption to each image.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2006 David Powers
About this chapter
Cite this chapter
(2006). Lightening Your Workload with Includes. In: PHP Solutions: Dynamic Web Design Made Easy. Apress. https://doi.org/10.1007/978-1-4302-0275-2_4
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0275-2_4
Publisher Name: Apress
Print ISBN: 978-1-59059-731-6
Online ISBN: 978-1-4302-0275-2
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books