<div>Sebastian ,</div><div><br></div><div>You may get better response in support forum.</div><div>phptemplate_preprocess_node() should go inside your template.php<br></div><div><br></div><div>Google and Drupal handbook is your friends =)</div>
<div><a href="http://drupal.org/node/223430">http://drupal.org/node/223430</a><br></div><div><a href="http://drupal.org/node/337022">http://drupal.org/node/337022</a><br></div><div><br></div><div>/* this goes into template.php */</div>
<div><div>function phptemplate_preprocess_node(&$vars, $hook) {</div><div><div> $node_classes = array();<br></div><div><br></div><div> // may need to check content of $vars['node']->field_MYFIELD?</div><div>
if ($vars['node']->type == "YOUR_CONTENT_TYPE" && $vars['node']->field_MYFIELD) {</div><div> $node_classes[] = 'node-no-MYFEILD';<br></div><div> }</div></div><div><div>
$node_classes = array_filter($node_classes);</div><div> $vars['node_classes'] = implode(' ', $node_classes);</div><div>}<br></div></div></div><div><br></div><div><br></div><div>/* this goes in your node.tpl.php */</div>
<div><div><div ... class="node <?php print $node_classes; ?> ..."></div><div><br></div></div><br clear="all">Cheers,<br>CK Ng<br><br>forDrupal Premium Themes (<a href="http://fordrupal.com">http://fordrupal.com</a>)<br>
- we make drupal beautiful<br>
<br><br><div class="gmail_quote">On Fri, Apr 10, 2009 at 2:53 PM, sebastian <span dir="ltr"><<a href="mailto:inforazor@gmail.com">inforazor@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Sigh, I'm a fairly smart person, at least, I thought I was... but the more I try and figure out things in Drupal, the more lost I become. My site is 90%+ done, but these last ordeals are really painful to unravel...<br>
<br>
Where is the phptemplate_preprocess_node?<br>
<br>
I've been looking everywhere to find this, is it a field in the admin tool?<br>
<br>
or: A *.tpl.php file I am supposed to make from scratch?<br>
ie: <a href="http://drupal.org/node/223430" target="_blank">http://drupal.org/node/223430</a><br>
<br>
If its the later, I have no idea what is going on with all these 10 preprocessors... are there examples of these files?<br>
<br>
Thanks,<br>
<br>
Sebastian.<br>
<br>
Ng Chin Kiong wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
sebastian,<br>
<br>
Actually don't need to touch view or view template. The more 'natural' way is to check it under phptemplate_preprocess_node, if the field's content does not exist, add an additional CSS class to the node (says 'no-field-A'). This way you theme the node + the view or other ways that you retrieve a node.<br>
<br>
In your CSS, just theme<br>
.no-field-A .field-A {<br>
display: none;<br>
}<br>
<br>
<br>
Cheers,<br>
CK Ng<br>
<br>
forDrupal Premium Themes (<a href="http://fordrupal.com" target="_blank">http://fordrupal.com</a>)<br>
- we make drupal beautiful<br>
<br>
<br></div><div class="im">
On Fri, Apr 10, 2009 at 2:19 AM, <<a href="mailto:themes-request@drupal.org" target="_blank">themes-request@drupal.org</a> <mailto:<a href="mailto:themes-request@drupal.org" target="_blank">themes-request@drupal.org</a>>> wrote:<br>
<br>
<br>
<br>
Message: 1<br>
Date: Wed, 08 Apr 2009 17:56:46 -0700<br></div>
From: sebastian <<a href="mailto:inforazor@gmail.com" target="_blank">inforazor@gmail.com</a> <mailto:<a href="mailto:inforazor@gmail.com" target="_blank">inforazor@gmail.com</a>>><div class="im"><br>
Subject: [themes] how to stop a 'view' from showing a field?<br></div>
To: <a href="mailto:themes@drupal.org" target="_blank">themes@drupal.org</a> <mailto:<a href="mailto:themes@drupal.org" target="_blank">themes@drupal.org</a>><div class="im"><br>
Message-ID: <<a href="mailto:49DD47CE.9070008@gmail.com" target="_blank">49DD47CE.9070008@gmail.com</a><br></div>
<mailto:<a href="mailto:49DD47CE.9070008@gmail.com" target="_blank">49DD47CE.9070008@gmail.com</a>>><div class="im"><br>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br>
<br>
Hello listers,<br>
<br>
Hope this is the right place to ask this question.<br>
<br>
I am building a theme and I have little icons that I want to have<br>
appearing when there is a 'File - CCK' field present.<br>
<br>
The field is optional in the content-type. I have created a view for the<br>
page that shows the content, and when the file-cck field is empty, it<br>
still shows all the surrounding <div> and <a href> tags, which triggers<br>
my CSS and then I still show the little custom PDF icon; only I want it<br>
to be blank.<br>
<br>
When I click on the View for the field: file-cck (generic files)<br>
<br>
I only see the options:<br>
<br>
- Exclude from display<br>
- Rewrite output field<br>
- Output this field as a link<br>
- Trim to max length<br>
- Link this to its node<br>
- Label [none/drop down]<br>
- Format [generic files]<br>
<br>
I can't see from this list any way to have it be conditional; ie: only<br>
display Field formatting [Div+a href] if there is actually any data<br>
present.<br>
<br>
Thanks for your help, hopefully this is an easy one.<br>
:)<br>
<br>
Kind,<br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
themes mailing list<br>
<a href="mailto:themes@drupal.org" target="_blank">themes@drupal.org</a><br>
<a href="http://lists.drupal.org/mailman/listinfo/themes" target="_blank">http://lists.drupal.org/mailman/listinfo/themes</a><br>
</blockquote>
_______________________________________________<br>
themes mailing list<br>
<a href="mailto:themes@drupal.org" target="_blank">themes@drupal.org</a><br>
<a href="http://lists.drupal.org/mailman/listinfo/themes" target="_blank">http://lists.drupal.org/mailman/listinfo/themes</a><br>
</blockquote></div><br>