Add-ons quick introduction

From SocialStrap Wiki
Jump to: navigation, search

What is add-on?

SocialStrap has a highly extensible add-­on system allowing developers to write their own add-­ons extending almost any aspect of the app. You can find all add-­ons in addons/ folder. They can be managed and configured by the admin user through add­-ons top menu link. 

Add-ons can use application database, override layout or extend other aspects of the main app. They can be created in pure php or using available Zend Framework library.

Note: addons/ folder must be writable to the web server.


How can I install add-on

Each add-on is kept in its own folder. To install add-on simply upload this folder to your web server into addons/ folder where your SocialStrap is installed. Add-ons are often zipped so you must first unzip it before uploading it to your web server.


How can I disable/remove add-ons

Admin can disable each individual add-on by visiting "Addons" link on the main top-menu. On next screen select add-on from the menu and click on Disable button.

You can disable all add-­ons if you:

  • login as admin and uncheck Load addons check-box inside Settings -> General
  • edit config.php file and change your application environment (APPLICATION_ENV) to: safe

If you want to remove add-on just delete its folder from your web server.


Where can I find add-ons?

Please visit add-on directory: http://www.socialstrap.net/addons.

You can try to find more add-ons by joining Web Developers Group or at CodeCayon marketplace.


Which addons are installed on live preview / community site?

Refer to this post: https://live.socialstrap.net/profiles/showpost/name/webdevs/post/5872


Basic add-on file structure

init.php - required file, contains basic info about the add-on.

hooks.php - hook attachments goes here

page.php - view template called by the add-on core controller.

settings.php - admin panel with configurations, options or info


sample init.php content

<?php
$name = 'My First Add-on';
$version = '1.0';
$author = 'John Doe';
$description = 'Sample Add-on';


sample hooks.php content

<?php
$this->attach('hook_view_sidebar', 5, function($view) {
	echo 'Hello on sidebar';
});


page.php

Content of this file will be called as a “View” part of the app on wide layout. This will be accessible trough the URL link http://example.com/addons/myfirstaddon/ where “myfirstaddon” is an add-on’s folder name. (see games add-on as an example).


settings.php

Content of this file is used to render the add-on settings panel seen by the admin user. You can place your add-on’s config logic here or display a simple add-on info.