How can I do this?

Discussion in 'Programming' started by Garland Robinson, Jul 8, 2007.

  1. #1
    What do I need to do to be able to change a parameter site-wide? Let's say I had a 10 page site with adsense, is there a way I could code something that would change all of the pub-id's on the site from one file? Instead of having to go thru each .html and copy and paste.
     
    Garland Robinson, Jul 8, 2007 IP
  2. wierdo

    wierdo Well-Known Member

    Messages:
    1,646
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    140
    #2
    Make a file pub.php or something, put the id in that page, then use include.

    Right? I'm fairly new myself at PHP.
     
    wierdo, Jul 8, 2007 IP
  3. sarahk

    sarahk iTamer Staff

    Messages:
    28,839
    Likes Received:
    4,542
    Best Answers:
    123
    Trophy Points:
    665
    #3
    That's right wierdo.

    However the change from .html files to .php or .asp takes a bit of planning and work.

    The easiest way is to use .htaccess to treat .html files as .php (search this forum for a how-to)

    Then you still need to go and make the change on all the pages - but next time will be easier!

    While you are at it your headers and footers should be includes too so that when you add a menu item, change a logo etc it's a quick and simple change.

    Consider using a CMS (content management system) to drive your site. You can test drive a stack of free options at www.opensourcecms.com.
     
    sarahk, Jul 8, 2007 IP