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!

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....

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');
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.