Javascript with VAR problem SOLVED

Author Message

Karl Empereur

Monday 21 March 2005 11:41:16 am

Hi,
I wane 'compose' a new URL with different objects witch I retrive from a custom class and I wane open this in a popup.
The popup itself works with a fixed url and also whn I define the URL by VAR (fixed) but it doesn't work when I try to 'compose' the url directly as VAR. The 'composed' the URL also works when I don't use javascript and when I put it between <a href =""><a>.
The URL must be : http://_myothersite_/item1item2item3item4.htm
What's wrong?

{literal}	  
<script language="javascript">
function popupper(url,x,y,name,sb,rs,st,lt,tb) {
.
. (not all the code is showed)
.
	win = window.open(url, name, features);
}

var mylink = '{/literal}http://_myothersite_/{attribute_view_gui attribute=$node.object.data_map.item1}{attribute_view_gui attribute=$node.object.data_map.item2}{attribute_view_gui attribute=$node.object.data_map.item3}{attribute_view_gui attribute=$node.object.data_map.item4}{literal}.htm';
</script>
{/literal}
<a href = "javascript:void(0)"
onclick = "popupper(mylink,600,400,'pop',1,1,1,1,1)">Show Me!</a>

***
The solution:

var mylink = '{/literal}http://_myothersite_/{$node.object.data_map.item1.content|wash()}{$node.object.data_map.item2.content|wash()}{$node.object.data_map.item3.content|wash()} ...  .htm';

Don't use : attribute_view_gui
***

Grtz,
K.

Jonathan Dillon-Hayes

Tuesday 29 March 2005 12:16:51 am

That's a very clever workaround. Thanks for posting it.

J

---------
FireBright provides advanced eZ deployment with root access
http://www.FireBright.com/

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

Main resources:

Total runtime0.9569 sec
Peak memory usage8,192.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 588.1406151.2109
Module start 'layout' 0.00710.0048 739.3516220.7031
Module start 'content' 0.01190.9440 960.05474,433.7500
Module end 'content' 0.95590.0009 5,393.80477.8438
Script end 0.9568  5,401.6484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3878160.0002
Check MTime0.00140.1441160.0001
Mysql Total
Database connection0.00110.117010.0011
Mysqli_queries0.864090.2899540.0160
Looping result0.00050.0550520.0000
Template Total0.898193.920.4490
Template load0.00220.227420.0011
Template processing0.895993.627420.4479
Template load and register function0.00190.201410.0019
states
state_id_array0.00130.131710.0013
state_identifier_array0.00060.066120.0003
Override
Cache load0.00180.1861200.0001
Sytem overhead
Fetch class attribute can translate value0.00210.222620.0011
Fetch class attribute name0.00220.229930.0007
XML
Image XML parsing0.00660.690620.0033
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00740.7699160.0005
String conversion0.00000.001240.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
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs