Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    Sana'a
    Posts
    183

    Reload this Page best way to change header image based on page name

    hello there guys

    i have a question. what is the best way to change the header image of the page based on the page name? of course using php.


    thanks in advance.

  2. #2
    Join Date
    Apr 2007
    Location
    Calgary, Canada
    Posts
    200
    Take a look at $_SERVER['PHP_SELF'] or $_SERVER['REQUEST_URI']. If you have various PHP files without any request rewrites, you can do:

    PHP Code:

    $pageBanner 
    getHeaderImge();
    // then use $pageBanner when displaying <img src="..." ... />

    function getHeaderImage() {
     switch(
    $_SERVER['PHP_SELF']) {
      case 
    "index.php":
       return 
    'indexBanner.jpg';
      case 
    "subpage.php":
       return 
    'subPageBanner.jpg';
      default:
       return 
    'everyOtherBanner.jpg';
     }

    You can also do this with javascript, where self.location is used to determine the image source of the banner.

  3. #3
    Join Date
    Oct 2003
    Location
    Sana'a
    Posts
    183
    hi there thanks for the answer.i will try to implement that and see. thanks again .

Similar Threads

  1. [PHP] Expire a page and prevent page reload/refresh
    By latheesan in forum Programming Discussion
    Replies: 32
    Last Post: 09-21-2007, 10:00 PM
  2. Reload this Page webtalkforums.net <-> webhostingtalk.com
    By SlAiD in forum Web Hosting Lounge
    Replies: 10
    Last Post: 08-19-2006, 08:21 PM
  3. reload page with different index
    By crowitis in forum Programming Discussion
    Replies: 5
    Last Post: 10-19-2004, 12:59 PM
  4. Automatic page reload?
    By jeffcol in forum Programming Discussion
    Replies: 3
    Last Post: 11-14-2003, 02:27 PM
  5. mod_rewrite, referer and page reload
    By rcs in forum Programming Discussion
    Replies: 1
    Last Post: 12-20-2002, 04:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •