Hi,
what is the right way to create variant just for 1 specific book?
node type == book && ?!?!
I can see in the context book parent page but I cant understand how to declare it?!
thanks.

Comments

ntigh52’s picture

The rule need to be:

if (%book_parent:nid == blabla ){
return true;
}

or

if (BOOK OUTLINE == %book_parent:title  ){
return true;
}

or

if (%book_parent:url == ?!? ){
return true;
}

but I can not do this!
Does anyone have an idea?
Thnaks a lot.

ntigh52’s picture

Title: create variant for 1 book » cant create variant just for 1 specific book
ntigh52’s picture

Title: how to create variant just for 1 specific book with CONTEXTS and RELATIONSHIPS » cant create variant just for 1 specific book

I solve that like with the php code on rules in the variant:

$node = node_load(arg(1));
if (isset($node->book['bid']) && $node->book['bid'] == '300' ) {  // the nid of the book parent )
return true;
}

and its work!
but, I think there is another very simple way to do that with context and rules in panels....
how can i use the relations or context Instead of Php Knowledge,
Does anyone have an idea?
Thnaks a lot.

ntigh52’s picture

Title: cant create variant just for 1 specific book » how to create variant just for 1 specific book with CONTEXTS and RELATIONSHIPS
ntigh52’s picture

Title: cant create variant just for 1 specific book » how to create variant just for 1 specific book with CONTEXTS and RELATIONSHIPS

I found that if I add a context so I get all the $context variable.
if i add book parent context I get also:

Keyword: %book_parent
%book_parent:nid --> Content ID
more more more ....

but How can I use this $context variable in php code in Variants » Selection rules ?!
Instead of using:

$node = node_load(arg(1));
if (isset($node->book['bid']) && $node->book['bid'] == '300' ) {  // the nid of the book parent )
return true;
}

to user the variable $context like:

if (isset(%book_parent:nid) && %book_parent:nid == '300' ) {  // the nid of the book parent )
return true;
}

can I use this %book_parent:nid ( from context ) in Variants » Selection rules ?!
Thanks