I need to switch with a click an image.  Clicking on the thunmbnails
should change the image in
the div 'model_page_image'. This does not work and I get an error in
the div from browser:

"Not Acceptable
Client browser does not accept the MIME type of the requested page."

Where is the trick?

My controller:
-----------------------------------------
function view($id = null, $image_id = null)
    {
        if ($id != null)
        {
                $this->Model->id = $id;
                $this->set('model',$this->Model->read());
                $this->set('image_id',$image_id);
        }
        else
        {
                echo "Errore! Id maldefinito...";
        }

        $this->render('view', 'ajax');
    }

Part of My view :
----------------------------------------------------
// Get the first image
        $img_list = explode(";", $model['Model']['image_list']);

        //print_r($img_list);

        $is_maschio = false;
        if ($model['Model']['sesso'] == 'Maschio')
                $is_maschio = true;


        if ($image_id == null || empty($image_id))
        {
                if (!empty($img_list[1]))
                {
                        $model_image = $html->link( $html->image('../img_models/
thumbnails/'.$img_list[1], array('border' => '0', 'style' => 'border:
1px solid #000000; margin: 5px 5px 5px 0px;', 'align' => 'right')), '/
models/viewone/'.$model['Model']['id'], $htmlAttributes=null,
$confirmMessage=false, $escapeTitle=false);
                }
                else
                {
                        $model_image = $html->image('no_image.jpg', 
array('border' => '0',
'style' => 'border:1px solid #000000;margin: 5px 5px 5px 0px;',
'align' => 'right'));
                }
        }
        else
        {
                if (!empty($img_list[$image_id]))
                {
                        $model_image = $html->link( $html->image('../img_models/
thumbnails/'.$img_list[$image_id], array('border' => '0', 'style' =>
'border:1px solid #000000; margin: 5px 5px 5px 0px;', 'align' =>
'right')), '/models/viewone/'.$model['Model']['id'],
$htmlAttributes=null, $confirmMessage=false, $escapeTitle=false);
                }
                else
                {
                        $model_image = $html->image('no_image.jpg', 
array('border' => '0',
'style' => 'border:1px solid #000000;margin: 5px 5px 5px 0px;',
'align' => 'left'));
                }
        }
/*
        $model_image = $html->image( $model_image_url, array('border' => '0',
'style' => 'border:1px solid #000000; margin: 5px 5px 5px 0px;',
'align' => 'right'));*/


        echo "<table id='model_page_table' width=\"100%\" cellpadding=\"0\"
cellspacing=\"0\"><tbody><tr>";
        echo "<td id='model_page_desc'>\n";
        echo "<br><font id='model_page_title'>".$model['Model']['nome']."</
font><br>";

        if ($is_admin)
                echo "<div style='float:right; border: 1px solid #000000; 
margin:
5px; padding: 5px;'>".$this->renderElement('adminloc', array('model'
=> $model))."</div>";


        echo "<table width='100px;' cellpadding=\"0\" cellspacing=
\"0\"><tbody>";
        echo "<tr><td style='text-transform: uppercase;'>Altezza:</td><td>".
$model['Model']['altezza']."</td></tr>";
        echo "<tr><td style='text-transform: uppercase;'>Taglia :</td><td>".
$model['Model']['taglia']."</td></tr>";
        echo "<tr><td style='text-transform: uppercase;'>Spalle :</td><td>".
$model['Model']['spalle']."</td></tr>";
        if ($is_maschio)
                echo "<tr><td style='text-transform: uppercase;'>Torace 
:</td><td>".
$model['Model']['petto']."</td></tr>";
        else
                echo "<tr><td style='text-transform: uppercase;'>Seno 
:</td><td>".
$model['Model']['petto']."</td></tr>";
        echo "<tr><td style='text-transform: uppercase;'>Girovita :</td><td>".
$model['Model']['girovita']."</td></tr>";
        echo "<tr><td style='text-transform: uppercase;'>Fianchi :</td><td>".
$model['Model']['fianchi']."</td></tr>";
        if ($is_maschio)
        {
                echo "<tr><td style='text-transform: uppercase;'>Girocollo :</
td><td>".$model['Model']['girocollo']."</td></tr>";
                echo "<tr><td style='text-transform: uppercase;'>Gamba 
:</td><td>".
$model['Model']['gamba']."</td></tr>";
        }
        echo "<tr><td style='text-transform: uppercase;'>Scarpe :</td><td>".
$model['Model']['scarpe']."</td></tr>";
        echo "<tr><td style='text-transform: uppercase;'>Occhi :</td><td>".
$model['Model']['occhi']."</td></tr>";
        echo "<tr><td style='text-transform: uppercase;'>Capelli :</td><td>".
$model['Model']['capelli']."</td></tr>";
        echo "<tr><td style='text-transform: uppercase;'>Note :</td><td>".
$model['Model']['note']."</td></tr>";

        echo "</tr></tbody></table>";


        echo "</td>";
        echo "<td>\n";
        echo $ajax->div('model_page_image');
        echo $model_image;
        echo $ajax->divEnd('model_page_image');
        echo "</td>";
        echo "</tr></tbody></table>";



        echo "<div 'model_page_image_box'>";
        for ($i = 1; $i < sizeof($img_list); $i++)
        {
                echo $ajax->link($html->image('../img_models/thumbnails/'.
$img_list[$i], array('border' => '0', 'style' => 'border:1px solid
#000000; margin: 0px;', 'align' => 'left')),
                 '/models/view/'.$model['Model']['id'].'/'.$i,
                 array('update' => 'model_page_image',
                       'loading' => 'Effect.Appear(\'model_page_image
\')'),
                 null,
                 FALSE
                );
        }
        echo "</div>";



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to