[themes] how to stop a 'view' from showing a field?
sebastian
inforazor at gmail.com
Thu Apr 9 02:20:31 UTC 2009
Thank you Steve,
I've looked into the theming of the fields, and I have copied a new:
"view-view-fields.tpl.php"
file to my theme folder.
I can get it to react, but I am lacking some basic PHP wisdom.
I want to make a conditional statement, so that if the "title" property
of the field is empty, don't display anything. My problem is I can't see
how to access the title.
This is definitely wrong [line 2 is the important one], but here is how
I am trying it:
<?php if ( $field->class == "field-pdf-fid" ): ?>
<?php if ( $field->title != "" ): ?>
<<?php print $field->inline_html;?> class="views-field-<?php print
$field->class; ?>">
<?php if ($field->label): ?>
<label class="views-label-<?php print $field->class; ?>">
<?php print $field->label; ?>:
</label>
<?php endif; ?>
<?php
// $field->element_type is either SPAN or DIV depending upon whether
or not
// the field is a 'block' element type or 'inline' element type.
?>
<<?php print $field->element_type; ?> class="field-content"><?php
print $field->content; ?></<?php print $field->element_type; ?>>
</<?php print $field->inline_html;?>>
<?php endif; ?>
<?php endif; ?>
Thanks a bunch Steve!
p.s. I can't see how to combine && and || conditionals or 'else'
statements in PHP code written like this without throwing a huge error.
I'm used to seeing PHP code written more as a flow without constant
<?PHP : ?> breaks... anyways, not critical for now as I can work around
it, but it is bugging me. Also, isn't the "->" an assignment operation?
It's use here baffles me... Yes: I'm a wee green newbie php person, sigh.
Kind,
Sebastian.
Steve Ringwood wrote:
> If this is for views 2 you can provide a template file that over rides
> the theming for that field, click "information" (next to "Theme" in
> "Basic settings" column) for the file name(s) you can use.
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
>
More information about the themes
mailing list