Every OSSN component is located in a subdirectory of the /components folder and contains a PHP script called ossn_com.php. The name of your subdirectory will be your component name, so choose it carefully! It should be unique but readable, so that site administrators don't accidentally overwrite it with another component, but they can also understand at a glance what your component does.
The ossncom.php file is the control hub of any component.
Create ossncom.php file, example : components/newcomponent/ossncom.php
We recommend that you use the following skeleton code in your ossn_com.php file:
pages, actions, menus
ossn_register_callback('ossn', 'init', 'my_new_component');
To register languages in your component create a directory /locale in your component folder. The language file name must be like ossnisolang_code.php example components/new_component/locale/ossn.en.php for English translation
The language code is ISO 639-1 standard language code.
Use following code in language file:
$en = array(
'hello:world' => 'Hello World!',
ossn_com.xml in components/new_component/ the code should look like :
<?xml version="1.0" encoding="UTF-8"?>
<name>This is my componennt</name>
<description>Description of my component.</description>
<version>Version of component</version>
Here the id is the exact path where components files resides, 'new_component' is the correct path, so the component directory appear as /components/[ID]/ossn_com.php
Component ID/directory convention
- The directory must not contain any special characters
- Blank spaces are not allowed
Create a zip archive of the directory of your component. Make sure that on opening your archive it will appears as newcomponent/ossncom.php
By using the Component installer you can upload your component to the server and make it part of your Ossn installation after clicking "Enable" in the Components section of your admin panel.
After installation you can also change component files manually using ftp
See the Hello World component https://github.com/opensource-socialnetwork/HelloWorld