views:

286

answers:

1

I'm using Panels to overwrite node template (node/%node). I would like the system to use specific variant when a node is loaded. E.g. node 123 should use variant A and node 223 should use variant B. There isn't an option for me to determine that under Selection rules, I'm wondering if I should use PHP Code, and if I do, how should I go about writing the code?

I'm aware of the option of using Panels Node, but by using it, there is no easy way to edit the node thus rendering it a less than desirable choice.

+1  A: 

In this case the easiest thing is probably to throw in some PHP code. It would be prettier to make an extension to the Panels selection rules, but this might be a bit overkill in this case.

Anyways something like

return arg(1) == 123;

should do it.

Your problem is probably Drupal/Panel cache. I just tested it, and it works fine.

googletorp
@googletorp thanks for the quick response.That was actually the first thing I tried, and it didn't work, thus got me thinking if it wasn't the right method to begin with.
deanloh
return arg(1) == 123; This new code worked! Thanks heaps for the follow up answer!
deanloh

related questions