Can't fetch current node ID.

Author Message

Robin Sørlie

Saturday 11 September 2004 4:11:42 am

I'm setting up a new eZ site, and want my users to be able to add/edit content from the frontend when they are logged in.

I have sucessfully made the edit function. Now I want a 'add new content' form in my templates so users can add content.

I have done following at the bottom of my folder-template;

{section show=count($node.object.can_create_class_list)}
<form method="post" action="/content/action">
<input type="hidden" name="NodeID" value="{$module_result.node_id}" />
<select name="ClassID">
{section name=Classes loop=$node.object.can_create_class_list}
<option value="{$Classes:item.id}">
{$Classes:item.name|wash}</option>
{/section}
</select>
<input class="button" type="submit" name="NewButton" value="{'Create here'|i18n('design/standard/node/view')}" />
</form>
{/section}

Wich makes the form right, but when I click 'Create here' I get the following error:
Fatal error: Call to a member function on a non-object in /home/midhand/public_html/ez-3.4.1/kernel/content/action.php on line 83
Fatal error: eZ publish did not finish it's request

Debug output:
Warning: eZContentObjectTreeNode::fetch Sep 11 2004 13:05:26
Cannot fetch node from empty node ID

I have tried to remove this line:

<input type="hidden" name="NodeID" value="{$module_result.node_id}" />

and then it works, but I have to decide where I want to put the new content, cause eZ didn't fetch what node I came from.

I run eZ 3.4.1 btw.

Ole Morten Halvorsen

Monday 13 September 2004 7:20:59 am

Robin,

<b>$module_result</b> is only available in pagelayout.tpl.

Instead of

<input type="hidden" name="NodeID" value="{$module_result.node_id}" />

use

<input type="hidden" name="NodeID" value="{$node.node_id}" />

Ole M.

Senior Software Engineer - Vision with Technology

http://www.visionwt.com
http://www.omh.cc
http://www.twitter.com/omh

eZ Certified Developer
http://ez.no/certification/verify/358441
http://ez.no/certification/verify/272578

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