After moving to the latest dev version. I couldn't manage to make this work. If I try to use the default template i can see all the fields listed on the node page.

But when i try to use my previously working template, it doesn't work. And I think I know the reason of this problem;

There is no "['view'] tagged" variable on the variable list below. This may be because of the CCK version I upgraded. So here is my recent module versions;

Content Construction Kit (CCK) 6.x-2.x-dev (2008-Sep-02)
Content Templates (Contemplate) 6.x-1.x-dev (2008-Jul-09)
Content Taxonomy 6.x-1.x-dev (2008-Aug-30)

btw, I can't revert back to previous versions on some modules. Because I'm getting WSOD everywhere on the site if I do that.

Comments

korayal’s picture

I found out that;

print $node->field_fieldname[0]['view']

is not the method recommended by CCK. The method they offer is like this;

print content_format($field, $item, $formatter = 'default', $node = NULL)

So we should use something like this;

print content_format('field_fieldname', $node->field_fieldname[0])

but this has problems with the display properties of the field. (different displays on teaser or node view) For example you can't make a field appear as a link on teasers and plain on node pages.

Also an imagefield appears as a filefield on default formatter of "content_format"

korayal’s picture

Status: Active » Fixed

Found out that the "default" format type in content_format function is;

what is a default selection on the page;

http://www.site.com/admin/content/node-type/nodetypename/display

if you check the source code of the page, you will find these lines;

<table class="sticky-enabled">
 <thead><tr><th>Field</th><th>Label</th><th>Teaser</th><th>Full node</th> </tr></thead>
<tbody>
 <tr class="odd">
<td><strong>Film Bilgileri</strong></td>
<td>
<div class="form-item" id="edit-group-film-bilgileri-label-wrapper">
<select name="group_film_bilgileri[label]" class="form-select" id="edit-group-film-bilgileri-label" >
<option value="above" selected="selected">Above</option>
<option value="hidden">&lt;Hidden&gt;</option>
</select>
</div>
</td>

<td>
<div class="form-item" id="edit-group-film-bilgileri-teaser-format-wrapper">
 <select name="group_film_bilgileri[teaser][format]" class="form-select" id="edit-group-film-bilgileri-teaser-format" >
<option value="no_style">no styling</option><option value="simple">simple</option>
<option value="fieldset" selected="selected">fieldset</option>
<option value="fieldset_collapsible">fieldset - collapsible</option>
<option value="fieldset_collapsed">fieldset - collapsed</option>
<option value="hidden">&lt;Hidden&gt;</option>
</select>
</div>
</td>

<td>
<div class="form-item" id="edit-group-film-bilgileri-full-format-wrapper">
 <select name="group_film_bilgileri[full][format]" class="form-select" id="edit-group-film-bilgileri-full-format" >
<option value="no_style">no styling</option>
<option value="simple">simple</option>
<option value="fieldset" selected="selected">fieldset</option>
<option value="fieldset_collapsible">fieldset - collapsible</option>
<option value="fieldset_collapsed">fieldset - collapsed</option>
<option value="hidden">&lt;Hidden&gt;</option></select>
.
.
.
.
<td>
<div class="form-item" id="edit-field-afisresim-teaser-format-wrapper">
 <select name="field_afisresim[teaser][format]" class="form-select" id="edit-field-afisresim-teaser-format" >
<option value="default">Generic files</option>
<option value="afis_default">afis image</option>
<option value="afis_linked" selected="selected">afis image linked to node</option>
<option value="afis_imagelink">afis image linked to image</option>
<option value="afis_path">afis file path</option>
<option value="afis_url">afis URL</option>
<option value="image_plain">Resim</option>
<option value="image_nodelink">Image linked to node</option>
<option value="image_imagelink">Image linked to file</option>
<option value="path_plain">Path to file</option>
<option value="url_plain">URL to file</option>
<option value="imagefield__lightbox2__original__afis">Lightbox2: original-&gt;afis</option>
<option value="imagefield__lightbox2__afis__original">Lightbox2: afis-&gt;original</option>
<option value="imagefield__lightbox2__afis__afis">Lightbox2: afis-&gt;afis</option>
<option value="imagefield__lightshow2__original__afis">Lightbox2 slideshow: original-&gt;afis</option>
<option value="imagefield__lightshow2__afis__original">Lightbox2 slideshow: afis-&gt;original</option>
<option value="imagefield__lightshow2__afis__afis">Lightbox2 slideshow: afis-&gt;afis</option>
<option value="imagefield__lightframe2__original__node">Lightbox2 iframe: original-&gt;node page</option>
<option value="imagefield__lightframe2__afis__node">Lightbox2 iframe: afis-&gt;node page</option>
<option value="hidden">&lt;Hidden&gt;</option>
</select>
</div>
</td>

<td>
<div class="form-item" id="edit-field-dizisinema-teaser-format-wrapper">
 <select name="field_dizisinema[teaser][format]" class="form-select" id="edit-field-dizisinema-teaser-format" >
<option value="default" selected="selected">As Text</option>
<option value="link">As Link</option>
<option value="hidden">&lt;Hidden&gt;</option>
</select>
</div>
</td>
.
.
.

As you can see in the code there are option fields in the code like;

<option value="imagefield__lightbox2__afis__original">Lightbox2: afis-&gt;original</option>
<option value="afis_linked" selected="selected">afis image linked to node</option>
<option value="link">As Link</option>
.
.

from these codes we can understand that if we want from a specific field to be viewed as links, the formatter for that field is link, so;

print content_format('field_dizisinema', $node->field_dizisinema[0], 'link')

will show that field as a link. Another example for an imagefield is similar. If we want to show the image field as a imagecache conversion template named afis, and we want that image to be linked to the original image with lightbox2;

print content_format('field_afisresim' ,$node->field_afisresim[0], 'imagefield__lightbox2__afis__original')

will do what we wanted.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Anonymous’s picture

not usre if anyone will reply back but i hope so this does not work for me.

print content_format('field_page_banner',$node->field_page_banner[0],'banner_image_default')

all i get back on the page is 1. not sure whats going on but i just want to display the image through imagecache.

korayal’s picture

did you check if imagecache is working?

check the source code of a sample node of that type, search for an image tag with the class "imagecache"
if there is the tag, check if the imagecached file (files/imagecache/banner_image/etc.jpg) exists.

According to http://api.freestylesystems.co.uk/api/function/content_format it supposed to work the same in both 5.x and 6.x (at least it works on me (6.4))

lelizondo’s picture

subscribe