Home Private Messages Search
CPG Dragonfly™ CMS stopsoftwarepatents.eu petition banner
Toggle Content
 
Forums ⇒ DragonflyCMS ⇒ Add-Ons & Blocks :: Archives ⇒ Getlink and javascript :: Archived


Getlink and javascript :: Archived
Need help creating a block or add-on, or you have created or modified a block/add-on that works in Dragonfly CMS and it meets the CPG Security Requirements? Do you have feedback about a specific add-on? Here is the place to post. Read the announcements here first!.
Post new topic    Revive this topic    Printer Friendly Page     Forum Index ⇒  Add-Ons & Blocks

Topic Archived View previous topic :: View next topic  
Author Message
fesja
Newbie
Newbie

Offline Offline
Joined: Apr 24, 2004
Posts: 49
Location: Madrid - Spain
PostPosted: Sun Dec 05, 2004 7:09 pm
Post subject: Getlink and javascript

Hi,

I have the following code:

Code::
		echo "<script language=\"Javascript\">
	    	<!--
	    	function delCom(id,nombre) {
	    		var msg = '¿Quieres borrar este comentario (id:' + id + ')?';
	    		if (confirm(msg)){
					var url = 'Ediciones&op=borrarcoment&id='+id+'&carta='+nombre;
	    			parent.document.location.href = ".getlink(url).";
	    		}
	    	}
	    	--></script>";

The href doesn't function. What can i do? I have the LEO on, so writing 'index.php?name.....' doesn't function neither.

Thanks a lot


fesja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu Hoary / 2.0.53 / 4.1.10 / 4.3.10/ 9.0.3
Back to top
View user's profile Visit poster's website
fesja
Newbie
Newbie

Offline Offline
Joined: Apr 24, 2004
Posts: 49
Location: Madrid - Spain
PostPosted: Sun Dec 05, 2004 10:59 pm
Post subject: Re: Getlink and javascript

Another question:

My module is divided in functions, so depending what variable arrives it goes to one function or another.

But I've noticed that in some functions, i have to delete the name of the module from the getlink. For example:

Code::
	Header("Location: ".getlink('carta='.$nombre2));

If I write:

Code::
	Header("Location: ".getlink('Ediciones&carta='.$nombre2));
it goes to .../Ediciones/Ediciones/carta=....html.

It happens the same with the images. I have to write the urls like this:

Code::
<img src=\"../images/cartas/0.gif\" alt=\"0\" title=\"0\">

If not the url of the image would be:

Code::
url -> myserver/Ediciones/images/cartas/0.gif

What can i be doing wrong? Maybe it's the first part when i assigned the variables that comes. The code of the first part is this:

Code::
if(isset($_GET['nombre']) ? $_GET['nombre'] : ''){
	$nombre = isset($_GET['nombre']) ? $_GET['nombre'] : '';		//Caracteristicas Edicion
	edicion($nombre);

}else if(isset($_GET['avance']) ? $_GET['avance'] : ''){
	$nombre = isset($_GET['avance']) ? $_GET['avance'] : '';			//Avance edicion
	avance($nombre);

}else if(isset($_GET['faq']) ? $_GET['faq'] : ''){
	$nombre = isset($_GET['faq']) ? $_GET['faq'] : '';				//FAQ
	faq($nombre);

}else if(isset($_GET['spoiler']) ? $_GET['spoiler'] : ''){
	$spoiler = isset($_GET['spoiler']) ? $_GET['spoiler'] : '';		//Spoiler
	spoiler($spoiler);

}else if(isset($_GET['carta']) ? $_GET['carta'] : ''){
	$carta = isset($_GET['carta']) ? $_GET['carta'] : '';			//Carta
	vercarta($carta);

}else if(isset($_GET['op'])){
	$op = $_GET['op'];												//OP - Varias funciones
	if($op == 'addcomentario' ){									//Añadir comentario
		$idcarta = $_POST['idcarta'];;
		$carta = $_POST['carta'];;
		$autor = $_POST['autor'];;
		$comentario2 = $_POST['comentario2'];;
		$puntuacion = $_POST['puntuacion'];
		addcomentario($idcarta, $carta, $autor, $comentario2, $puntuacion);
		
	}else if($op == 'borrarcoment' ){								//Borrar comentario
		$carta = $_GET['carta'];
		$id = $_GET['id'];
		borrarcoment($carta, $id);
	
	}else if($op ==  'cl' ){										//Checklist
		$id = $_GET['id'];
		cl($id);
	
	}else if($op == 'editc' ){										//Editar
		$cid = isset($_GET['cid']) ? $_GET['cid'] : '';	
		editc($cid);
	
	}else if($op == 'save' ){										//Guardar edicion
		$numero = $_POST['numero'];
		$nombre = $_POST['nombre'];
		$nme = 	$_POST['nme'];
		$ver = $_POST['ver'];
		$coste = $_POST['coste'];
		$mana = $_POST['mana'];
		$color = $_POST['color'];
		$tipo = $_POST['tipo'];
		$subtipo = $_POST['subtipo'];
		$frec = $_POST['frec'];
		$texto = $_POST['texto'];
		$lit = $_POST['lit'];
		$reglas = $_POST['reglas'];
		$ilus = $_POST['ilus'];
		$fr = $_POST['fr'];
		$ciclo = $_POST['ciclo'];
		$l_est = $_POST['l_est'];
		$l_ext = $_POST['l_ext'];
		$l_vint = $_POST['l_vint'];
		$l_leg = $_POST['l_leg'];
		$l_blo = $_POST['l_blo'];
		$cid = $_POST['cid'];
			
		save($numero, $nombre, $nme, $ver, $coste, $mana, $color, $tipo, $subtipo, $frec, $texto, 
			$lit, $reglas, $ilus, $fr, $ciclo, $l_est, $l_ext, $l_vint, $l_leg, $l_blo, $cid);
			
	}else if($op == 'save_comentario' ){							//Guardar comentario
		$idcarta = $_POST['idcarta'];;
		$carta = $_POST['carta'];;
		$id = $_POST['id'];;
		$comentario = $_POST['comentario'];;
		$puntuacion = $_POST['puntuacion'];
		save_comentario($idcarta, $carta, $id, $comentario, $puntuacion);	
	
	}else if($op ==  'sp' ){										//Spoiler en texto
		$id = $_GET['id'];
		sp($id);
	
	}else if($op == 'vercartaid'){									//verCarta por ID
		$cid = $_GET['cid'];
		verCartaId($cid);
	
	}else if($op == 'vercartan'){									//verCarta por Nombre
		if(isset($_GET['nombre']) ? $_GET['nombre'] : ''){
			$nombre = isset($_GET['nombre']) ? $_GET['nombre'] : '';//Carta
		}else{
			$nombre = $_POST['nombre'];
		}
		if(isset($_GET['ed']) ? $_GET['ed'] : ''){
			$ed = isset($_GET['ed']) ? $_GET['ed'] : '';//Carta
		}
		verCartaN($nombre, $ed);
		
	}else if($op == 'codigos'){										//Codigos para edicion
		codigos();
	}
		
}else{
	ediciones();													//Lista de ediciones
}

