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.

eZ debug

Timing: Jan 19 2025 06:07:45
Script start
Timing: Jan 19 2025 06:07:45
Module start 'layout'
Timing: Jan 19 2025 06:07:45
Module start 'content'
Timing: Jan 19 2025 06:07:46
Module end 'content'
Timing: Jan 19 2025 06:07:46
Script end

Main resources:

Total runtime1.2788 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.4141152.6563
Module start 'layout' 0.00640.0032 742.070339.5078
Module start 'content' 0.00951.2681 781.5781638.1484
Module end 'content' 1.27760.0011 1,419.726616.0938
Script end 1.2787  1,435.8203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2595160.0002
Check MTime0.00150.1167160.0001
Mysql Total
Database connection0.00090.073310.0009
Mysqli_queries1.198893.7463650.0184
Looping result0.00050.0387630.0000
Template Total1.241397.120.6206
Template load0.00200.159520.0010
Template processing1.239296.907920.6196
Template load and register function0.00010.009510.0001
states
state_id_array0.00130.102710.0013
state_identifier_array0.00110.083120.0005
Override
Cache load0.00200.15891460.0000
Sytem overhead
Fetch class attribute can translate value0.00060.044930.0002
Fetch class attribute name0.00150.120960.0003
XML
Image XML parsing0.00080.063930.0003
class_abstraction
Instantiating content class attribute0.00000.000960.0000
General
dbfile0.00230.1768160.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
28content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
25content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 61
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs