Hi all!

I try to do a search over a pagination component I found here
at http://www.noswad.me.uk/Pagination/PRG (Andy Dawson's site).

Source: http://cakeforge.org/frs/?group_id=152

I try to use '1 step' search, a very simple form which will submit to
itself, and if form data is present redirects to the appropriate url.

This PRG(Post Redirect Get) search function works all fine but
it doesn't search and fetch data from database
when you input multibyte characters (such as Japanese and Chinese).

Does it got to do with 'urlencode'?
I tried 'urlencode' but all I get is an unreadable query string to an
URL and search input field.

I can't see how to handle this.
Any help would be appreciated!


Here is the code:

/app/plugins/pagination/controllers/p_r_g_controller.php:

class PRGController extends SearchAppController{

var $name = 'PRG';


function in_one($match = null) {
        uses('Sanitize');
        if (isset($this->data['Form']['search'])) {
                if (!$this->data['Form']['search']) {
                        $this->_addFlash('You need to search for something');
                }
                return $this->redirect 
(array(Sanitize::paranoid($this->data['Form']
['search'])));
        }
        if ($match) {
                //$match = Sanitize::paranoid($match);
                $this->_addFlash('Showing results for Titles matching "'.
$match.'"');
                $criteria = array('Title.title'=>"LIKE %$match%");
                list($order,$limit,$page) = $this->Pagination-
>init($criteria,null,array('ajaxAutoDetect'=>false));
                $this->data = $this->{$this->modelClass}->findAll($criteria, 
null,
$order, $limit, $page);
                $this->data['Form']['search'] = $match;
        } else {
                $this->data = null;
        }
        $this->render('in_one');
}
}


/app/plugins/pagination/views/p_r_g/in_one.thtml:

<h1>Paginated Titles Index (<?php echo $this->name.", ".$this->action?
>)</h1>
<?php
        echo $html->formTag();
        echo $form->generateInputDiv("Form/search","Title match:");
        echo $html->submit("Submit");
?>
</form>
<?php
if ($data) {
        echo $this->element('results_table');
        echo $this->element('pagination');
} else {
        echo "<h2>No Results</h2>";
}


--~--~---------~--~----~------------~-------~--~----~
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