[eluser]Robb__[/eluser]
Ok, this is the whole flow.
in header.php
Code:
function get_clicklist(){
var myAjax4 = new Ajax.Request('myweb/www/index.php/application/getclicklist/' + sessionid ,{onComplete:show_get_clicklist_response}); //sessionid is a global variable.
}
controller application.php
Code:
function getclicklist($sessionid)
{
$this->load->model('Load');
$result['photolist'] = $this->Load->getclicklist($sessionid);
$noRows = $result['photolist']->num_rows();
$result['NrRows'] = $noRows;
$products['productlist'] = array();
for($i=0; $i<$result['NrRows']; $i++){
$resultrow[$i] = $result['photolist']->row($i);
$products['productlist'][$i] = $resultrow[$i]->Image;
//echo $products['productlist'][$i];
}
$this->load->view('result', $products)
}
in the model load.php
Code:
function getclicklist ($sessionid)
{
$this->load->database();
$sql = "SELECT J.Image FROM Jewellery J INNER JOIN Choice C ON J.ProductID = C.ProductID WHERE C.Nickname LIKE '" .$sessionid ."'";
$query = $this->db->query($sql);
return $query;
}
The show_get_clicklist_response should be created by the $this->load->view('result', $products) call in controller application.php, function getclicklist.
result.php now looks like
Code:
function show_get_clicklist_response(response) {
eval(response.responseText)
YAHOO.example.container.photobox = new YAHOO.widget.PhotoBox("photobox",
{
effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.45},
fixedcenter:true,
constraintoviewport:true,
underlay:"none",
close:true,
visible:false,
draggable:true,
modal:true,
photos:[
<?php foreach ($productlist as $i => $photo ): ?>
{src:"<?= $photo; ?>",caption:"test"},
<?php endforeach; ?>
{src:"http://static.flickr.com/8/12669712_be928a0d97.jpg",caption:"Dobb's Ferry, NY"}
],
width:"500px"
} );
YAHOO.example.container.photobox.render();
YAHOO.util.Event.addListener("show", "click", YAHOO.example.container.photobox.show, YAHOO.example.container.photobox, true);
}
So, hopefully I will have a response function to handle my call to the database, that delivers the clicklist images. The response function created from my call initiates the YUI-stuff needed to create my photobox.
I'm a bit confused now and have to lay down for a while :gulp: