By sparkguitar05 on
I want to display the title of a node inside the node. I have the PHP filter on and all my other PHP code works. This is the code I am trying to use to display the title and it's not displaying anything.
print $title
What do I need to do to display the node title inside the node?
Comments
=-=
shouldn't that be in the node.tpl.php file of your theme ?
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
Show title
Hi,
You can access $title variable in node.tpl.php.
Otherwise you can access title by calling function $node = node_load(arg(1)) and arg(1) which is your node id.
Then by printing $node->title you can print title of the node.
Thanks,
Kuldip zala
What I'm trying to do.
Here's what I'm trying to do. I have a node set up, but no link to the actual node. Instead, I have this node displayed on other nodes as a node reference. That way I can go to one place to edit this piece of content and it will update on all my other nodes.
Let's say the title of my node is installation. I want this node to show up in product1, product2, product3, etc as a node reference (displaying the full node). I want to put some PHP code in installation to make it display the title of the currently opened node (product1, product2, etc.)
Is this making any sense? I will try kuldip's suggestion and see if that works.
I'm trying to do the same
I'm trying to do the same thing here with PayPal buttons. PayPal keeps its product information on their servers so you cannot crate dynamic buttons (or at least I haven't seen an option on how to do it.)
So in the form there is this line of code which display additional text for the PayPal button:
For instance I can modify this code with PHP to display the donator's user name, in this example I say Donation from "user name".
This works and now allows me to review my PayPal to see the user name of the donator and not just their PayPal email.
What I really want to do is track which page the the donation comes from. So I need to dynamically insert the title of the node inside the form. I would think this would work, but it doesn't. It appears it is the same problem as the OP, inserting the title of the post inside the node body.
Any suggestions would be appreciated.
To answer my own questions I
To answer my own questions I found the solution in this thread. I beleive this is what kuldip zala was alluding to as well.
For my example I did this:
God bless.