Jump to content

[SOLVED] what is wrong with this???


Miri4413

Recommended Posts

Hi, this is my situation,

I want to change te template base on the "current_category_id"

 

if the current_category_id is equal to any of this numbers (1,12,13,14,15) require this tpl_modules_attributes_1.php

 

if the current_category_id is equal to any of this numbers (2,5,6,7,8) require this tpl_modules_attributes_2.php

 

if other number require tpl_modules_attributes.php

 

So, this is my php code but something is wrong, (I don't know PHP)

 

Please Help !!!

 

 

<?php

 

$clenses = array("1", "12", "13", "14");

$plenses = array("2", "5", "6", "7", "8");

 

if $current_category_id=="clenses";

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

 

if ($current_category_id=="plenses")

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

 

?>

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/106835-solved-what-is-wrong-with-this/
Share on other sites

<?php

$clenses = array("1", "12", "13", "14");
$plenses = array("2", "5", "6", "7", "8");

if(in_array($current_category_id, $clenses)){
   require($template->get_template_dir('/tpl_modules_attributes_1.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes_1.php');
}elseif(in_array($current_category_id, $plenses)){
  require($template->get_template_dir('/tpl_modules_attributes_2.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes_2.php');
}else{
   die('invalid category id');
}
?>

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.