Thursday 18 August 2011 3:33:29 pm - 2 replies

Introduction

In this post I will show an easy way to make eZ publish communicate with javascript.

» Read full blog post

Author Message

Damien Pobel

Saturday 20 August 2011 1:59:43 pm

Hi Tiago,

I've just opened a pull request that adds a built in function to do that, if it's accepted, you're code could be transformed in :

<input type="checkbox" id="var_test"
       name="var_test"{if eq( ezpreference('var_test'), 'true' )} checked="checked"{/if}> Test

<script type="text/javascript">
{literal}
$("#var_test").change(function() {
    $.ez.setPreference('var_test', $("#var_test").is(":checked"));
});
{/literal}
</script>

PS: setting cache_ttl to 0 should not be necessary, if you have cache issues regarding preferences, you should look at the CachedViewPreferences settings.

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Thiago Campos Viana

Sunday 21 August 2011 5:25:27 pm

"

Hi Tiago,

I've just opened a pull request that adds a built in function to do that, if it's accepted, you're code could be transformed in :

<input type="checkbox" id="var_test"
       name="var_test"{if eq( ezpreference('var_test'), 'true' )} checked="checked"{/if}> Test

<script type="text/javascript">
{literal}
$("#var_test").change(function() {
    $.ez.setPreference('var_test', $("#var_test").is(":checked"));
});
{/literal}
</script>

PS: setting cache_ttl to 0 should not be necessary, if you have cache issues regarding preferences, you should look at the CachedViewPreferences settings.

Cheers

"

wow! Nice, thank you!

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br

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

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 00:02:22
Script start
Timing: Jan 18 2025 00:02:22
Module start 'layout'
Timing: Jan 18 2025 00:02:22
Module start 'content'
Timing: Jan 18 2025 00:02:22
Module end 'content'
Timing: Jan 18 2025 00:02:23
Script end

Main resources:

Total runtime0.1285 sec
Peak memory usage4,096.0000 KB
Database Queries68

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 589.3203152.6563
Module start 'layout' 0.00620.0026 741.976639.5000
Module start 'content' 0.00880.1184 781.4766666.5703
Module end 'content' 0.12720.0013 1,448.046918.3984
Script end 0.1285  1,466.4453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00403.1352160.0003
Check MTime0.00141.0527160.0001
Mysql Total
Database connection0.00100.756410.0010
Mysqli_queries0.063649.4828680.0009
Looping result0.00070.5098660.0000
Template Total0.097675.920.0488
Template load0.00262.038020.0013
Template processing0.094973.865020.0475
Template load and register function0.00010.079410.0001
states
state_id_array0.00161.219520.0008
state_identifier_array0.00191.460630.0006
Override
Cache load0.00231.8202240.0001
Sytem overhead
Fetch class attribute name0.00120.933750.0002
Fetch class attribute can translate value0.00060.474820.0003
class_abstraction
Instantiating content class attribute0.00000.006950.0000
XML
Image XML parsing0.00100.803920.0005
General
dbfile0.00090.7117220.0000
String conversion0.00000.006140.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.tplforum_topic/full.tplextension/community_design/design/suncana/override/templates/forum_topic/full.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs