Monthly Archives: February 2013


Natural Language Full-Text Searches

MySQL has support for full-text indexing and searching:

  • A full-text index in MySQL is an index of type FULLTEXT.

  • Full-text indexes can be used only with MyISAM tables, and can be created only for CHARVARCHAR, or TEXTcolumns.

  • FULLTEXT index definition can be given in the CREATE TABLE statement when a table is created, or added later using ALTER TABLE or CREATE INDEX.

  • For large data sets, it is much faster to load your data into a table that has no FULLTEXT index and then create the index after that, than to load data into a table that has an existing FULLTEXT index.

Leave a comment

Posted by on Feb 22, 2013 in PHP


Ajax pagination with jQuery in cakephp 2.x.x

For apply ajax pagination in cakephp 2.x.x follow these below steps:


1). Copy File JqueryEngineHelper.php From lib/Cake/View/Helper and Paste to  app/View/Helper.

2). Include Latest jQuery File to your layout file for ajax paging.

ex- in app/View/Layouts/ajaxpagination.ctp

<!DOCTYPE html>

<!– This is mandotary –>
<?php echo $this->Html->script(‘;); ?>
<div id=”spinner” style=”display: none; float: right;”>
<?php echo $this->Html->image(‘indicator.gif’, array(‘id’ => ‘busy-indicator’)); ?>
<div id=”content”>
<?php echo $content_for_layout; ?>


NOTE: Here ‘indicator.gif’ image is a loader can place this image in app/webroot/img directory.

3).  To make Javascript enhanced links instead of plain HTML links, you have to use options() parameter to paginator helper .

ex- In your view ctp file add the following:

<!– This is mandotary –>
<?php $this->paginator->options(array(‘update’ => ‘#content’,’before’ => $this->Js->get(‘#spinner’)->effect(‘fadeIn’, array(‘buffer’ => false)),’complete’ => $this->Js->get(‘#spinner’)->effect(‘fadeOut’, array(‘buffer’ => false))));?>

Showing Page <?php echo $this->paginator->counter(); ?>
<th><?php echo $this->paginator->sort(‘Post.title’, ‘Title’);?></th>
<th><?php echo $this->paginator->sort(‘Post.created’, ‘Created Date’);?></th>
<?php foreach($customers as $customer): ?>
<td style=”padding-right: 30px;”><?php echo $customer[‘Post’][‘title’]; ?></td>
<td style=”padding-left: 30px;”><?php echo $customer[‘Post’][‘created’]; ?></td>
<?php endforeach; ?>

<?php echo $this->paginator->prev(); ?> – &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo $this->paginator->numbers(array(‘separator’=>’ – ‘)); ?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo $this->paginator->next(‘Next Page’); ?>
<?php echo $this->Js->writeBuffer();?> <!– This is mandotary –>

At the bottom of your view file. Be sure to include:

<?php echo $this->Js->writeBuffer();?>

If you omit this you will not be able to chain ajax pagination links. When you write the buffer, it is also cleared, so you don’t have worry about the same Javascript being output twice.

4). Controller File. add the following lines to your controller action:

$this->layout = ‘ajaxpagination’;
$this->set(‘customers’, $this->paginate(‘Post’)); <!– Record from the model which you want to show in view file with pagination. –>


Posted by on Feb 7, 2013 in Cake PHP, PHP


Tags: , , , , , , , ,

%d bloggers like this: