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.

eZ debug

Timing: Jan 19 2025 12:51:35
Script start
Timing: Jan 19 2025 12:51:35
Module start 'layout'
Timing: Jan 19 2025 12:51:35
Module start 'content'
Timing: Jan 19 2025 12:51:35
Module end 'content'
Timing: Jan 19 2025 12:51:35
Script end

Main resources:

Total runtime0.0256 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 589.3984152.6563
Module start 'layout' 0.00720.0033 742.054739.5078
Module start 'content' 0.01040.0129 781.562589.5234
Module end 'content' 0.02330.0022 871.085934.3047
Script end 0.0256  905.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002811.0166140.0002
Check MTime0.00124.6421140.0001
Mysql Total
Database connection0.00103.830310.0010
Mysqli_queries0.004116.041830.0014
Looping result0.00000.069710.0000
Template Total0.00176.510.0017
Template load0.00083.288110.0008
Template processing0.00083.179310.0008
Override
Cache load0.00062.196410.0006
General
dbfile0.00031.065780.0000
String conversion0.00000.027040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs