javascript: asigning variable from JS to EZ

Author Message

Jorge estévez

Monday 12 May 2008 12:23:36 pm

Hi!

Assume the following piece of code (I have truncated the original code), what I would like to do is to add to the EZ variable $mynodo the value of the JS variable nodeID.

How can this be done?

take into consideration that If I use something like:

$mynodo={literal}nodeID{/literal}

It will not work, instead it will print out the text "nodeID" within the JS code.

I have read in the forum several forum discussions about asigning an Ez variable to a javascript (using LITERAL), but this is the opposite, a JS variable to an EZ variable....

{literal}
<script language="JavaScript" type="text/javascript">
function MyOnNodeOpen (nodeID, state)
{
	{/literal}
	{def $my_node = array()
         $mynodo=XXXXXX
	}
        {literal}
}
</script>
</literal>

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Łukasz Serwatka

Monday 12 May 2008 11:31:11 pm

Hi,

You can't assign JS variable to template variable. JS is client side technology. It will always run after the template code is executed.

Perhaps you can describe better what you want to do?

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

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 20 2025 17:20:27
Script start
Timing: Jan 20 2025 17:20:27
Module start 'layout'
Timing: Jan 20 2025 17:20:27
Module start 'content'
Timing: Jan 20 2025 17:20:29
Module end 'content'
Timing: Jan 20 2025 17:20:29
Script end

Main resources:

Total runtime1.0586 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0469151.2266
Module start 'layout' 0.00570.0026 739.273436.6797
Module start 'content' 0.00831.0495 775.9531549.6719
Module end 'content' 1.05780.0008 1,325.62507.9688
Script end 1.0586  1,333.5938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2908160.0002
Check MTime0.00130.1202160.0001
Mysql Total
Database connection0.00090.082810.0009
Mysqli_queries1.018096.1687540.0189
Looping result0.00060.0529520.0000
Template Total1.025196.820.5126
Template load0.00200.184620.0010
Template processing1.023196.652420.5116
Template load and register function0.00010.010610.0001
states
state_id_array0.00370.345110.0037
state_identifier_array0.00160.150720.0008
Override
Cache load0.00150.1456170.0001
Sytem overhead
Fetch class attribute can translate value0.00040.041120.0002
Fetch class attribute name0.00100.096230.0003
XML
Image XML parsing0.00080.076120.0004
class_abstraction
Instantiating content class attribute0.00000.000830.0000
General
dbfile0.00090.0816180.0000
String conversion0.00000.000840.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs