Php popup

Status
Niet open voor verdere reacties.

infernothebest

Gebruiker
Lid geworden
25 feb 2008
Berichten
76
Ik heb een klein probleem, ik krijg het niet voornelkaar om deze 2 codes met elkaar te combineren, deze bestaande link:
PHP:
	if ( empty($link) ) {
			$image = '<a href="'. the_permaurl() .'"><img src="'. $thumb .'" alt="'. get_the_title($postid) .'" title="'. get_the_title($postid) .'" width="'. $w .'" height="'. $h .'" /></a>';


Met deze code;
PHP:
onclick="window.open(this.href, 'popupwindow', 'width=650, height=500, scrollbars, resizable'); return false;"
 
Dit komt omdat je bij je $image variabel single quotes hebt gebruikt.
Dus elke keer als je ´ typt binnen dat variabel word er net als bij ´ . the_permaurl() . ´ the string tijdelijk afgesloten.
Dit kun je oplossen door voor elke single quote een \ wanneer deze binnen het variabel moet blijven :-)

PHP:
<?php
$image = '<a href="'. the_permaurl() .'" onclick="window.open(this.href, \'popupwindow\', \'width=650, height=500, scrollbars, resizable\'); return false;"
><img src="'. $thumb .'" alt="'. get_the_title($postid) .'" title="'. get_the_title($postid) .'" width="'. $w .'" height="'. $h .'" /></a>';
?>
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan