Forums / Developer / GET and POST in main page

GET and POST in main page

Author Message

David Santiso

Tuesday 08 March 2011 3:59:01 pm

Hi,

I'm trying to send a get or post variable to the main page but do not recognize it. In the remaining sections of the website it works.

Any ideas?

Thanks,

David

Sebastiaan van der Vliet

Tuesday 08 March 2011 11:47:18 pm

Hi David,

What do you mean by 'main page' - the pagelayout template?

Regards,
Sebastiaan

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

David Santiso

Wednesday 09 March 2011 4:10:39 am

Yes.

I've created a POST variable in 2zonespagelayout1 template sent to index.php, but index.php don't show it.

David Santiso

Wednesday 09 March 2011 6:02:37 am

My code is this:

In 2zoneslayout1.tpl:

{def $var="Hi"}

{if $ezhttp_hasvariable( 'button' )}
    {$var}
{/if}
...
<form method="post" action="">
    <input type="submit" name="button" value="send">
</form>
...

But when I push the button doesn't show "var".

Frédéric DAVID

Wednesday 09 March 2011 6:08:27 am

"

My code is this:

In 2zoneslayout1.tpl:

{def $var="Hi"}

{if $ezhttp_hasvariable( 'button' )}
    {$var}
{/if}
...
<form method="post" action="">
    <input type="submit" name="button" value="send">
</form>
...

But when I push the button doesn't show "var".

"

Hi,

your condition can work only the first time, when content cache should be created. After eZ publish creates cache, and eZ publish doesn't mind about post and get variable. To have the variable, you have to pass by unordered parameters : ex : (var)/test

Regards

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

David Santiso

Wednesday 09 March 2011 7:30:25 am

I don't undestand you. "you have to pass by unordered parameters"? I don't understand your example.

eric browet

Wednesday 09 March 2011 8:33:57 am

Hello David,

here you can find help for ordered and unordered parameters.

http://doc.ez.no/eZ-Publish/Technical-manual/4.4/Concepts-and-basics/Modules-and-views

you can look if this line of code work in your instance of eZ and your context:

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

http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Template-functions/Variables/set-block

Regards

Aussi perçante que soit la vue on ne se voie jamais de dos
eZ Publish Developer Basics Certification (4.4)
http://ez.no/certification/verify/396958

David Santiso

Wednesday 09 March 2011 11:31:06 am

Hi Eric,

I'm reading documentation and I understand that if I put:

<a href={'/content/view/full/2'|ezurl()}>URL</a>

... This redirects to homepage, but I can to add a unordered parameter:

<a href={'/content/view/full/2/var/95'|ezurl()}>URL</a>

... But, can I recover this parameter (var)?

Thanks,

Gaetano Giunta

Wednesday 09 March 2011 1:37:45 pm

First off, you should use

<span>/content/view/full/2/(var)/95</span>

Second, you'll find it in $module_result.view_parameters (when viewing a node) - see http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Templates/The-pagelayout/Variables-in-pagelayout

Principal Consultant International Business
Member of the Community Project Board

David Santiso

Thursday 10 March 2011 11:18:44 am

Thanks,

I am printing

{$module_result.view_parameters}
...
{$module_result.node_id}
...

and others and it shows nothing.

David Santiso

Monday 14 March 2011 12:29:33 pm

It seems that the contents of $module_resutl can only be seen from pagelayout.tpl.

Carlos Revillo

Tuesday 15 March 2011 5:35:10 am

"
<font class="Apple-style-span" face="Arial, Helvetica, sans-serif" size="3"><span class="Apple-style-span" style="white-space: normal; " mce_style="white-space: normal;" mce_fixed="1"></span></font>{if $ezhttp_hasvariable( 'button' )}
    {$var}
{/if}

            
"

Hola David :).

please note there's something in that code. ezhttp_hasvariable is not a variable but a function. so you should try

<span class="Apple-style-span" style="font-size: 13px; " mce_fixed="1">{if ezhttp_hasvariable( 'button' )}</span>

    {$var}
{/if}

Anyway, as the other posts say, you should deal with cache issues and probably move to a view_parameters solution.

David Santiso

Tuesday 15 March 2011 12:02:38 pm

The problem is that only works once. I guess that is cached, and shows the same until it is manually deleted.

What can I do?

David Santiso

Sunday 20 March 2011 10:12:18 am

Anybody can help me with this please? I don't get it to work.

It seems that after the first time the information is cached and it doesn't change the result.

Thanks,

David