Home arrow PHP arrow Page 6 - Dynamic Generation of Menu Structures and JavaScript Rollovers in PHP

Adding Pages - PHP

Did you ever have one of those sites that started out small, but kept growing and growing? Adding new pages to a site or removing old ones can often take more time than developing the pages themselves.

TABLE OF CONTENTS:
  1. Dynamic Generation of Menu Structures and JavaScript Rollovers in PHP
  2. Making a Template
  3. Starting to Automate
  4. The power of repetition
  5. Ordering up a Menu
  6. Adding Pages
By: Chris Mospaw
Rating: starstarstarstarstar / 11
May 10, 1999

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Now that the TEMPLATE.HTML file is completed (with the possible exception of changing the table border to 0), it can be used as the basis for new pages on the web site. Just do a SAVE AS to the filename of the new page, and put the page content in the "3 - Main Body" area.

Don't forget to go into PAGES.HTML and add the name of the new page to the array definition. By the way, the pages named in the array display in the menu in the exact order in which they occur in the array. By altering this order, you can alter the order in which pages appear in the menus.

You will also need the following 5 graphics files for each page:
  • FOO-H.gif - header graphic
  • FOO-B.gif - graphic panel that changes when hovering over buttons
  • FOO-OFF.gif - default button displayed for non-current page
  • FOO-ON.gif - button displayed when onMouseOver
  • FOO-IN.gif - button graphic displayed when page is current

(GIF files were used in this example. JPG's and PNG's work just as well. Just remember that every file of each type must be the same format.)

Adding one page or one hundred pages is now just a matter of using the template file and then generating the graphics files.

Using PHP for the dynamic generation of menu structures and JavaScript can dramatically cut the time it takes to develop a site, and certainly makes site maintenance a breeze compared to having to edit each page when other pages are added or removed. Adding or deleting pages from the site's menu structure is now just a matter of making minor changes to a few files, and producing some graphics.

Another good use for PHP is separating the content of a page from the structure of a page, thus making site maintenance even easier and nearly eliminating formatting mistakes, but that's a subject for another article.


 
 
>>> More PHP Articles          >>> More By Chris Mospaw
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: