eZ Community » Forums » Developer » Include a form in an another template
expandshrink

Include a form in an another template

Include a form in an another template

Tuesday 10 January 2012 2:31:28 pm - 4 replies

Hi there,

I have a feedback_form that I want to use in an another template.

What should I do to make it works ?

My feedback_form template is stored in :

/extension/project/design/project/override/templates/full/candidature.tpl

An the template for the class I want to display the form too :

/extension/project/design/project/override/templates/full/offre.tpl

{include uri='design:full/candidature.tpl'}

Seems not to work in offre.tpl (but no error message in debug)

Am I doing something wrong ?

I suppose that I will have to modify candidature.tpl too because $node will not be a correct reference.

Any idea ?

Thanks

Tuesday 10 January 2012 2:57:56 pm

What about fetching your feedback_form object and then displaying it using node_view_gui ?

{def $feedback_form = fetch()}
{node_view_gui view=full content_node=$feedback_form}

Tuesday 10 January 2012 3:17:27 pm

I did not know this template function.

I just changed my template to use a variable passed as an argument to hide headings.

Thank you very much Arnaud.

Tuesday 10 January 2012 3:50:26 pm

node_view_gui is very useful because it takes care of your overrides rules and manage caches if you want, also helping you reducing the amount of SQL queries...

It's commonly used for folders and homepages where the full view will embed line ones. 

And compared to {include ...} stuff, you don't have to deal with variables 'collision' if you forgot to undef them somewhere blunk.gif Emoticon

For your information, when you call a URL alias, it's the same as calling /content/view/full/1234. The HTML result found in your $module_result.content (in the pagelayout) is exactly the same as {node_view_gui view=full ....}. So if you call /content/view/line/1234, you will basically see what the line view looks like for the 1234 node blunk.gif Emoticon

Tuesday 10 January 2012 4:02:04 pm

Thank you very much for those details Arnaud.

It helped me and I'm sure it will help others happy.gif Emoticon

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from