Page 1 of 3 123 LastLast
Results 1 to 10 of 30
  1. #1
    Join Date
    Apr 2007
    Posts
    6
    Plugin Contributions
    0

    Default Different Header for contact page?

    Is it possible to change have a different header on a certain page? I want to have the contact page of my site refer to a different image map, either in a seperate tpl_header.php file, or from a code contained in the tpl_main_page.php. I figured out how to disable the header for the page, but can't figure out how to add a different one. Thanks!

  2. #2
    Join Date
    Apr 2007
    Posts
    6
    Plugin Contributions
    0

    Default Re: Different Header for contact page?

    I figured it out. If anyone else was wondering, open your tpl_main_page file and find the mainWrapper div. Add an if/else statement pointing to another header page. The first section is the page you want to be different.

    <div id="mainWrapper">

    <?php
    /**
    * prepares and displays header output
    *
    */
    if (in_array($current_page_base,explode(",",'contact_us,conditions')) ) {
    require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');}

    else
    require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');?>

  3. #3
    Join Date
    Nov 2005
    Posts
    51
    Plugin Contributions
    0

    Default Re: Different Header for contact page?

    thank for your solution, it worked for me, too!! except "TEMPLAT E" should be "TEMPLATE"

    two questions,
    if i want to have more than two tpl_header.php, for example, tpl_header2.php, tpl_header3.php, tpl_header4.php, etc.
    how could i make it possible

    and how can i use one of ezpage to have one of tpl_header.php
    "contact_us,conditions" are no problem, but for ezpage, it just look like this
    mydomain.com/index.php?main_page=page&id=1&chapter=0


    many thanks

  4. #4
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: Different Header for contact page?

    Quote Originally Posted by keenskin View Post
    thank for your solution, it worked for me, too!! except "TEMPLAT E" should be "TEMPLATE"

    two questions,
    if i want to have more than two tpl_header.php, for example, tpl_header2.php, tpl_header3.php, tpl_header4.php, etc.
    how could i make it possible

    and how can i use one of ezpage to have one of tpl_header.php
    "contact_us,conditions" are no problem, but for ezpage, it just look like this
    mydomain.com/index.php?main_page=page&id=1&chapter=0


    many thanks
    Use the following: the highlighted portion would be the id for your ezPage
    if (in_array($ezpage_id,explode(",",'7'))) {

    }

  5. #5

    Default Re: Different Header for contact page?

    Thanks for this function!

    What would be the IF statement to use for Category pages? Also, categories with sub-categories.

    I tried this:

    if (in_array($current_page_base,explode(",",'index&cPath=2_6,contact_us,conditions' )) ) {
    require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');}

    And it does not work.

    Thanks

  6. #6
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: Different Header for contact page?

    Quote Originally Posted by loosefast View Post
    Thanks for this function!

    What would be the IF statement to use for Category pages? Also, categories with sub-categories.

    I tried this:

    if (in_array($current_page_base,explode(",",'index&cPath=2_6,contact_us,conditions' )) ) {
    require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');}

    And it does not work.

    Thanks
    You'll need to use this

    if ($current_page_base == 'index' and $cPath=='2_6' or $current_page_base == 'contact_us' or $current_page_base == 'conditions') {
    require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');
    }

  7. #7
    Join Date
    Dec 2006
    Location
    Northwest Connecticut
    Posts
    87
    Plugin Contributions
    0

    Default Re: Different Header for contact page?

    Thanks for supplying this code. I am working on the same site as Loosefast and the Home page uses one header, all other pages use the other header i.e. header2.php. How would we specify the Home page? In other words the if statements would read:

    If Home page

    require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');

    Else

    require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');}

    That way we don't have to specify the specific category, ez pages, contact page etc.

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Different Header for contact page?

    PHP Code:
    if ($this_is_home_page) {
      require(
    $template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE$current_page_base,'common'). '/tpl_header.php');
    }else{
      require(
    $template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE$current_page_base,'common'). '/tpl_header2.php');

    ...well that was pretty close to simultaneous :)

  9. #9
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: Different Header for contact page?

    Quote Originally Posted by HelenSama View Post
    Thanks for supplying this code. I am working on the same site as Loosefast and the Home page uses one header, all other pages use the other header i.e. header2.php. How would we specify the Home page? In other words the if statements would read:

    If Home page

    require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');

    Else

    require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');}

    That way we don't have to specify the specific category, ez pages, contact page etc.
    If ($this_is_home_page) {

    require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');

    } Else {

    require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');
    }

  10. #10
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: Different Header for contact page?

    To paraphrase an old doublemint commercial -

    double the content, double the knowledge

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. how to get different header for different pages? - Without CSS
    By markpr9 in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 15 Apr 2009, 04:34 PM
  2. Different header for each page
    By lavergara in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 31 Aug 2007, 03:32 AM
  3. Different header for different product categories possible?
    By Rotkale in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 14 Dec 2006, 12:10 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
  •  
disjunctive-egg