Forums / Setup & design / Some problems with the guestbook example in the tutorial

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

eZ debug

Timing: Jan 19 2025 03:20:40
Script start
Timing: Jan 19 2025 03:20:40
Module start 'content'
Timing: Jan 19 2025 03:20:41
Module end 'content'
Timing: Jan 19 2025 03:20:41
Script end

Main resources:

Total runtime1.0082 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.2109180.7969
Module start 'content' 0.00630.8814 770.0078643.2578
Module end 'content' 0.88770.1203 1,413.2656341.3359
Script end 1.0081  1,754.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4006210.0002
Check MTime0.00150.1511210.0001
Mysql Total
Database connection0.00060.062410.0006
Mysqli_queries0.916190.86922020.0045
Looping result0.00190.18782000.0000
Template Total0.977497.020.4887
Template load0.00200.197320.0010
Template processing0.975496.753620.4877
Template load and register function0.00020.023610.0002
states
state_id_array0.00090.091310.0009
state_identifier_array0.00250.243220.0012
Override
Cache load0.00190.18971460.0000
Sytem overhead
Fetch class attribute can translate value0.00150.146540.0004
Fetch class attribute name0.00090.085960.0001
XML
Image XML parsing0.00120.114940.0003
class_abstraction
Instantiating content class attribute0.00000.000960.0000
General
dbfile0.00350.3465270.0001
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 61
 Number of unique templates used: 6

Time used to render debug report: 0.0004 secs