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