Jump to content

Photo

[SE5] Developer HelloWorld Bare-bones


  • Please log in to reply
1 reply to this topic

#1 Les

Les

    Blue Team Lima 1

  • Moderators
  • Level
  • 5,075 points
  • 3,380 posts
    • Gender:Male
    • Location:Westland, Michigan U.S.A.
    • Software:SE 4.8.x


Users Awards

Posted 26 March 2020 - 12:16 PM

"Do you wanna be a Developer?"
Do you wanna develop your own modules and widgets?
*Start with basic widgets
 
We are starting a new in SocialEngine [5] which I feel is better started with a file used to create your own personalize modules or widgets. This is a file that you don't get in a regular download from SocialEngine, it is a developer file. It seems this file is perfect for the first entry of this new SEF Social Engine 5 Mods & Tutorials Forum. 
 
Attached File  HelloWorld.zip   238.84KB   1 downloads
 
Let us first start with the understanding of SocialEngine MVC architecture. [ Model / View /  Controller ]
 
200px-MVC-Process.png

  • A simple widget is made up of two [2] files. Controller.php & index.tpl.
  • A widget that is part of a module will have a third file named manifest.php
  • Usually the module will need code added to bottom of content.php file (before the very last closing bracket ‘)’ )

When building a widget make sure you create it in /application/widgets

If you want to create your own widgets, It is recommended to place them in application/widgets folder. The widgets in the modules use a common content file, which would be replaced if you upgraded your SocialEngine. The widgets in the application/widgets folder are designed to be static in nature, so their files are not touched unless you specifically upgrade that widget (or never if it’s your own).
 
If you have downloaded already and noticed that there is no 'widget' folder in the package, it is because we are gonna build it here using User module as example:
 
Controller.php [sample code]

<?php

class User_Widget_mywidgetController extends Engine_Content_Widget_Abstract {

public function indexAction()  {

$this->view->msg=”Hello Widget!”;

}
}

In the case above, it utilizes the User Module but if you are creating a whole module you would give it your module name: Yourmodule_Widget_mywidgetController
 
index.tpl ;sample code] 

<?php

echo $this->msg;

?>

 Use this convention to get variables assigned in controller: $this->variablename
 
Now, if you are adding this or making this part of a module [sample uses User module]
You need to do this edit the content file associated with User module: ({social_engine_root}/application/modules/User/settings/content.php)  and append the following at the very bottom of page (before the very last closing bracket ‘)’ )

 

content.php [sample code - added at bottom]

array( ‘title’ => ‘My Widget’,

‘description’ => ‘This is a brand new User Widget’,

‘category’ => ‘User’,

‘type’ => ‘widget’,

‘name’ => ‘user.mywidget’,

),

Always, of course, replace “mywidget” with your widget’s name.


Edited by Les, 26 March 2020 - 04:18 PM.

:emo: Please don't forget to  27-AwardsImgIcon.png "LIKE" if you like this post or if it is helpful to you. This is a way to show gratitude for the help that you received. After all, the "LIKE" costs you nothing. Don't you agree? Also, any and all modules, plug-ins, themes, widgets, or DB entries that are shared or posted by me are for educational purposes. Please visit the developers websites and purchase legitimately, if you like them. Thanks, Les

socialengine-experts.png

 

 


#2 Kronos

Kronos

    Level 3

  • Members
  • Level
  • 14 points
  • 98 posts
    • Gender:Not Telling
    • Software:SE 4.8.x

Posted 26 March 2020 - 02:26 PM

Very good info, I need to find time to start learning to make my own modules.  Or using API's to make widgets.  For example weather, Tides, location, etc...

 

As of right now, I most need an experienced dev to help out. I've got too much going on to focus on coding.

It seems a bit hard to find SE devs.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


All the resources listed here are just for testing purpose and they shouldn't be used at any commercial environment without a valid license.
Those are for users who wants to try them before buy. Help the developer to build it better by purchasing them from original authors.