Additional Sidebox Only to Appear in current_category_id
If anyone could help me solve this then it'd be a real help. I'm struggling with a rather complex navigation system which I wont bore you with, but basically I'm planning to add an additional sidebox for each main category which must only appear when the category ID is the one specific to the box contents.
For Example, when someone clicks on the Lingerie category (http://www.dystynction.com/index.php...ndex&cPath=1_8) then I want the additional sidebox I created to appear.
I don't want this sidebox visible in any other category.
The existing contents of the relevant sidebox.php is this:
PHP Code:
$show_lingerie_sizes_sidebox = true;
if ($show_lingerie_sizes_sidebox == true) {
require($template->get_template_dir('tpl_lingerie_sizes_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_lingerie_sizes_sidebox.php');
$title = BOX_HEADING_LINGERIE_SIZES_SIDEBOX;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?>
I have read from another thread that I might be able to add something like this:
PHP Code:
IF ($current_category_id=='1_8') {
$show_lingerie_sizes_sidebox == true;
} else {
$show_lingerie_sizes_sidebox == false;
}
..........but when I try to add this it just doesn't work...
Can anyone please help me write this little piece of code? Thanks so much to anyone who can help me :-)
Re: Additional Sidebox Only to Appear in current_category_id
Re: Additional Sidebox Only to Appear in current_category_id
the current_category_id is not 1_8, but just 8 (the actual category id number).
Re: Additional Sidebox Only to Appear in current_category_id
Hi guys,
thanks for replying, it's really appreciated.
I looked at the other thread and I tried to plug in the IF and GET statements but I can't get it to work :-(
I'm a total amateur with PHP code and this is my first website (you've probably guessed) and was just wondering if any of you guys knew how to 'shoogle' this code to make it work?
Re: Additional Sidebox Only to Appear in current_category_id
Quote:
Originally Posted by
bunyip
the current_category_id is not 1_8, but just 8 (the actual category id number).
Thanks for pointing that out Neville, but still can't get it to work :-(
Re: Additional Sidebox Only to Appear in current_category_id
This is how I've tried to edit the PHP:
PHP Code:
$show_lingerie_sizes_sidebox = true;
if ($_GET['cPath'] == 8 or $_GET['cPath'] == 9) {
require($template->get_template_dir('tpl_lingerie_sizes_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_lingerie_sizes_sidebox.php');
$title = BOX_HEADING_LINGERIE_SIZES_SIDEBOX;
$title_link = false;
require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
} else {
$show_lingerie_sizes_sidebox == false;
}
Which results in the box not showing at all.
By the way, I don't get the logic of the category reference numbers.... if http://www.dystynction.com/index.php...ndex&cPath=1_8 is category_id == 8 ............ then what is http://www.dystynction.com/index.php...ex&cPath=1_8_9 ??? is it category_id == 9 ??
Re: Additional Sidebox Only to Appear in current_category_id
If anyone reads this and wonders about a solution then please view this thread as i's been solved there thanks to the wonderful Ajeh
Re: Additional Sidebox Only to Appear in current_category_id
Ok, so you need to swap your first example and your last.
Lets assume cpath = 6_16_1
$_GET['cPath'] will give you the category path, ie 6_16_1
current_category_id will give you the deepest nested cat id ie 1
so for your example you should use either:
if ($_GET['cPath'] == 1_8 or $_GET['cPath'] == 1_9)
or
IF ($current_category_id=='8' or $current_category_id=='9')
Re: Additional Sidebox Only to Appear in current_category_id
Quote:
Originally Posted by
Aetherlux
IF ($current_category_id=='8' or $current_category_id=='9')
Incorrect marked red...should be
Code:
if ($current_category_id == 8 or $current_category_id == 9 ... etc. etc.
Re: Additional Sidebox Only to Appear in current_category_id
:oops: thanks. still learning