[Solved] Search and navigation with Chronoconnectivity

vales 06 Dec, 2009
I made some changes to the scripts for the search with Chronoconnectivity that had been presented in this post:

How to add a Search to a Connectivity form!

Now works navigation between pages. This is the code. I have used for example the table jos_contents

SQL WHERE section
<?php
 $session =& JFactory::getSession('ricerca');
 $search_array = array('title','introtext','fulltext');
 $cerca = array();
 foreach ( $search_array as $search ) {
 $value = JRequest::getVar($search, '' , 'post');
 if ( $value ) {
 $cerca[] = " `$search` LIKE '%$value%' ";
 }
 }
 
 if (empty($cerca) and (JRequest::getVar('submit','no','POST')=="Trova")) {
 $session->set('cerca','0','ricerca');
 JRequest::setVar('limitstart',0,'Get');
 }

 if ( !empty($cerca) ){
 echo " WHERE ".implode(' AND ', $cerca);
 $session->set('cerca',$cerca,'ricerca');          
 }

 elseif ((JRequest::getVar('submit','no','POST')<>"Trova") and  ($session->get('cerca',0,'ricerca')<>0)) {
 $cerca=$session->get('cerca',0,'ricerca');
 echo " WHERE ".implode(' AND ', $cerca);
 }
 else
 {
 echo "";
 }
?>


Section Header
<div style="float:left; width: 100%; ">
<p>    Cerca in <b>Titolo</b>: <input type="text" name="title" />
<b>Introduzione</b>: <input type="text" name="introtext" />
<b>Testo esteso</b>: <input type="text" name="fulltext" /></p)
<p style="text-align:center;"><input type="submit" value="Trova" name="submit" style='width:80px; color:#cccccc; background-color:#135cae; cursor:pointer;' /><input type="reset" name="reset" value="Reset" style='width:80px; color:#cccccc; background-color:#135cae; cursor:pointer;' /></p>
<p style="text-align:center;"><b>For reset the  search run with empty fields</b></p>
</div>


The solution was the use of sessions Joomla

An demo of search is here
This topic is locked and no more replies can be posted.