Pages

Sunday, April 21, 2013

Social Engine 4-Render and manage a page/view from backend

Here I will show you how to create and run a page from backend and get the control of the same from backend in Social Engine 4

Generally when we create pages we need to define a controller and action for them and control them via code.Some themes have fixed pages in them which are controlled directly from backend.

But if we want to add a custom page to be manageable from backend here is how to do the same

  1. First things First Take a backup of your database and also the files that you modify along I prefer to use a versioning system for lator case
  2. Create a new blank page from "Layout Manager"  in the backend/backadmin of Social Engine 4
  3.  Now go to your database and in the table Engine4_core_pages you will find NULL in "name" change this to "yourmodulename_yourcontrollername_yourviewname" for example if your
    1. Module is "Credits"
    2. Controller is "index"
    3. View is also "index"
Then name will be "credit_index_index"

Give it a title and description which you can also set from backend by modifying this page

4. Navigate to your Module directory "credits" in this case and then navigate to controllers and under controller create a file "IndexController"

1:  <?php   
2:  class Credit_IndexController extends Core_Controller_Action_Standard  
3:  {  
4:    public function indexAction()  
5:    {  
6:        $this->_helper->content->setNoRender()->setEnabled();  
7:    }  
8:  }  
9:  ?>  

This lets you add page from backend but will not render its content i.e "/module/views/scripts/index.tpl"

Now your view will be rendered and managed from backadmin only

No comments:

Post a Comment