Some problems with the guestbook example in the tutorial

Author Message

Johan Grasmo

Wednesday 26 November 2003 1:52:24 pm

Hi all,

I'm putting up an ezPublish site, and I want to add a guestbook. I decided to follow the guestbook tutorial (http://ez.no/developer/ez_publish_3/documentation/building_an_ez_publish_site/the_guestbook), but I have some problems when I press the "Sign the guestbook"-button. The error-messages I get are:
[snip]
Error: eZTemplate
No such attribute for array(4): node_id
Choose one of following: content, path, navigation_part, uri

Error: eZModuleFunctionInfo::execute content::node
Missing parameter 'node_id' for function 'node' in module 'content'
.
.
.
Error: eZTemplate @ design/fairtradenet/templates/pagelayout.tpl:37[14]
Cannot retrieve attribute of a NULL
[/snip]

In this run I'm using different templates than the example. I get the same error when I'm following the tutorial. I have changed the class-id in the form to my guestbook entry class.

I suspect that it doesn't get the values that are submitted, but I've been stuck for two evenings now and I don't have a clue what can be wrong.
Again: I've followed the tutorial, but I get the same error (more or less).

I'm running ezPublish 3.2-3 (3.2 release 3) with mysql.

Any help is _very_ appreciated

Sincerely,

Johan Grasmo

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.