Hi all,
I have this snippet on my localhost
<?php
$sql="SELECT tbreeding . * , sire.callname AS sire_callname, dam.callname AS dam_callname, sire.regname AS sire_regname, dam.regname AS dam_regname
FROM `tblbreeding` tbreeding
LEFT JOIN `tbldogs` sire ON sire.dog_id = tbreeding.sireFK
LEFT JOIN `tbldogs` dam ON dam.dog_id = tbreeding.damFK
LIMIT 0 , 1000";
$rs=$modx->db->query($sql);
$resultArray = $modx->db->makeArray($rs);
var_dump($resultArray);//for debugging
if (count($resultArray)>0){
$output = '';
foreach($resultArray as $item){
$params['Sire_callname']=$item['sire_callname'];
$params['Dam_callname']=$item['dam_callname'];
$params['show']=$item['show'];
$output.=$modx->parseChunk('Litters', $params, '[+', '+]');
}
}
?>
Displaying the following code
array(2) { [0]=> array(16) { ["id"]=> string(1) "1" ["SireFK"]=> string(3) "129" ["DamFK"]=> string(2) "85" ["dom"]=> NULL ["dow"]=> string(10) "2009-08-06" ["rd"]=> string(10) "2009-10-01" ["no_male_puppies"]=> string(1) "7" ["no_female_puppies"]=> string(1) "3" ["breedFK"]=> string(2) "87" ["male_available"]=> string(1) "0" ["female_available"]=> string(1) "0" ["show"]=> string(1) "Y" ["sire_callname"]=> string(4) "Ivan" ["dam_callname"]=> string(5) "Laila" ["sire_regname"]=> string(21) "Guldakra's Ivan Lendl" ["dam_regname"]=> string(30) "Chrys-haefen Floatlikeabutafly" } [1]=> array(16) { ["id"]=> string(1) "2" ["SireFK"]=> string(2) "76" ["DamFK"]=> string(3) "127" ["dom"]=> NULL ["dow"]=> string(10) "2009-08-05" ["rd"]=> string(10) "2009-09-30" ["no_male_puppies"]=> string(1) "4" ["no_female_puppies"]=> string(1) "2" ["breedFK"]=> string(2) "87" ["male_available"]=> string(1) "0" ["female_available"]=> string(1) "0" ["show"]=> string(1) "Y" ["sire_callname"]=> string(6) "Rigger" ["dam_callname"]=> string(6) "Marley" ["sire_regname"]=> string(27) "Chrys-haefen Rigger Folkins" ["dam_regname"]=> string(34) "Chrys-haefen Don’t Rock T’Boat" } }
But when I call my chunk all I get is a blank screen... Nothing displayed. I am calling the snippet with the following code
I have tried calling the chunk with [+Litters+], [[Litters]] and {{Litters}} Nothing seems to work.
The important thing is not to stop questioning. Curiosity has its own reason for existing. One cannot help but be in awe when he contemplates the mysteries of eternity, of life, of the marvelous structure of reality. It is enough if one tries merely to comprehend a little of this mystery every day. Never lose a holy curiosity.
-Albert Einstein (1879 - 1955)
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
-
☆ A M B ☆
- 24,524 Posts
Your snippet needs to return the output:
Thank you Susan...
Boy do I feel stupid.
The important thing is not to stop questioning. Curiosity has its own reason for existing. One cannot help but be in awe when he contemplates the mysteries of eternity, of life, of the marvelous structure of reality. It is enough if one tries merely to comprehend a little of this mystery every day. Never lose a holy curiosity.
-Albert Einstein (1879 - 1955)
Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
-
☆ A M B ☆
- 24,524 Posts
That’s OK, it’s not obvious. Snippet code is passed through the PHP eval() function, so they have to return their output just as functions do. Of course, you can also echo or print output, but sometimes that can have unexpected positioning results.