I post this because I don’t know what’s happen today. I’m working on a snippet to make a scriptaculous slideshow for MaxiGallery beta 2 snippet, and when I tried to display my work : White board, I check the source and I see that the template is truncated like that :
...
<base href="[(site_url)]" />
<link rel="stylesheet" href="css/layout.css" type="text/css" media="screen" />
<link rel="stylesheet" href="[(site_url
The two template which use my snippet are truncated. In this snippet I only use a modx->db->select on the MaxiGallery Table.
I don’t understand how it could be happen. I use 0.9.5 RC2 on OVH host (linux), mysql 5.0.18 and php 4.4.4
Don’t know if it is a bug from modx or a hacker. But it is bizarre that only these two template are truncated.
Has someone hear such a thing ?
Here is the snippet:
<?php
$howmanypic=20; // max how many pics to retrieve
$path_to_galleries=$modx->config['site_url']."assets/galleries/";
$html= '<div id="crossfade-container" style="text-align:center;">';
$scriptTab= "var divs_to_fade = new Array (";
$table = $modx->getFullTableName("maxigallery");
$rs = $modx->db->select("*", $table, "gal_id > '1'", "date DESC", "$howmanypic");
$pics = array();
while ($row = $modx->db->getRow($rs)) {
$img_url=$path_to_galleries .$row['gal_id']."/tn_". $row['filename'];
$cpt+=1;
array_push($pics, $row);
$scriptTab.="'box-{$cpt}',";
$attr=($cpt==1)?'class="fade-box"':'class="fade-box" style="display:none;"';
$html.="\n";
$html.= <<<END
<div class="fade-box" id="box-$cpt" $attr >
<img src ="$img_url" alt="{$row['title']}" />
</div>
END;
}
$scriptTab= preg_replace('/,$/',');',$scriptTab);
$html.="\n</div>";
echo $html;
$script=<<<END
<style>
#crossfade-container { margin: 0; width: 150px; height: 150px; }
.fade-box { margin-left: 0px; position: absolute; top: 163; width: 150px; height: 150px; }
</style>
<script language="javascript">
// code from : http://mikeomatic.net/?p=78
// this array consists of the id attributes of the divs we wish to alternate between
$scriptTab
// the starting index in the above array. It should be set to the value of the div which doesn't have the CSS Display property set to "none"
var i = 0;
// the number of milliseconds between swaps. Default is five seconds.
var wait = 3000; //5000
// the function that performs the fade
function swapFade() {
Effect.Fade(divs_to_fade[i], { duration:1, from:1.0, to:0.0 });
i++;
if (i == $cpt) i = 0;
Effect.Appear(divs_to_fade[i], { duration:1, from:0.0, to:1.0 });
}
// the onload event handler that starts the fading.
function startPage() {
setInterval('swapFade()',wait);
}
</script>
END;
$modx->regClientStartupScript($script);
?>