Pages

Monday, May 6, 2013

Social Engine 4-Finding name of widget and Calling/Running a widget by custom code via name

First things first

1. In the backend select layout=>layout editor

Select the page on which your widget is currently placed

Or

If you know the name of your widget find it in concerned module on right hand side

You can use my technique for the same

For example we are looking for the widget "Statistics" Find the plugin text in admin using "find text tool(Ctrl+F)" of your browser and search for the same under "Available Blocks"

2. Once yo know the widget and its module for example for above mentioned  widget we find it under "Core Module"

Moving Back to code

under

/application/modules/core/settings (considering our example for Core Module and Statistics Widget)

open file content.php

find the array of widget Statistics there like


 array(  
 'title'=>'statistics',  
 'description'=>'',  
 'category'=>'core',  
 'type'=>'widget',  
 'name'=>'core.statistics',  
 'defaultParams'=>array(  
 'title'=>'Statistics'  
 ),  
 'requirements'=>array(  
 'no-subject',  
 ),  
 );  

Now we need the name attribute to call our widget in code as


 <?php  
 echo $this->content()->renderWidget('core.statistics';)  
 ?>  

other examples can be

content()->renderWidget('core.ad-campaign') ?>

content()->renderWidget('user.home-photo') ?>

3 comments:

  1. Great аrtiсle! We аre linking to this grеat content on our websitе. Keep up thе grеat ωriting.
    website design

    ReplyDelete
  2. Good Post. truly It takes such a lot time to push and find traffic from social media, the matter is it ne'er consistent. we must always take into account Organic searches whereas victimisation social media and obtaining links from smart social networks like Google and will not simply provide some traffic however conjointly smart links to diary.
    social name.

    ReplyDelete
  3. Nice Post! really It takes such plenty time to push and notice traffic from social media, the matter is it never consistent. we have a tendency to should take under consideration Organic searches whereas victimization social name and getting links from good social networks like Google and can not merely offer some traffic but collectively good links to diary.

    ReplyDelete