I need help on how to manipulate node content when using Panels 3:

I have a rather complex CCK content type. This content type should be displayed using Panels. What fields to reveal to the user depends on a couple of visibility rules (like if the user has a certain user role). So I want to add these things as panels content and utilizes visibility rules. No problems so far.

But some of the content is more complex than simply showing a CCK field: I wish to add dynamic anchor links at the top of the page. In order to generate these links I will have to access and manipulate the full $node object.

But how can create a block that I can use to add content in a panel - not only a static block, but a block that can access the $node object an manipulate content from it? Like when you customize node.tpl.php.

Am I missing out some theming possibilities within Panels 3? Or is there a smart way to get around things?

And if it is possible to access the $node object: Can I minimize server load by not having to load the $node object for each part of content (I actualy need to use it in 4 content blocks with different visibility rules)?

Any help is highly appreciated.

Comments

merlinofchaos’s picture

Status: Active » Fixed

Your best bet is to use the 'node content' block and the 'panel identifier' to create a custom node-panel-IDENTIFIER.tpl.php that will contain your custom links. It will have the entire $node so you can do whatever it is you need there.

bjaxelsen’s picture

Thanks, Earl :-)

- thanks for great functionality and a quick and precise response - it was just what I needed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

amcc’s picture

I'm using the 'node content' block and the 'panel identifier' as described above.

The problem i'm having is that the $node object doesn't include the title of the node - it seems to be missing even though there is a title. Any idea why this is and how i get the title. I need to use this templating method so i can use some logic to manipulate the title of the node.

amcc’s picture

just solved the problem for myself - I needed to have 'Leave node title' checked in the 'node content' settings.

It does seem slightly odd that the title would be removed from the node object though

merlinofchaos’s picture

Panes want to render the title separately from the content. By default, nodes want to render the title with the content. That leads to a bifurcation. That checkbox is the easiest solution to get an either or, and let the site handle it automatically or not, depending upon how finely tuned it needs to be.

carlitus’s picture

I cannot use the custom template for a node pane using node-panel-IDENTIFIER.tpl.php and panels 3.2. With Panels 3.0 it works well.

I'm missing something or there is a new way to do this?

sblommers’s picture

Same problem here. custom templates don't work.

Dimm’s picture

Component: Display rendering » Code
amcc’s picture

Make sure you only add the IDENTIFIER bit in panels when you're adding the node content. Not the full filename (node-panel-IDENTIFIER.tpl.php).

mrconnerton’s picture

Are there any issues when adding a custom content pane and setting it to php to do:

$node = node_load(arg(1));

I'm using panels for node layouts on ubercart products and this is how I am getting the product information.