Pages

Showing posts with label in. Show all posts
Showing posts with label in. Show all posts

Sunday, April 5, 2015

Cakephp 3.0-Where IN Condition with list

So here comes Cakephp 3.0 with all new syntax new ORM and many other changes.I find myself struggling with Cakephp this hard since I used cakephp 1.3 for the first time.

But here is My first struggle to help you with

  return $this->find('list',['keyField' => 'id', 'valueField' => 'name'])->where([  
          'id IN'=>$nearCitys  
       ])->toArray();  

Sunday, April 21, 2013

Social Engine 4-Creating a widget in a module

Before creating a widget in a module we need to register the same

1. Go to your module folder and then in your module go to file

settings/content.php

This file contains all widgets which this module will provide.

As an example we will create a widget to show graph and also called it graph

This file returns an array of array's where the former contains various widgets information

 return array(  
  array(  
   'title' => 'Navigation Tabs',  
   'description' => 'Displays the Navigation tabs(menu) for Credits: Credits Home, My Credits, FAQ. Put this widget on the top of Credits Home and My Credits pages.',  
   'category' => 'Credits',  
   'active' => true,  
   'type' => 'widget',  
   'name' => 'credit.navigation-tabs',  
  ),  
  array(  
   'title' => 'Top Members',  
   'description' => 'Displays top members list with highest number of credits. Put this widget on Credits Home or on any other page.',  
   'category' => 'Credits',  
   'active' => true,  
   'type' => 'widget',  
   'name' => 'credit.browse-users',  
   'defaultParams' => array(  
    'title' => 'Top Members'  
   )  
  ),  
  array(  
   'title' => 'Graph',  
   'description' => 'Displays a widgets which displays a list of quick links to create a graph.',  
   'category' => 'Credits',  
   'type' => 'widget',  
   'name' => 'credit.graph',  
    'active' => true,  
   'defaultParams' => array(  
    'title' => 'Graph'  
   )  
  ));  

Look in the last array we have added our custom widget array in the end

Now lets move into the widget's folder of our module

Let's suppose our Module name is "Credit"

so in /widgets/graph/controller.php

We need to create these directories as per requirement

1:  Class Credit_Widget_GraphController extends Engine_Content_Widget_Abstract  
2:  {  
3:     public function indexAction()  
4:     {  
5:        $this->view->myvar="myvarvalue";  
6:       //You can also include forms (defined in forms of your module)  
7:         $this->view->form=new Filter_Form()  
8:     }  
9:  }  

Look at the name of the class see in settings file we have defined property "name" in widget array as credit.graph like wise here "Credit" is our module and "Graph" is widget...This should match with property.

Next we define template in
in /widgets/graph/index.tpl

and Access variables as

1:  <?php echo $this->filterForm ?>  


That's It Add widget from backend to the respective page

Sunday, May 1, 2011

Fatal error: Maximum execution time of 30 seconds exceeded in

Fatal error: Maximum execution time of 30 seconds exceeded in
Faced this error while installing a PHP project on my webserver.The solution to This problem is simple Simply increase the Execution timeout in the Php.ini file till the time you are getting the error.

Search for these lines

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 150

Bingo here you go