Forums / Developer / Insert custom create form into a view full template

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

eZ debug

Timing: Jan 20 2025 14:29:02
Script start
Timing: Jan 20 2025 14:29:02
Module start 'content'
Timing: Jan 20 2025 14:29:02
Module end 'content'
Timing: Jan 20 2025 14:29:02
Script end

Main resources:

Total runtime0.2531 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0090 590.6875180.8125
Module start 'content' 0.00900.0045 771.500098.0547
Module end 'content' 0.01350.2395 869.5547530.8750
Script end 0.2530  1,400.4297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00321.2559200.0002
Check MTime0.00120.4870200.0001
Mysql Total
Database connection0.00070.259910.0007
Mysqli_queries0.208382.32031410.0015
Looping result0.00140.56041390.0000
Template Total0.239294.510.2392
Template load0.00090.365910.0009
Template processing0.238394.152710.2383
Override
Cache load0.00060.256410.0006
Sytem overhead
Fetch class attribute can translate value0.00070.257310.0007
XML
Image XML parsing0.00020.081410.0002
General
dbfile0.00602.3623200.0003
String conversion0.00000.001930.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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