Forums / Setup & design / Having trouble with guestbook tutorial

Having trouble with guestbook tutorial

Author Message

CC Zona

Sunday 15 February 2004 10:30:32 pm

I've been unable to complete the tutorial's section on creating a custom template for the guestbook <http://ez.no/ez_publish/documentation/building_an_ez_publish_site/the_guestbook/creating_the_template>. The folder description shows up, but none of the contents that should be generated on each pass through the loop. ezP seems to believe there are zero children, since it doesn't execute the loop and the counter remains set at zero. Here's what I've tried:

-Confirmed the guestbook folder is assigned to Guestbook section
-Confirmed the guestbook entries are published, within the guesbook folder, and assigned to the correct section
-Tried several different permissions for user role Anonymous, including read access just for the guestbook class, just for guestbook section, both, and any section/class.
-Confirmed that full_view_guestbook_folder.tpl is overriding /view/node/full.tpl, that it's assigned to use folder/guestbook, and that the content is copied exactly from the tutorial page. Even removed and re-built it to be doubly sure that all the settings were right.
-Searched ez.no for mentions of similar problems. Substituting "$module_result" for "$node" within the "let" statement, as suggested in <http://ez.no/community/forum/setup_design/some_problems_with_the_guestbook_example_in_the_tutorial> also didn't work.
-Rebuilt the caches each time the above didn't work.

What else should I check? (In case it's relevant, this is ezP 3.3-3, running on Apache under OSX, with 24MB allocated to PHP.)

(Source of template)
<div class="pagetitle">
{$node.name}
</div>

<table class="guestbook">
<tr><td>
{$node.object.data_map.description.content.output.output_text}
</td><td>
<img src={"guestbook.png"|ezimage}>
</td></tr>
<tr><td>
<!-- The button will be here! -->
</td><td>
</td></tr>
</table>

{* Grab all the guestbook entries. *}
{let name=test counter=0 children=fetch( content,
list,
hash( parent_node_id,
$node.node_id,
sort_by,
$node.sort_array
)
)
}

<table class="news_archive">

{* Loop through all the entries. *}
{section loop=$:children}

{* Increment the counter by one. *}
{set counter=$:counter|inc}

<tr><td>
<hr />
Submitted by <b>{$:item.object.data_map.name.content|wash}</b>
on {$:item.object.published|l10n(shortdate)}:
<br />
<br />
<i>{$:item.object.data_map.entry.content|wash}</i>
</td></tr>

{* End of loop. *}
{/section}

<tr><td><hr /></td></tr>
</table>

<div class="center">
Number of entries in the guestbook: {$:counter}
</div>

{* Release the counter and the children variable. *}
{/let}

(Source of parsed result)
<div class="pagetitle">
Guestbook
</div>

<table class="guestbook">
<tr><td>
<p>
The guestbook is the place to tell us what you think of the site!
</p>

</td><td>
<img src="/ezpublish/tscm/design/tscm/images/guestbook.png">
</td></tr>
<tr><td>
<!-- The button will be here! -->
</td><td>
</td></tr>
</table>

<table class="news_archive">

<tr><td><hr /></td></tr>
</table>

<div class="center">
Number of entries in the guestbook: 0
</div>

James Packham

Monday 16 February 2004 3:11:28 am

Get rid of

name=test

from your let. Turn on debugging, see what you get. Put {$children|attribute(show)} before your section, to see if your fetch statement is actually collecting anything from the database.

Regards,

James