trouble using ezhttp() to get post data when viewing a node

Author Message

Atle Pedersen

Friday 30 June 2006 9:10:32 am

Hi everybody!

I'm having trouble using froms to post data to a node view.

For test purposes I'm tring the following temnplate when viewing a node:

Testname value.:{ezhttp('testname')}:.<br />
<form name="something" method='post' action={$node.url_alias|ezurl}>
<input type="hidden" name="testname" value="testvalue" />
<input type="submit" name="submitbutton" value="submit" />
</form>

Why isn't this working?

When first loading the page, I get an error saying there's no postdata named testname. After pressing the submit button, there's no more error messages. But there still no data to be fetched by the ezhttp function.

Also, if using the get method insted of post, the data is clearly present in the url. But still not accessible using ezhttp('testname','get')

Kristian Hole

Friday 30 June 2006 9:50:20 am

This is because the node-view is cached. (ViewCaching=enabled). This is because is should not be needed to regenerate an article (for example) every time it loads.

The caching system handles view parameters (on the format /myurl/(myparameter)/myvalue. Where it is available in the template as $view_parameters.myvalue. I know there are extensions for transforming get or post variables to view parameters. I could however not find it right now.

Alternatively can you disable the view-cache for your specific template. This is done by adding the following to the template

{set-block scope=root variable=cache_ttl}0{/set-block}

By turning the viewcache off, the performance will offcourse be decrease.

Have a nice weekend :-)

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Atle Pedersen

Friday 30 June 2006 10:19:43 am

Thank you Kristian. The explanation makes sense, and that set-block hack seems to do the trick.

I wish I understood more about the intricacies of the cache system, though.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.