Share » Forums » Setup & design » Some problems with the guestbook...

Some problems with the guestbook example in the tutorial

Some problems with the guestbook example in the tutorial

Wednesday 26 November 2003 1:52:24 pm - 4 replies

Author Message

Marco Zinn

Wednesday 26 November 2003 2:43:24 pm

Hi,
can you show us your template?
The error complains about some problems with parameters in the template, probably from a fetch function.
Check brackets, commas, quotes and double-quotes in the fetch call...

Marco
http://www.hyperroad-design.com

Johan Grasmo

Wednesday 26 November 2003 10:55:18 pm

Thanks for the reply Marco.
My template file (located under /design/.../override/templates/folder_full_view_guestbook.tpl

{*?template charset=latin1?*}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="no" lang="no">

<head>
<link rel="stylesheet" type="text/css" media="screen" href={"stylesheets/core_common.css"|ezdesign} />

{*include uri="design:page_head.tpl" enable_glossary=false() enable_help=false()*}

</head>

<body>
<table id="PageTable" cellpadding="0" cellspacing="0">
{include uri="design:page_topbox.tpl}
{include uri="design:page_languagebar.tpl}

<tr>
<td valign="top">
<table cellpadding="0" cellspacing="0" id="BodyTable">

{include uri="design:page_history.tpl}
<tr>
<td height="100%" valign="top">
<table border="0" id="ContentTable">
<tr>
{include uri="design:left_menu.tpl"}
<td valign="top" align="left" width="100%">
<table border="0" id="ContentArea">
<tr>
<td valign="top" align="left" width="100%">
<h1>{$node.name}</h1>
<div class="pagetitle">
{$node.name}
</div>

<table class="guestbook">
<tr><td>
{$node.object.data_map.description.content.output.output_text}
</td><td>

</td></tr>
<tr><td>
<form method="post"
action={"content/action/"|ezurl}>

<input class="button"
type="submit"
name="NewButton"
value="Sign the guestbook" />

<input type="hidden"
name="ClassID"
value="17" />

<input type="hidden"
name="NodeID"
value="{$node.node_id}" />
</form>
</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}

</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
{include uri="design:page_footer.tpl}
</table>
</td>
</tr>
</table>
</body>
</html>

I've checked a post by Tore Skobba (in this forum), where he has some problems with the $node. I think I have the same problems - do you have any suggestions in how I can fix this ?

Sincerely,

Johan Grasmo

Tore Skobba

Thursday 27 November 2003 3:50:16 am

Hi Johan

It might look like you are trying to access $node in an template where $node is not available. Try inserting the code below which fetches the node based on "$module_result.node_id" ($module.. is always available):

{let node=fetch(content,node,hash(node_id,$module_result.node_id))}
.... use $node here.
{let}

Johan Grasmo

Friday 28 November 2003 12:58:00 am

Thanks Tore.

I think I now know how to work around the quirks in ez.
This should be documented somehow better btw.

Johan

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu