I know, everybody hates ads. But you dislike to pay for something too. I would like to give everything for free, but it's impossible because costs are too much. If you know how Google ads work, you know how to help. It's on you. I can detect income by country, so... Australia rocks now! Thanks

How to create simple plugin


Jimako » 1 year ago

I was asked how to insert this:  http://gianthackers.blogspot.com/2013/11/how-to-create-slide-out-hiding-live.html

to e107 head. The best option is create plugin for this.

This is example how quickly it can be done when you know how e107 works.  What is time consuming is finalizing plugin for release.

So steps are: 

A. Preparing


1. go to your [e107_]plugins folder
2. create empty folder with desired name f.e. jm_cbox (use unique name)

Tip: copy there some filled plugin.xml file from other plugin (f.e. _blank plugin), otherwise you will need fill all fields manually

Jm Cbox 01

B. Generating

1. Go to Plugin Manager / Plugin Builder

Select your folder and click go

Jm Cbox 02

Note: if it's missing, it's because admin_config.php file is available. If you need to regenerate plugin, just rename old admin_config.php to something else

3. Skip sql files, we have no database tables

4. Fill data for plugin.xml

(I don't know what is purpose of most of fields, I just fill them with something to go futher.)

Note: if you let empty second field LAN, your plugin will not be displayed in plugin list. You need put there something with LAN_ alhough you have no language files. Don't forget to change this in generated xml file later.

Jm Cbox 03

5. Click on second tab Preferencies

- fill at least one preferencie.
I can image more prefs for this, but because I am trying to have simple and quick solution, one for code will be enough.

Jm Cbox 04

6. Addons


Note: I often generate more files that is needed, you can easy deleted them later

jm_cbox_menu - Menu item for use in the menu manager.
e_header - if you need to insert css and js into header
e_shortcode - Add a global shortcode which can be used site-wide. (use sparingly) , not sure if I use menu or shorcode

7. Click on Generate

If you see message that jm_cbox_ui $pluginName: is not valid. (jm_cbox) , it's plugin is not installed.

C. Installation


After installation configuration should work. Admin now fully works too.  Yes, it will need to improve titles, help field etc, but for now it's enough Just insert your iframe code to pref field and save it.

Jm Cbox 05

D. Frontend


Now fun starts.


JMadmin

Jimako
Main Admin
JMadmin

Jimako » 1 year ago

Frontend

Ok, this is about personal preferencies, each plugin developer can do this different way. This applies for my plugins.

WARNING:  I am used to PSPad, now I am trying different editor. 2 days or so... 

e_header.php


JMadmin

Jimako
Main Admin
JMadmin

Jimako » 1 year ago

jm_cbox_menu.php

At first check if your menu works,  add it to some menu area and you should see title jm_cbox and message Hello world.

If you don't see it, resolve it at first.

1. add to menu shorcode for code from preferencies.  (e_shortcode can be used everywhere, there is local alternative too)

2. check if content of your shortcode is displayed (message Hello world from shortcodes)

Result:

Jm Cbox 06

3. finalize content of shortcode

Result:

Jm Cbox 07

4. finalize content of menu.

Sorry, I somehow messed recording. But you can get idea from code.

Result:

Jm Cbox 08

Jm Cbox 09

To create this took 20 minutes, to create this post 2 hours, to finish this plugin it could be take 2 days. 

So learn and do it yourself.

Source code to this point:

SOURCE CODE


JMadmin

Jimako
Main Admin
JMadmin

Moderator(s): Jimako