I have this code which output the result of a search
<?php
$object_strings = array(
'articles' => 'articoli',
'pills' => 'pillole',
'previews' => 'anticipazioni',
'blogs' => 'post',
'videos' => 'video'
);
$object_models = array(
'articles' => 'Article',
'pills' => 'Pill',
'previews' => 'Preview',
'blogs' => 'Blog',
'videos' => 'Video'
);
?>
<?php
$empty = true;
foreach($results as $key => $values){
if(count($values) > 1) $empty = false;
}
if($empty) echo "Non si sono risultati per la ricerca"; //TODO:
mettere in una casella error-box
?>
<div class="articles_wrap">
<?php
if(!isset($error)){
foreach($results as $key => $values){
//controlla se ci sono risultati per questa classe
if(count($values) != 1){
//output del titolo
foreach($object_strings as $object => $string){
if($key == $object){
?>
<div class="articles_title">
<?= ucfirst($string);?>
</div>
<?php
break;
}
}
//trova il model
$modello = '';
foreach($object_models as $controller =>
$model){
if($controller == $key){
$modello = $model;
break;
}
}
//output dei dati
foreach($values as $i => $data){
if($i != 'total'){ //evita di stampare
il totale
?>
<div
class="articles_title-list">
<a href="<?=
HTTP_FULL_BASE_URL; ?>/<?= $key; ?>/view/<?=
$data[$modello]['id']; ?>"><?= $data[$modello]['title']; ?></a>
</div>
<?php
}
}
//ultimo box - paginazione o rimando a
risultati completi
if(count($results) == 1){ //risultati completi
per una singola
classe
$goBack = $page - 1 <= 0 ? null : $page
-1;
$goForward = $results[$key]['total'] /
$limit > $page? $page +
1 : null;
$urlBack =
"/finder/search/$key/$limit/$goBack";
$urlForward =
"/finder/search/$key/$limit/$goforward";
//TODO:
//totale $string $results[$key][$total];
// paginazione
?>
<?php
}else{
//totale $string $results[$key][$total];
//form per vedere tutti i risultati
$url = "/finder/search/$key/20/1"; //da
globale a singola
?>
<div>
<form action="<?=
HTTP_FULL_BASE_URL.'/finder/serach/0/0/0/'; ?>"
method="post"><input type="hidden" name="test" value="test" /></form>
<a href="Javascript:
document.getElementById('search-form-<?=
$key; ?>').submit();">Vedi tutti i risultati</a>
</div>
<?php
}
}
}
}
else{
?>
<div class="error_box">
<?= $error; ?>
</div>
<?php } ?>
</div>
<form>
<input type="text" value="test2" />
</form>
The problem I've found is that the form inside this markup is not part
of the end markup. Cakephp (I think) deleted it. I've tried to write
that form in a thousand ways. But it's always deleted from markup.
I'm almost sure that is a bug with Cakephp because the input tag
inside the form tag is not deleted. Cake deletes just the surrounding
form.
<div>
<form action="<?= HTTP_FULL_BASE_URL.'/finder/serach/0/0/0/'; ?>"
method="post"><input type="hidden" name="test" value="test" /></form>
<a href="Javascript: document.getElementById('search-form-<?= $key; ?
>').submit();">Vedi tutti i risultati</a>
</div>
The other test form is there without any problemi.
<form>
<input type="text" value="test2" />
</form>
Can someone explain me what's wrong?
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---