How to paginate multiple results in CakePHP?


Nice

For Latest Tech Updates Go To http://www.techstazo.com

Sourabh Jain

Here is my solution. In your controller :

function index(){// Your default model
    $this->set('model1', $this->paginate());// Pagination for model2
    $this->set('model2', $this->paginate('Model2'));}

In your view :

// Display your model1 data, and then for prev and next 
echo $paginator->prev($options = array('model'=>'Model1'));
echo $paginator->next($options = array('model'=>'Model1'));
The point is input your model name to Controller's paginate method and to Paginator's link method (sort, prev, next).

// Display your model2 data, and then for prev and next 
echo $paginator->prev($options = array('model'=>'Model2'));
echo $paginator->next($options = array('model'=>'Model2'));

View original post

Advertisements

Check Talktime Balance and Internet Balance Various Telecom Service Provider in India


1. Aircel –  
   
Check Balance :  *125# or Send BAL to 121
Check GPRS Balance: *126*4# or *126*1# or *301#
Customer Care Number:  121 or 123
 
 
 
2. Airtel –  
 
Check Balance : *123#
Check 2G GPRS Balance: *123*10#
Check 3G GPRS Balance: *123*11#
Customer Care Number:  121 or 198
 
 
 3. BSNL –  
 
Check Balance :  *123#
Check GPRS Balance: *123*10# or *234#
Customer Care Number:  9400024365 [Eastern Region]
 
 
 4. Tata Docomo –  
 
Check Balance :  *111#
Check GPRS Balance: *111*1#
Customer Care Number:  121 or 198
 
 
5. IDEA – 
 
Check Balance :  *123# or *130# or *212#
Check GPRS Balance: *125#
Customer Care Number:  12345
 
 
6. Reliance –
 
Check Balance :  *367# , *306# , *702#
Check GPRS Balance: *367*3# or “MBAL” and send to “55333” ( Without Quotes )
Customer Care Number:  *333 , *369
 
 
7. Vodafone –
 
Check Balance : *141#
Check 2G GPRS Balance: *141*9# or *111*6#
Check 3G GPRS Balance: *111*5*2#
Customer Care Number:  111 or 198 (Complaint No)
 
 
8. Uninor –
 
Check Balance :  *222*2#
Customer Care Number:  121,198
 
 
8. Videocon –
 
Check Balance :  *123#

[Ubuntu] How to give your Ubuntu 14.04 LTS “Trusty Tahr” a cool look [24.08.2014]


GameplayJDK's Blog

A month ago I decided to install the recent LTS of Ubuntu (which currently is 14.04) on my laptop. I’ve used Ubuntu in Oracles VirtualBox before to build a new version of wubi for Windows 8 and 8.1 (an article on that will come soon), so I was prepared. As I finally had installed all my favorite software and development tools (e.g. eclipse, Chromium, QtCreator) I searched for a way to customize the look’n’feel of it. I don’t like orange too well, I like blueish colors better :P. I found a solution and in this article I want to show you how to make your system look a bit cooler.


The steps we will take towards modifying the theme are the following:

  1. Adding the ravefinity ppas (ambiance & radiance color themes and humanity color themes) and installing UnityTweakTool
  2. Setting background and theme color
  3. Customizing your terminals style

1.Let’s start off…

View original post 334 more words

Page borders in all pages Using TCPDF


You can add borders to all pages in pdf generated using TCPDF by simple two steps.

  • Create a new class extend from TCPDF class
  • Override the Header method. (Header method is called on a generation of each new page in TCPDF)
<?php
App::import('Vendor','tcpdf/tcpdf');
App::import('Vendor','tcpdf/config/lang/eng');
class PTCPDF extends TCPDF
{
     protected $processId =0;
     protected $header ='';
     protected $footer ='';
     static $errorMsg ='';
    /**
      * This method is used to override the parent class method.
      **/
     public function Header()
     {
          $this->writeHTMLCell($w='', $h='', $x='', $y='', $this->header, $border=0, $ln=0, $fill=0, $reseth=true, $align='L', $autopadding=true);

          $this->SetLineStyle( array('width'=>0.40,'color'=> array(0,0,0)));

          $this->Line(5,5, $this->getPageWidth()-5,5); 

          $this->Line($this->getPageWidth()-5,5, $this->getPageWidth()-5,  $this->getPageHeight()-5);
          $this->Line(5, $this->getPageHeight()-5, $this->getPageWidth()-5, $this->getPageHeight()-5);
          $this->Line(5,5,5, $this->getPageHeight()-5);
     }
}

For Latest Tech Updates Go To www.techstazo.com

Retrieve Data By Multiple Order Priority In CakePHP


How you cab retrieve data from database by multiple field order priority………?

In cakePHP you can do easily as shown in below example.

In the following pagination query will output as Model first_name in Ascending order and Model last_name in Descending order.

 
$this->paginate = array(
        'conditions' => array(
                        ‘Model.created_date <‘  =>  ‘2014-01-01’
        ),
        'order' => array(
            'Model.first_name'  => 'ASC',
            'Model.last_name'  => 'DESC',
        ),
);
 
$this->set('data'$this->paginate('Model'));