Hi!
I have trouble trying to print on print/* what appears on node/* when it´s not a cck field and it´s inside a tab attached to that node.

Let me explain: I have a nod node/123 wich has a tab (node/123/mytab) attached to it with content that´s not a cck field, but it has been added with php programaically.

When I want to add to that specific tab a certain text, this is what I do:

<?php
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'mytab') {
$node = node_load(arg(1));
print 'hey! you´re in mytab!'; 
}
?>

And it works.
But when I try to do that on the printed version, it won´t work:

<?php
if (arg(0) == 'print' && is_numeric(arg(1)) && arg(2) == 'mytab') {
$node = node_load(arg(1));
print 'hey! you´re in mytab!'; 
}
?>

Am I missing something? Why it doesn´t work? I know that printed pages aren´t exactly nodes, but following the URL should´ve worked.

Even if I didn´t printed out that text inside my node, if I added it to my printer version, should´ve appeared...

Any thoughts or clues will be very much appreciated!
Rosamunda

Comments

nevets’s picture

The print path (print/nid) does not generally have associated tabs so arg(2) is not likely to be 'mytab'. (The tabs are generally associated with the path node/nid).

You might try

<?php
if (arg(0) == 'print' && is_numeric(arg(1))) {
$node = node_load(arg(1));
print 'hey! you´re in mytab!';
}
?>
Rosamunda’s picture

Thanks for following my dispair to here nevets :)
I´ve tried what you´ve said, and it works (with the first argument as "node"), but it shows the line in all views, without regard of the tab.
I wanted that text to be shown only inside that tab.

Rosamunda’s picture

Nope... it just won´t work... I really don´t get to understand why...
I know that printed pages are not nodes... but if I´m setting a specific path... it should work...

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

Can you tell me if you're adding this custom PHP in your own custom module, or if you're using an existing module to add the above code?

I would like to reproduce the problem in my test site.

Thanks,

João Ventura

Rosamunda’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Hi again!
I´ve solved it. The problem was in a custom module that changing it, printed all stuff normally.
It happens that the problem was in the way that my custom module printed each customized tab and each tab´s contents.
Thanks!
Rosamunda