Jump to content

Can somebody check my php codes?


Recommended Posts

I want to use two headers.

I use the following codes in the header.php just before the smart assign:

if ($_GET['id_category'] == 13 
OR $_GET['id_category'] == 14
$smarty->display(_PS_THEME_DIR_.'header-gproduct.tpl');
else



It works perfectly. How can I add if it is gshipping.php it will use the header.gproduct.tpl?

I used

f ($_GET['id_category'] == 13 
OR $_GET['id_category'] == 14
OR $page_name == 'gshipping.php' 
$smarty->display(_PS_THEME_DIR_.'header-gproduct.tpl');
else



It doesn't work. Can someone check my codes see if there is a problem? Thank you very much.

Link to comment
Share on other sites

Try using strpos.

if ($_GET['id_category'] == 13 
OR $_GET['id_category'] == 14
OR strpos($page_name, 'gshipping.php') 
$smarty->display(_PS_THEME_DIR_.'header-gproduct.tpl');
else 



This should work as long as 'gshipping.php' is in the page_name, with extra characters like '/', '?' etc.

Link to comment
Share on other sites

Try using strpos.

if ($_GET['id_category'] == 13 
OR $_GET['id_category'] == 14
OR strpos($page_name, 'gshipping.php') 
$smarty->display(_PS_THEME_DIR_.'header-gproduct.tpl');
else 



This should work as long as 'gshipping.php' is in the page_name, with extra characters like '/', '?' etc.



Sorry, it doesn't work.

My gshipping.php is in the root. It is not a cms page, it is a page that I made. After I used the codes your provided, it is still capture the default header. :red:
Link to comment
Share on other sites

×
×
  • Create New...