Share » Forums » Setup & design » ezhttp get problem

ezhttp get problem

ezhttp get problem

Thursday 03 February 2005 5:26:14 pm - 7 replies

Author Message

Arran Price

Sunday 06 February 2005 11:39:21 am

I figured I would test to see if the issue was due to passing params to itself, by making it pass to a different template that just displays the vars eg:

{let  search_name=ezhttp('searchname','get')
   search_department=ezhttp('searchdepartment','get')
}
   <h1>Results Test</h1>
   <p>search_name={$search_name}</p>
   <p>search_department={$search_department}.</p>
   
{/let}   

The vars get passed the first time, but then every other time I use the first template to plug in the parameters it displays as the ones passed the first time in the second template.

Anybody able to throw me a lifeline?
This is the last hurdle I have for a fairly major application.

Arran

Łukasz Serwatka

Sunday 06 February 2005 12:01:56 pm

Hi,

This is because you have cache enabled. You can disable cache for this tpl file.

Put this at the first line in your tpl file.

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

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

Arran Price

Sunday 06 February 2005 12:30:39 pm

Many thanks Luke.
Just like that, its now working.

cheers

Arran

Łukasz Serwatka

Sunday 06 February 2005 12:56:02 pm

Hi,

Great. You don`t have to disable cache if you use accessing variables via URL like this
.../(lang)/en

so the variable is lang and has value en

{$view_parameters.lang} -> displays value

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

Arran Price

Sunday 06 February 2005 1:19:17 pm

Thanks, I have view_parameters working already for other parts of the app.
When I need the user to enter in something in say a text field I have to use either post or get though dont I?
Or is there a way to use it with a view_parameter?

Arran

Eivind Marienborg

Sunday 06 February 2005 8:03:54 pm

I'm trying to get the ezhttp to work in an edit template, without any luck.

This is the code that launches the edit template:

       <form method="post" action={"content/action"|ezurl}>

        <input type="hidden" name="ContentNodeID" value="{$:item.object.owner.main_node_id}" />
        <input type="hidden" name="ContentObjectID" value="{$:item.object.owner.id}" />
        <input type="hidden" name="ViewMode" value="full" />
        <input type="hidden" name="privat" value="{$:item.object.data_map.privat.data_int}">

        <input type="hidden" name="NodeID" value="{$:item.object.owner.main_node_id}" />
        <input type="hidden" name="ClassID" value="47">
        <input type="image" name="NewButton" value="svar" src="/share/icons/reply.gif" alt="Svar!" title="Svar!">
        </form>

The variable I'm trying to pick up, is "privat".

This is the code in the edit template (for testing purposes as of now..):

{let privat2=ezhttp('privat','get')}
        <!-- Privat2: {$privat2} -->
{/let}

This code returns nothing.

Having debug enabled, I get the error message "Unknown get variable 'privat'". Am I doing anything wrong, or is it just impossible to use ezhttp in edit templates?

Arran Price

Monday 07 February 2005 4:15:20 pm

I think your issue is that you are trying to read the variable from a get:

ezhttp('privat','get')}

but your form does a post

form method="post"

If you change both instances to either get or post you might have more luck.

Arran

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

36 542 Users on board!

Forums menu