How Can create, remove, edit a object from the Pagelayout?

Author Message

Leandro Alves

Thursday 08 July 2004 10:05:57 am

Hi!

I'd like to allow my users to create, to remove and to edit ez's objects (article, file...) from the main site, not from admin page...

In eZ 3.3-5 demo there is how to create, but not how to edit the object created and how to remove it.

<b>Example of button for "New File" from eZ 3.3-5 demo</b>

{default content_object=$node.object
         content_version=$node.contentobject_version_object
         node_name=$node.name}
{section show=$content_object.can_create}

{section show=$node.path_array[2]|eq(62)}
<form method="post" action={"content/action"|ezurl}>
  <input type="hidden" name="NodeID" value="{$node.node_id}" />
  <input type="hidden" name="ClassID" value="12" />
  <input class="button" type="submit" name="NewButton" value="New file" />
</form>
{/section}

{/section}
{/default}

Its work fine!

But now, <b>How Can I remove or edit this file created?</b>

Thanks!
Leandro

Paul Borgermans

Monday 12 July 2004 12:39:17 pm

Leandro,

You can duplicate the code used in the admin interface easily in your "user" site. Put template debug on and you will see which templates to examine.

To edit a given node use something like

{section show=$node.object.can_edit}
            <a href={concat("content/edit/",$node.object.id)|ezurl}><img src={"small/edit.gif"|ezimage} alt="{'Edit'|i18n('design/standard/node/view')}" border="0"></a>
&nbsp;{/section}

To delete something, you can use

<form method="post" action={"content/action"|ezurl}>
<input type="hidden" name="ContentNodeID" value="{$node.object.main_node_id}" />
 <input type="hidden" name="ContentObjectID" value="{$node.object.id}" />
    <input type="image" name="ActionRemove" src={"small/edittrash.gif"|ezimage} />
</form>

I use an image here instead of the normal button. You may want to change that to what you have available

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

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