sebastian, 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.
In your CSS, just theme .no-field-A .field-A { display: none; }
Cheers, CK Ng
forDrupal Premium Themes (http://fordrupal.com) - we make drupal beautiful
On Fri, Apr 10, 2009 at 2:19 AM, themes-request@drupal.org wrote:
Message: 1 Date: Wed, 08 Apr 2009 17:56:46 -0700 From: sebastian inforazor@gmail.com Subject: [themes] how to stop a 'view' from showing a field? To: themes@drupal.org Message-ID: 49DD47CE.9070008@gmail.com Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hello listers,
Hope this is the right place to ask this question.
I am building a theme and I have little icons that I want to have appearing when there is a 'File - CCK' field present.
The field is optional in the content-type. I have created a view for the page that shows the content, and when the file-cck field is empty, it still shows all the surrounding <div> and <a href> tags, which triggers my CSS and then I still show the little custom PDF icon; only I want it to be blank.
When I click on the View for the field: file-cck (generic files)
I only see the options:
- Exclude from display
- Rewrite output field
- Output this field as a link
- Trim to max length
- Link this to its node
- Label [none/drop down]
- Format [generic files]
I can't see from this list any way to have it be conditional; ie: only display Field formatting [Div+a href] if there is actually any data present.
Thanks for your help, hopefully this is an easy one. :)
Kind,
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...
Where is the phptemplate_preprocess_node?
I've been looking everywhere to find this, is it a field in the admin tool?
or: A *.tpl.php file I am supposed to make from scratch? ie: http://drupal.org/node/223430
If its the later, I have no idea what is going on with all these 10 preprocessors... are there examples of these files?
Thanks,
Sebastian.
Ng Chin Kiong wrote:
sebastian,
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.
In your CSS, just theme .no-field-A .field-A { display: none; }
Cheers, CK Ng
forDrupal Premium Themes (http://fordrupal.com)
- we make drupal beautiful
On Fri, Apr 10, 2009 at 2:19 AM, <themes-request@drupal.org mailto:themes-request@drupal.org> wrote:
Message: 1 Date: Wed, 08 Apr 2009 17:56:46 -0700 From: sebastian <inforazor@gmail.com <mailto:inforazor@gmail.com>> Subject: [themes] how to stop a 'view' from showing a field? To: themes@drupal.org <mailto:themes@drupal.org> Message-ID: <49DD47CE.9070008@gmail.com <mailto:49DD47CE.9070008@gmail.com>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Hello listers, Hope this is the right place to ask this question. I am building a theme and I have little icons that I want to have appearing when there is a 'File - CCK' field present. The field is optional in the content-type. I have created a view for the page that shows the content, and when the file-cck field is empty, it still shows all the surrounding <div> and <a href> tags, which triggers my CSS and then I still show the little custom PDF icon; only I want it to be blank. When I click on the View for the field: file-cck (generic files) I only see the options: - Exclude from display - Rewrite output field - Output this field as a link - Trim to max length - Link this to its node - Label [none/drop down] - Format [generic files] I can't see from this list any way to have it be conditional; ie: only display Field formatting [Div+a href] if there is actually any data present. Thanks for your help, hopefully this is an easy one. :) Kind,
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
Sebastian ,
You may get better response in support forum. phptemplate_preprocess_node() should go inside your template.php
Google and Drupal handbook is your friends =) http://drupal.org/node/223430 http://drupal.org/node/337022
/* this goes into template.php */ function phptemplate_preprocess_node(&$vars, $hook) { $node_classes = array();
// may need to check content of $vars['node']->field_MYFIELD? if ($vars['node']->type == "YOUR_CONTENT_TYPE" && $vars['node']->field_MYFIELD) { $node_classes[] = 'node-no-MYFEILD'; } $node_classes = array_filter($node_classes); $vars['node_classes'] = implode(' ', $node_classes); }
/* this goes in your node.tpl.php */ <div ... class="node <?php print $node_classes; ?> ...">
Cheers, CK Ng
forDrupal Premium Themes (http://fordrupal.com) - we make drupal beautiful
On Fri, Apr 10, 2009 at 2:53 PM, sebastian inforazor@gmail.com wrote:
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...
Where is the phptemplate_preprocess_node?
I've been looking everywhere to find this, is it a field in the admin tool?
or: A *.tpl.php file I am supposed to make from scratch? ie: http://drupal.org/node/223430
If its the later, I have no idea what is going on with all these 10 preprocessors... are there examples of these files?
Thanks,
Sebastian.
Ng Chin Kiong wrote:
sebastian,
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.
In your CSS, just theme .no-field-A .field-A { display: none; }
Cheers, CK Ng
forDrupal Premium Themes (http://fordrupal.com)
- we make drupal beautiful
On Fri, Apr 10, 2009 at 2:19 AM, <themes-request@drupal.org mailto: themes-request@drupal.org> wrote:
Message: 1 Date: Wed, 08 Apr 2009 17:56:46 -0700 From: sebastian <inforazor@gmail.com mailto:inforazor@gmail.com> Subject: [themes] how to stop a 'view' from showing a field? To: themes@drupal.org mailto:themes@drupal.org Message-ID: <49DD47CE.9070008@gmail.com mailto:49DD47CE.9070008@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hello listers,
Hope this is the right place to ask this question.
I am building a theme and I have little icons that I want to have appearing when there is a 'File - CCK' field present.
The field is optional in the content-type. I have created a view for the page that shows the content, and when the file-cck field is empty, it still shows all the surrounding <div> and <a href> tags, which triggers my CSS and then I still show the little custom PDF icon; only I want it to be blank.
When I click on the View for the field: file-cck (generic files)
I only see the options:
- Exclude from display
- Rewrite output field
- Output this field as a link
- Trim to max length
- Link this to its node
- Label [none/drop down]
- Format [generic files]
I can't see from this list any way to have it be conditional; ie: only display Field formatting [Div+a href] if there is actually any data present.
Thanks for your help, hopefully this is an easy one. :)
Kind,
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes
themes mailing list themes@drupal.org http://lists.drupal.org/mailman/listinfo/themes