hide area on specific pages

Permalink
Hi there,

So, I´ve been working on a page type that only shows some code if it's not homepage. Something like this:

*************************************************************************
<?php
//Check if is NOT homepage ***************************
echo $currentPageCID;
if($currentPageCID != "1"){
?>

<div class="col8 submenu last">
<div class="content">

<?php
//Submenu ********************************************
$bt = BlockType::getByHandle('autonav');
$bt->controller->displayPages = 'second_level'; // 'top', 'above', 'below', 'second_level', 'third_level', 'custom', 'current'
$bt->controller->displayPagesCID = ''; // if display pages is set ‘custom’
$bt->controller->orderBy = 'display_asc'; // 'chrono_desc', 'chrono_asc', 'alpha_asc', 'alpha_desc', 'display_desc','display_asc'
$bt->controller->displaySubPages = 'all'; //none', 'all, 'relevant_breadcrumb', 'relevant'
$bt->controller->displaySubPageLevels = 'enough'; // 'enough', 'enough_plus1', 'all', 'custom'
$bt->controller->displaySubPageLevelsNum = ''; // if displaySubPages is set 'custom'
$bt->render('templates/submenu'); // for template 'templates/template_name';

//Call Title Image ************************************
$title_img = $c->getAttribute('title_image');
if(!empty($title_img)) {
?>

<img src="<?php echo ($c->getAttribute('title_image')->getVersion()->getRelativePath());?>" class="title" alt="<?php echo $c->getCollectionName() ?>" title="<?php echo $c->getCollectionName() ?>" />

<?php } ?>

</div>
</div>

<?php } ?>
*************************************************************************

And it works great.

Then, I tried to include another page in this exception adding something like:

if(($currentPageCID != "1") || ($currentPageCID != "169")){,

and it stops working...

Any ideas why?

Thanks,
Pedro

povirtual
 
povirtual replied on at Permalink Reply
povirtual
Couldn´t find an answer, yet... I guess it must be an obvious one or I'm searching the wrong way.

If anyone can help, I'd appreciate it.

Cheers
Pedro
keeasti replied on at Permalink Best Answer Reply
keeasti
I found if you change the OR (||) operator to AND (&&) then it works.

I think the comma at the end is a typo in your post but it shouldn't be there. You can also probably lose the extra brackets ... something like this:

if($currentPageCID != "1" && $currentPageCID != "169"){
povirtual replied on at Permalink Reply
povirtual
Hi Keeasti,

I did what you said and it worked :)

Thank you,
Pedro
keeasti replied on at Permalink Reply
keeasti
Great ... glad it worked out :)