Insert custom create form into a view full template

Author Message

Sébastien Antoniotti

Thursday 15 May 2008 12:12:15 am

Hi everybody !

I would like to manually create a form who publishes new objects, and insert him into a view full template.

In other words : on my homepage (homepage.tpl => mapped of view full of node_id 2), I want to insert a form (inspired by ezwebin/design/ezwebin/override/templates/edit/forum_topic.tpl by example) who permit anonymous user to add object of the "free_comment" class.

The problem is that into the form (forum_topic.tpl like) I need the $object variable in order to build the form head :

<form enctype="multipart/form-data" method="post" action={concat( "/content/edit/", $object.id, "/", $edit_version, "/", $edit_language|not|choose( concat( $edit_language, "/" ), '' ) )|ezurl}>

... and into the view full of my homepage, I don't know how to get the $object variable...

I precise that i don't want to just insert a submit button who redirect the user to the content/edit view, but to really insert the form into my homepage.

Thanks in advance !

eZ Publish Freelance
web : http://www.webaxis.fr

Maxime Thomas

Sunday 18 May 2008 10:40:07 pm

Hi Sebastien,

Maybe you can find some interesting things there :
http://ez.no/doc/ez_publish/technical_manual/4_0/templates/the_pagelayout/variables_in_pagelayout

You can also use a conatent action handler :
http://serwatka.net/index.php/en/blog/do_you_need_action

Very usefull if you want to add a form to a view template without redirecting to an edit template.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Sébastien Antoniotti

Monday 19 May 2008 12:03:51 am

Hi,

Thank you very much for that link !

Waiting, I made a custom module who handles the form submission and creates the object, but it seems that the content_actionhandler.php could make the same thing without the need of writing a custom module.

This is very usefull and faster that writing a module for small things.

Cheers,
Seb.

eZ Publish Freelance
web : http://www.webaxis.fr

Łukasz Serwatka

Monday 19 May 2008 12:40:03 am

Krisof made very nice extension called "Power Content".
http://projects.ez.no/powercontent

You might be interested too.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Sébastien Antoniotti

Monday 19 May 2008 1:14:49 am

Hi Lukasz,

Thanks for your reply, yesterday I discover and tried powercontent who is great but doesn't allow me to make custom validations on form inputs.

In all cases thanks for your blog (I'm a fan) ;)

eZ Publish Freelance
web : http://www.webaxis.fr

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 20 2025 17:26:10
Script start
Timing: Jan 20 2025 17:26:10
Module start 'layout'
Timing: Jan 20 2025 17:26:10
Module start 'content'
Timing: Jan 20 2025 17:26:11
Module end 'content'
Timing: Jan 20 2025 17:26:11
Script end

Main resources:

Total runtime1.2384 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.0078 588.0703151.2266
Module start 'layout' 0.00780.0036 739.296936.6797
Module start 'content' 0.01141.2261 775.9766647.6094
Module end 'content' 1.23750.0009 1,423.585915.8125
Script end 1.2383  1,439.3984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2865160.0002
Check MTime0.00150.1191160.0001
Mysql Total
Database connection0.00130.107010.0013
Mysqli_queries1.177595.0816650.0181
Looping result0.00060.0494630.0000
Template Total1.204597.320.6022
Template load0.00270.215120.0013
Template processing1.201897.045420.6009
Template load and register function0.00010.009310.0001
states
state_id_array0.00080.065710.0008
state_identifier_array0.00070.052620.0003
Override
Cache load0.00220.1813380.0001
Sytem overhead
Fetch class attribute can translate value0.00090.071530.0003
Fetch class attribute name0.00080.062180.0001
XML
Image XML parsing0.00170.133230.0006
class_abstraction
Instantiating content class attribute0.00000.0018100.0000
General
dbfile0.00120.0966300.0000
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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs