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

eZ debug

Timing: Jan 29 2025 23:49:33
Script start
Timing: Jan 29 2025 23:49:33
Module start 'content'
Timing: Jan 29 2025 23:49:33
Module end 'content'
Timing: Jan 29 2025 23:49:33
Script end

Main resources:

Total runtime0.1217 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 587.9297180.8438
Module start 'content' 0.00500.0046 768.7734110.5234
Module end 'content' 0.00950.1121 879.2969537.8828
Script end 0.1216  1,417.1797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00302.5045200.0002
Check MTime0.00120.9825200.0001
Mysql Total
Database connection0.00090.702410.0009
Mysqli_queries0.079565.31251410.0006
Looping result0.00090.74681390.0000
Template Total0.111991.910.1119
Template load0.00080.676910.0008
Template processing0.111191.232710.1111
Override
Cache load0.00060.483010.0006
Sytem overhead
Fetch class attribute can translate value0.00070.548610.0007
XML
Image XML parsing0.00030.268710.0003
General
dbfile0.00836.7981200.0004
String conversion0.00000.003530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs