PHP script $str virker ikke med
Hej folkens,Nørkler med et galleri PHP-script der bruger XML. Jeg har indsat nogle $str linier for en række tegn. æøåÆØÅ vises som deres kode ogikke som æøåÆØÅ. Se herunder.
<?php
// $parent is the parent of the children we want to see
// $level is increased when we go deeper into the tree, used to display a nice indented tree
function display_children($parent, $level,$dbTable) {
// retrieve all children of $parent
$imgQry = 'SELECT * FROM '.$dbTable.' WHERE PARENT_ID='.$parent;
//echo($imgQry);
$result = mysql_query($imgQry);
$xmlCode = "";
// display each child
while ($row = mysql_fetch_array($result)) {
// indent and display the title of this child
if ($row[3]==""){
$xmlCode .= str_repeat(' ',$level)."<group id='".$row[0]."' title='".xmlReady($row[2])."'>".display_children($row[0], $level+1,$dbTable)."</group>\n";
}else{
$xmlCode .= str_repeat(' ',$level)."<image id='".$row[0]."' title='".xmlReady($row[2])."' src='".$row[3]."' width='".$row[4]."' height='".$row[5]."' comments='".xmlReady($row[6])."' />\n";
}
}
return $xmlCode;
}
function xmlReady($str){
$str = str_replace("&", "&",$str);
$str = str_replace("<", "<",$str);
$str = str_replace(">", ">",$str);
$str = str_replace("'", "'",$str);
$str = str_replace("\"", """,$str);
$str = str_replace("æ", "æ",$str);
$str = str_replace("Æ", "Æ",$str);
$str = str_replace("ø", "ø",$str);
$str = str_replace("Ø", "Ø",$str);
$str = str_replace("å", "å",$str);
$str = str_replace("Å", "Å",$str);
return $str;}
////////////////////////////////////////////////////////////// DATABASE CONNECTION
include_once("config.php");
////////////////////////////////////////////////////////////// DISPLAY XML
header("Content-type: application/xml");
echo("<?xml version='1.0'?>\n");
echo("<catalog>\n");
echo(display_children(0,0,$dbTable));
echo("</catalog>");
?>
Yderligere er charset sat rigtig. Se herunder
<?php
////////////////////////////////////////////////////////////// DATABASE CONNECTION
include_once("config.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=da-iso-8859-1" />
<title><?=$siteName?></title>
<script language="JavaScript" type="text/javascript">
<!--
function closeMe(){window.close();}
//-->
</script>
<style type="text/css">
<!--
BODY {
SCROLLBAR-FACE-COLOR: #000000;
SCROLLBAR-HIGHLIGHT-COLOR: #000000;
SCROLLBAR-SHADOW-COLOR: #000000;
SCROLLBAR-3DLIGHT-COLOR: #000000;
SCROLLBAR-ARROW-COLOR: #000000;
SCROLLBAR-TRACK-COLOR: #000000;
SCROLLBAR-DARKSHADOW-COLOR: #000000;
overflow: auto
}
-->
</style>
<?php
$flashVars = "siteName=".$siteName."&mainColor=".substr($mainColor,1)."&showPicDetailInfo=".$showPicDetailInfo."&emailAddress=".$emailAddress."&emailSubject=".$emailSubject."&siteInfo=".$siteInfo;
?>
</head>
<body bgcolor="#00746B" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="100%" height="100%" id="main" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="flashvars" value="<?=$flashVars?>" />
<param name="movie" value="swf/main.swf?che=1_2" />
<param name="loop" value="false" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="bgcolor" value="<?=$mainColor?>" />
<embed src="swf/main.swf?che=0" loop="false" menu="false" FlashVars="<?=$flashVars?>" quality="high" scale="noscale" bgcolor="<?=$mainColor?>" width="100%" height="100%" name="main" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" swLiveConnect="true" />
</object>
</body>
</html>
Hvorfor hulen vil det ikke virke. Se på http://ww.planeswalker.dk/galleri
Mvh.
goAMinD