i changed this today for the dragonfly, so maybe i'm wrong on many things

Thanks a lot.


fesja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu Hoary / 2.0.53 / 4.1.10 / 4.3.10/ 9.0.3
Back to top
View user's profile Visit poster's website
Phoenix
• Many Posts •
• Many Posts •

Offline Offline
Joined: Apr 19, 2004
Posts: 8799
Location: Netizen
PostPosted: Mon Dec 06, 2004 4:15 am
Post subject: Re: Getlink and javascript

Don't use header location, use,
url_redirect(getlink('whatever'));

_________________
DonationsPro for DragonflyCMS, SMF, MyBB, vBulletin

Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website Photo Gallery
Śyama_Dāsa
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 2048
Location: Dragonfly CMS Tribe
PostPosted: Mon Dec 06, 2004 6:35 am
Post subject: Re: Getlink and javascript

not sure if this helps but i have had issues with javascript and ¿

when using getlink and js you also should also use the "full" url switch
Code::
getlink($url="", $UseLEO=true, $full=false)

Code::
getlink("Link", 1, 1)

_________________
AKA Akamu / Read these and your life will be successful | Find a Repair
--
Mods and Professional Support via YIM

Śyama_Dāsa's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
win32 / Apache 1.3.33 / MySQL 4.1.16/PHP 4.4/CPG-CVS ( browsers: Mozilla 1.7.x / IE6 / Opera 8.0)
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
fesja
Newbie
Newbie

Offline Offline
Joined: Apr 24, 2004
Posts: 49
Location: Madrid - Spain
PostPosted: Mon Dec 06, 2004 10:49 am
Post subject: Re: Getlink and javascript

Thanks phoenix. I've already change all my headers.

Thanks akamu, but I already have the same problem. How do I write this:

Code::
				echo "<script language=\"javascript\">
					function cambioversion( ver ) {
                        window.location.href = '".getlink('Ediciones&carta='.$nombre.'&ed=+ver',1,1).";
                }</script>";

Where and how do i have to write the variable ver, with '', or "" or without anything. I've tried many things and didnt function.

And if i write in the getlink function $full=1 what happens. What is the difference between $full=0 and $full=1 ??

Thanks


fesja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu Hoary / 2.0.53 / 4.1.10 / 4.3.10/ 9.0.3
Back to top
View user's profile Visit poster's website
Phoenix
• Many Posts •
• Many Posts •

Offline Offline
Joined: Apr 19, 2004
Posts: 8799
Location: Netizen
PostPosted: Mon Dec 06, 2004 12:17 pm
Post subject: Re: Getlink and javascript

includes/functions/linking.php,
function getlink($url='', $UseLEO=true, $full=false)
if ($full) $url = $BASEHREF.$url;

Personally, I have also had troubles with js, and find it easier to just use the normal url link.


Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website Photo Gallery
fesja
Newbie
Newbie

