• Welcome to PHPVIBE Forums. Please log in.
avatar_Marius P.

How to write a plugin

Started by Marius P.,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Marius P.Topic starter

The PHPVibe plugin system is fairly simple to use and code for.
It relies on the hooks and filters present in PHPVibe (very similar to WordPress's system).

The plugin needs to have its own folder name and contain the file plugin.php, it needs to be activated through the 'Plugins' menu in the administration area.

A simple plugin example adding a message at the start of your homepage.

Create /plugins/hello/plugin.php

Top of the file (plugin details, commented):

<?php
/**
 * Plugin Name: Demo source
 * Plugin URI: http://phpvibe.com/
 * Description: Adds something new to PHPVibe
 * Version: 1.0
 * Author: PHPVibe Fan
 * Author URI: http://www.phpvibe.com
 * License: GPL
 */

Create the function returning the message.
In the simplest form ever you can use the language system to modify and translate the message.

function HelloWorld(){
echo _lang("Welcome to my great website");
}
Now we hook the function to the 'home-start' action present on top of home.php

add_action('home-start', 'HelloWorld');
Sure, you can use very complex logic and code here and on all the other actions, this is just a very simple example.
Happy with my help? Buy me a coffee.
Please, always use the search before opening a new topic! We're all here on our (limited) free time! Make sure you help yourself too!
  •  
    The following users thanked this post: fox_mulder

 

Similar topics (7)

[ Video Sharing CMS v4 ] Vimeo Plugin Error

Started by danilostorm


Replies: 3
Views: 2019

[ Video Sharing CMS v4 ] PHPvibe Dev required for language plugin

Started by boydie


Replies: 0
Views: 1572

Write a web source/new embed for PHPVibe

Started by Marius P.


Replies: 0
Views: 8739

[ Video Sharing CMS v4 ] PHPVibe 3.3 RC2 with ALL PHPVibeMOD plugin - Work in Progress

Started by sanishan


Replies: 5
Views: 4167

[ Video Sharing CMS v4 ] Multilanguage Plugin

Started by lucaradu


Replies: 3
Views: 1138

[ Video Sharing CMS v4 ] Xclub plugin not working (videos not working)

Started by shtefcs


Replies: 16
Views: 7342

[ Video Sharing CMS v4 ] How can search on search box when i using the plugin Easy Video Player?

Started by lucaphuoc


Replies: 1
Views: 2071