[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpgroupware-developers] new separator in links
From: |
Dave Hall |
Subject: |
Re: [Phpgroupware-developers] new separator in links |
Date: |
Tue, 11 Apr 2006 18:36:03 +1000 |
Hi Sigurd,
I haven't tested this. Here is my theory, and what I would suggest you
do to fix it :)
On Tue, 2006-04-11 at 09:39 +0200, Sigurd Nes wrote:
> I have a problem (HEAD only) that links called from within JavaScript
> as in example1 - comes up with '&' as separator between variables
>
> Example2 - will produce the correct separator.
>
> The links looks the same to me (both using '&') when looking at
> the source-code in the browser.
>
> Any reason for this ?
>
> Regards
>
> Sigurd
>
> example 1:
> <script language="JavaScript">
use <script type="text/javascript"> as language="... is deprecated in
html4.
> function lookup_loc1()
> {
>
> Window1=window.open('/some_link?sort=&order=&cat_id=','','');
> }
> </script>
>
> <a href="javascript:lookup_loc1()">link1</a>
>
As this link is in the javascript function block not the <a href="...">
it isn't parsed by firefox to convert the & to &
> example2:
>
> <a href="javascript:var
> w=window.open('/some_link?sort=&order=&cat_id=','','')">link2</a>
As this time it is in the href is it converted and so there is no
problem.
This solution involves a couple of steps.
Firstly the javascript: psuedo url is a pretty ugly imho. Although it
is a still ugly and not perfect, this is my quick and dirty, but
acceptable method for doing it these days. <a href="#"
onclick="doSomething();">
Use the api core/base.js file via the api js class
( $GLOBALS['phpgw']->js->validate_file('core', 'base'); ) as it has some
useful functions, most importantly - phpGWLink()
Use phpGWLink which works the same as the php api link function. Use it
like so:
var myLink = phpGWLink('/index.php', { menuaction : app.obj.method, id :
123 } );
// Note the use of an object to create an associative array/hash
This should solve your problems.
Cheers
Dave
--
Dave Hall (aka skwashd)
API Coordinator
phpGroupWare
+-------------------------------------+-------------------------------+
| e address@hidden | w phpgroupware.org |
| j address@hidden | aim skwashd |
| icq 278064022 | msn address@hidden |
| sip address@hidden | y! skwashd |
+-------------------------------------+-------------------------------+