Offline Offline
Joined: Apr 24, 2004
Posts: 49
Location: Madrid - Spain
PostPosted: Mon Dec 06, 2004 1:11 pm
Post subject: Re: Getlink and javascript

So you recommend me not to do any js link. Ok.

Thanks a lot


fesja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu Hoary / 2.0.53 / 4.1.10 / 4.3.10/ 9.0.3
Back to top
View user's profile Visit poster's website
Phoenix
• Many Posts •
• Many Posts •

Offline Offline
Joined: Apr 19, 2004
Posts: 8799
Location: Netizen
PostPosted: Mon Dec 06, 2004 1:14 pm
Post subject: Re: Getlink and javascript

Well, if you can't get getlink to work with those parameters, you don't have much choice.


Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website Photo Gallery
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Mon Dec 06, 2004 2:15 pm
Post subject: Re: Getlink and javascript

IF your JS has trouble you can prevent getlink from using LEO: getlink('url', false, true)


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
fesja
Newbie
Newbie

Offline Offline
Joined: Apr 24, 2004
Posts: 49
Location: Madrid - Spain
PostPosted: Mon Dec 06, 2004 3:55 pm
Post subject: Re: Getlink and javascript

The problem is not with LEO, it is with getlink becuse i dont know how to add javascript variables to the getlink. If there is not solution i've no choice as phoenix said


fesja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu Hoary / 2.0.53 / 4.1.10 / 4.3.10/ 9.0.3
Back to top
View user's profile Visit poster's website
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Mon Dec 06, 2004 4:28 pm
Post subject: Re: Getlink and javascript

You can but it needs you to properly use javascript.

let the PHP output javascript like this:

PHP:
echo "var url = '".getlink("Ediciones&op=borrarcoment&id='+id+'&carta='+nombre+'")."';";

This should return something like:
Code::
var url = 'Ediciones/op=borrarcoment/id='+id+'/carta='+nombre+'.html';
or
Code::
var url = 'index.php?name=Ediciones&op=borrarcoment&id='+id+'&carta='+nombre+'';
depending if LEO is active or not


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
fesja
Newbie
Newbie

Offline Offline
Joined: Apr 24, 2004
Posts: 49
Location: Madrid - Spain
PostPosted: Mon Dec 06, 2004 5:42 pm
Post subject: Re: Getlink and javascript

It happens a strange thing. I have the following code:

PHP:

As I have now it works perfect, but if i DONT write $BASEHREF before getlink, when i change the select option it goes to the following page the first time i change:

Code::
myserver/Ediciones/op=verCartaId/Ediciones/op=verCartaId/cid=10177.html

in this new page i change again, and it goes to:

Code::
myserver/Ediciones/op=verCartaId/Ediciones/op=verCartaId/Ediciones/op=verCartaId/cid=10182.html

and i change again:

Code::
myserver/Ediciones/op=verCartaId/Ediciones/op=verCartaId/Ediciones/op=verCartaId/Ediciones/op=verCartaId/cid=10269.html

and the i change the last time and i geta 500 internal error.

I've the problem solved but maybe i did something wrong before or the getlink has a bug.

thanks a lot.

Javier


fesja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu Hoary / 2.0.53 / 4.1.10 / 4.3.10/ 9.0.3
Back to top
View user's profile Visit poster's website
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Mon Dec 06, 2004 6:38 pm
Post subject: Re: Getlink and javascript

as mentioned the 3rd parameter must be set to TRUE

getlink('url', true, true);

my code was an example this means you could have figured out the 2 other options in getlink() as mentioned by akamu here

And you also see that javascript can't handle <base href> as mentioned in the forums here


DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
fesja
Newbie
Newbie

Offline Offline
Joined: Apr 24, 2004
Posts: 49
Location: Madrid - Spain
PostPosted: Mon Dec 06, 2004 8:04 pm
Post subject: Re: Getlink and javascript

ahh, i must learn to read english better, xdd. Thanks a lot, cpgnuke dragonfly is most than perfect. Very Happy Very Happy


fesja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu Hoary / 2.0.53 / 4.1.10 / 4.3.10/ 9.0.3
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic    Revive this topic    Printer Friendly Page    Forum Index ⇒  Add-Ons & Blocks
Page 1 of 1
All times are GMT

Archive Revive
Username:
This is an archived topic - your reply will not be appended here.
Instead, a new topic will be generated in the active forum.
The new topic will provide a reference link to this archived topic.
 
   Toggle Content User Info

Welcome Anonymous

Nickname
Password
(Register)

   Toggle Content Last CVS commits
· Further security class improvements.
· 301 redirects on LEO changes
· Option to force 3xx http status codes
· Validate googlebot.com and google.com crawlers.
· CCBot
· Rss with etag and atom.
· Removed index.php depency.
· v9 fixed menu hoverings on touch screens.
· Fixed menu hoverings on touch screens.
· Fixed empty $Module object

Детальніше...

   Toggle Content Community

Support for DragonflyCMS in a other languages:

Deutsch
Español

   Toggle Content X-links
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
Interactive software released under GNU GPL, Code Credits, Privacy Policy