Jump to content

Php Template Process, If Function, Please Help


work_it_work

Recommended Posts

i got a php website based on templates, and i want to make some changes.

it's based in header.tpl; mainpage.tpl; and footer.tpl

what i want to achieve is to have 2 header.tpl pages displayed separately. or at least 2 different headers.

on index.page i want to display header1.tpl and on any other page i want to display header2.tpl

 

how can i do that? please help!

Link to comment
Share on other sites

Here's the code that triggers the template:

 

$template_output .= $template->process('header.tpl.php');

 

what i want to do is to process the header.tpl.php only if the current page is index.php

on any other page i want to process the header2.tpl.php

 

so visitors when enter the www.site.com or www.site.com/index.php will see one version of the header, and if the navigate away from index.php page they will see another header on the page

 

basically the difference between the 2 header.tpl.php files is one jquery banner....

Link to comment
Share on other sites

Without know the rest of the code surrounding the template output, it would be difficult to give a clear solution, however, maybe this will give you some ideas:

 

function header( $name = null ) {
       if( isset($name) )
      	 $template_output .= $template->process('header-{$name}.php');
  	 $template_output .= $template->process('header.php');
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.