Call custom javascript function as link in online editor

Author Message

Patrick Kaiser

Friday 28 October 2005 2:54:18 am

hi all,

does anybody know how a custom javascript-function could be called via a link inserted by the online editor? I basically just want to open a link in a new window having special attributes and a given size.

so the link would look like:
<a href="javascript:popup('http://somedomain.com', 300, 300)">popup</a>

in pagelayout i defined the javascript-function 'popup'.

but when i insert the link via the 'insert-link'-dialoge of the online editor (link-type: other) i get the following error message after publishing: 'Tag a has wrong format (removed).'

Any ideas? I search through all the forums, but nobody seems to have wanted calling popups from within ezxmltext-fields..

thanks,

patrick


Best regards,

Patrick

Mazen Alsibai

Sunday 30 October 2005 1:37:48 am

Hi:
you donot have to use javascript to do that,
just write<a href="http://somedomain.com" target="_blank">popup</a>

Patrick Kaiser

Sunday 30 October 2005 2:50:59 am

Thanks for your answer, but that is not what i want to archieve. of course i know that i can open the page in a new window, but my client wants to have a new window without title-, navigation- and scroll-bar opening in a fixed, non resizable size. and this can only be done via javascript.

this is the script:

<script language="JavaScript" type="text/javascript">
	<!--
	function popup(url, popupwidth, popupheight)
	{
		popup = window.open(url, "popup", "dependent=yes,resizable=no,width=" + popupwidth + ",height=" + popupheight + ",scrollbars=no,locationbar=no,menubar=no,status=no,screenX=" + ((screen.availWidth - popupwidth) / 2) + ",screenY=" + ((screen.availHeight - popupheight) / 2) + ",left=" + ((screen.availWidth - popupwidth) / 2) + ",top=" + ((screen.availHeight - popupheight) / 2));
		popup.focus();
	}
	//-->
</script>

i know that this script and the way i'm calling it is working. the problem is that ez is removing the 'javascript:...' after publishing :-(


Best regards,

Patrick

William Steenbergh

Wednesday 07 June 2006 8:07:13 am

try using the {literal} and {/literal} statements around the code for the link. EZ Publish will probably avoid it for parsing.

Marcin Drozd

Wednesday 07 June 2006 11:44:13 am

Hi
I think U should use
<literal class='html'> and </literal>

http://ez-publish.pl

tom stovall

Friday 18 May 2007 11:38:10 am

as of 3.8,

[literal]
AvailableClasses=html

has to be in content.ini.append.php of either siteaccess or override.

Markus Bader

Saturday 19 May 2007 1:10:44 pm

I think it was not mentioned in eZ for the editors that they could use code, because the online editor is for content management and not for template coding.

However - removing this "validation" from the php file in the kernel would be a solution.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.