Posted by: calsunshine | August 21, 2011

Tutorial on creating a custom Module in SE4

Here is how to create a custom module in SE 4.1.6.

  1. In the admin page, go to Package Manager->Developer SDK->Create a Package
  2. Select Type Module and type in name and rest, I picked ‘traveling’.
  3. Download & save the module-traveling-1.0.0.tar when prompt.
  4. Go back to package manager and install the above .tar file.
  5. Now go to the “/socialengine/Application/Modules/Traveling” folder. You should see a bunch of files and folders generated.
  6. MVC are located under “Model”, “views” and “controllers” folder, respectively.
  7. If not exists, create an “IndexController.php” file under the controllers folder. Then paste in the following code:

Code for IndexController.php:

class Traveling_IndexController extends Core_Controller_Action_Standard
     public function indexAction()
 $this->view->msg = 'Hello World';

Explanation: the controller class name has to be Modulename_ControllernameController. In the Index controller, I created an index action, which is the default action. Then I created a variable named “msg” and passed it to the view object so it display it.

8.  Then create a view for the index action. Create an ‘index’ folder under “/socialengine/Application/Modules/Traveling/views/scripts/index”. Then create an index.tpl file in this folder.

9. Code for index.tpl:

<?php echo $this->msg; ?>

Basically  it is just output the msg variable I passed to the view from the indexAction in the controller.

10. Then go to the url: “http://localhost/socialengine416/index.php/traveling/index&#8221; and you should see ‘Hello World’. The format of the url to invoke the action is “http://sitename/index.php/modulename/controllername/actionname&#8221;. Since index is the default action, it can be omitted. Otherwise, the full url should be “http://localhost/socialengine416/index.php/traveling/index/index&#8221;.

You’ll notice there is no Model involved yet. I’ll cover that in the next post, i.e., how to create Model and get data from MySql and interact with it.



  1. I would love to see a simple tutorial on how to work with a database and creating a custom module. I know PHP, but ZEND is something I have not fully dove into. I want to build a simple article module for SE4

    • nevermind. I found one. Thanks!

  2. Thank you so much for this clear and simple tutorial, I love this planet because it has people like you 🙂

    • Great man! Great words!!!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: