Hi guys,
I have a dog kennel that I am currently working on. My question is I have a page showing the current litters, the client would like to have a link at the bottom of the current litter showing pictures of the puppies. Similar to http:\\www.chrys-haefen.com\litters.php?breed=goldens but it would be in modx...
I have a snippet which gets the sire and dam from the database as follows
<?php
if(isset($dogid)) {
switch ($dogid)
case 1000:
output = 'Marleys pups';
break;
}else{
$sql="SELECT sireim.filelocation AS sireim_filelocation,
sireim.description AS sireim_desc,
sireim.width AS sireim_width,
sireim.height AS sireim_height,
damim.filelocation AS damim_filelocation,
damim.description AS damim_desc,
damim.width AS damim_width,
damim.height AS damim_height,
tbreeding.dow,
tbreeding.rd,
tbreeding.no_male_puppies,
tbreeding.no_female_puppies,
tbreeding.male_available,
tbreeding.female_available,
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
LEFT JOIN `tblimages` sireim ON sireim.dogFK = sire.dog_id AND sireim.use_pict = 'Y'
LEFT JOIN `tblimages` damim ON damim.dogFK = dam.dog_id AND damim.use_pict = 'Y'
WHERE breedFK = '87'
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){
//print_r($item);//for debugging
$params['Sire_callname']=$item['sire_callname'];
$params['imsire_file location']=$item['sireim_filelocation'];
$params['salt text']=$item['sireim_desc'];
$params['swidth']=$item['sireim_width'];
$params['shieght']=$item['sireim_height'];
$params['Dam_callname']=$item['dam_callname'];
$params['imdam_filelocation']=$item['damim_filelocation'];
$params['dalt text']=$item['damim_desc'];
$params['dwidth']=$item['damim_width'];
$params['dhiehgt']=$item['damim_height'];
$params['Sire_regname']=$item['sire_regname'];
$params['Dam_regname']=$item['dam_regname'];
$params['Whelping date']=$item['dow'];
$params['Release date']=$item['rd'];
$params['Num male']=$item['no_male_puppies'];
$params['Num female']=$item['no_female_puppies'];
$params['Available males']=$item['male_available'];
$params['Available females']=$item['female_available'];
$output.=$modx->parseChunk('Golden Litters', $params, '[+', '+]');
}
}
}
return $output;
which would call the chunk Marleys pups
in that chunk I would have the img tags.
on my calling page I have
Pictures are <a href="[~[*id*]~]&dogid=1000">here</a>
How would you do this... it seems to me that this is the only way I can do it.... but I know that is always another way.