Hi, I'm using the content contemplate module for having different templates for each type of contents. I'm not able to write php, so I have a problem... I have a type of content called "pda". Each node is a brief description of a model of PDA. At the end of the page, I put 2 lines into the template of PDA's type of content, that are:
<div> <a href="index.php?q=Ausili/Podcast/ <?php print $node->nid ?> "> Download or listen to podcast about <?php print $title ?></a></div>
This lines allow user to see podcast about the PDA that he is reading. That's ok, but, if there are no podcast about that node, how can I turn off displaying that link? so users don't click to see only 2 words like "no podcast for that PDA"! Thanks in advance.
Need more information to help. Are the podcasts a field in the PDA content type, or are they adiffent related node? OR are you just assuming a link convention?
Need to know more about your setup to answer.
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Simone Dal Maso Sent: Wednesday, July 23, 2008 11:45 PM To: support@drupal.org Subject: [support] help with php in a template
Hi, I'm using the content contemplate module for having different templates for each type of contents. I'm not able to write php, so I have a problem... I have a type of content called "pda". Each node is a brief description of a model of PDA. At the end of the page, I put 2 lines into the template of PDA's type of content, that are:
<div> <a href="index.php?q=Ausili/Podcast/ <?php print $node->nid ?> "> Download or listen to podcast about <?php print $title ?></a></div>
This lines allow user to see podcast about the PDA that he is reading. That's ok, but, if there are no podcast about that node, how can I turn off displaying that link? so users don't click to see only 2 words like "no podcast for that PDA"! Thanks in advance.
-- [ Drupal support list | http://lists.drupal.org/ ]
Hi, you wrote:
Need more information to help. Are the podcasts a field in the PDA content type, or are they adiffent related node? OR are you just assuming a link convention?
podcast is a type of content.
when users make a new podcast, they can select from a combobox, that is a list of pda's models, the right pda for which they want to upload their podcast. The combobox is a cck nodereference field, that lists all models of PDA, based on the PDA type of content. then, when a user make a podcast, its url is like: www.mysite.com/podcast/podcast_of_pdaname_written_by_authorname where pdaname is the name of PDA selected by the user, and authorname is the name of the user. the title of the page is made automatically by automatic nodetitle module. so, to summerize, we have 2 type of contents, pda and podcast. tell me if I should explain better.
Got it ok so that means you need to put a test in your template around the generation of the link, but first we need to figure out what where the node reference ID is, for this, installing the devel module is most helpful, cause you can configure it to dump the node structure for you for themeing purposes.
Another way is to put a <?php print_r($node); ?> statement to examine the node structure.
Then you wrap in an if statement
<?php if (somecomplex node expression that tests to see if the refernce field is null) { ?> conditional content goes here <?php } ?>
Does that make some sense?
Dave
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Simone Dal Maso Sent: Thursday, July 24, 2008 12:01 PM To: support@drupal.org Subject: Re: [support] help with php in a template
Hi, you wrote:
Need more information to help. Are the podcasts a field in the PDA content type, or are they adiffent related node? OR are you just assuming a link convention?
podcast is a type of content.
when users make a new podcast, they can select from a combobox, that is a list of pda's models, the right pda for which they want to upload their podcast. The combobox is a cck nodereference field, that lists all models of PDA, based on the PDA type of content. then, when a user make a podcast, its url is like: www.mysite.com/podcast/podcast_of_pdaname_written_by_authorname where pdaname is the name of PDA selected by the user, and authorname is the name of the user. the title of the page is made automatically by automatic nodetitle module. so, to summerize, we have 2 type of contents, pda and podcast. tell me if I should explain better.
-- [ Drupal support list | http://lists.drupal.org/ ]
Quoting "Metzler, David" metzlerd@evergreen.edu:
Another way is to put a <?php print_r($node); ?> statement to examine the node structure.
This debugging technique is good but looks better in the GUI as
<pre><?php print_r($node); ?></pre>
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/