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

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

eZ debug

Timing: Jan 18 2025 04:55:51
Script start
Timing: Jan 18 2025 04:55:51
Module start 'layout'
Timing: Jan 18 2025 04:55:51
Module start 'content'
Timing: Jan 18 2025 04:55:52
Module end 'content'
Timing: Jan 18 2025 04:55:52
Script end

Main resources:

Total runtime0.9689 sec
Peak memory usage4,096.0000 KB
Database Queries99

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.0313152.6250
Module start 'layout' 0.00550.0035 741.656339.4531
Module start 'content' 0.00900.9585 781.1094823.3203
Module end 'content' 0.96750.0013 1,604.429724.1641
Script end 0.9688  1,628.5938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.3736160.0002
Check MTime0.00140.1434160.0001
Mysql Total
Database connection0.00080.079910.0008
Mysqli_queries0.869689.7585990.0088
Looping result0.00100.1064970.0000
Template Total0.936996.720.4685
Template load0.00210.218220.0011
Template processing0.934896.486620.4674
Template load and register function0.00020.023910.0002
states
state_id_array0.00120.123610.0012
state_identifier_array0.00150.159020.0008
Override
Cache load0.00220.2251890.0000
Sytem overhead
Fetch class attribute can translate value0.00100.102960.0002
Fetch class attribute name0.00110.1133170.0001
XML
Image XML parsing0.00170.175360.0003
class_abstraction
Instantiating content class attribute0.00000.0025170.0000
General
dbfile0.00090.0974290.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
14content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
25content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
8content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
2content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 57
 Number of unique templates used: 9

Time used to render debug report: 0.0001 secs