Forums / Developer / Javascript with VAR problem SOLVED

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

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/