How to use a controller function anywhere in you project/site

Step-1:

Open main.php file. Default file path is protected > config > main.php

Add One line in import array that is  ’application.controllers.*’,

After Add that code like

  1. // autoloading model and component classes
  2.     ‘import’=>array(
  3.         ‘application.models.*’,
  4.         ‘application.components.*’,
  5.  
  6.         ‘application.controllers.*’,
  7.  
  8.         ‘application.extensions.niceditor.*’,
  9.         ‘application.extensions.multiple-file-upload.*’,
  10.         ‘application.extensions.prettyPhoto.*’,
  11.     ),

See line number 6. Now Save this file.

Now it’s ready to use.

Step-2:

Suppose you want to use a function name is “PartyBill” and controller name is “CommonController”. It is very easy to use.

The Code is :

  1. $PartyBill = CommonController::PartyBill();
  2.  
  3. echo $PartyBill;

Enjoy !  !!

 

Rajib Kumar Rakhmit

www.rajibkumar.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>