Forums / Setup & design / {if $node.object.main_node.parent_node_id|eq ( '554' )} ?

{if $node.object.main_node.parent_node_id|eq ( '554' )} ?

Author Message

John Kazakis

Friday 09 May 2008 3:43:44 am

Hello,

I need to be able to show certain items if the user is a specific part of the site (in this case parent node 554).

I've tried using the code below but it doesn't work.

{if $node.object.main_node.parent_node_id|eq ( '554' )}
     <p> this is 554 </p>
{/if}

Is there another way of doing this, or is there something wrong in my code?

Thanks.

Felix Laate

Friday 09 May 2008 4:27:32 am

Hi John,

try

{if eq( $node.object.main_node.parent_node_id, 554 )}
    <p> this is 554 </p>
{/if}

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Gaetano Giunta

Friday 09 May 2008 4:29:29 am

Not sure about the intended results, but if you fetch the main_node of the current object you might not be identifying the actual node being viewed - eg. in case the given object is published at two different locations. Why not just use $node.parent_node_id?

Principal Consultant International Business
Member of the Community Project Board

John Kazakis

Friday 09 May 2008 4:49:07 am

Felix, that worked fine. Thanks.

Simple syntax error?

I have a content class(reports), this class is used throughout the site and it's also present in certain member-only pages.

However there is a Free Reports section that also uses this same class, so I want to allow people to download these reports only in that section.