Creating a very simple plugin

CrazyCoder

Member
ok lets go,
lets start by this very simple plugin ... very simple ??? hahaaaaa not really when i was doin it, lol

to create a simple languages selector :
=========================

1)
original code part of the index.php :

PHP:
// The language file
require_once("{$CONF['path']}/languages/english.php");
require_once("{$CONF['path']}/languages/{$CONF['default_language']}.php");
after several tries, i found i had to remove the second line, this one :

PHP:
require_once("{$CONF['path']}/languages/{$CONF['default_language']}.php");

So just removed this line in index.php

2)
well, i MANUALLY added my plugin to the /plugins/ folder on the FTP,
because i did not suceeded to upload it by the admin panel,
i dont know maybe am too tired, am missing something :)))))
So just upload the SelectLang folder to the FTP, folder : ROOT ==> /plugins/

3) where you want to show the option select, the language selector, so, just add :

HTML:
{$alamandra_customs_fields}
Personnaly i added it just right after the beginning of the sidebar, so it looks like this :
HTML:
<div id="sidebar">
{$alamandra_customs_fields}

-----------------------------------------------------------------------


I tried to code it on another way, calling the plugin manager,
But i did not succed, arrfffffff

this was something like this in my first try :

PHP:
$TMPL['lang_list_row'] = $TMPL['languages_list'];
$TMPL['alamandra_customs_fields'] .= base::do_plugin_skin('./plugins/SelectLang','lang_list_row');
of course i added the html file, lang_list_row.html, but nope it was not working.

I'll will restart to try to use the plugin manager call, another day :)))

I wanted to show up to Mark & Basti this very very simple code,
In order to get some help to create much much much more complex ones :))))))


See you :))))

DONT USE THIS UNTIL MARK AND BASTI DO REPLY OK ?????

ok, right :))))))))

Of course its well running, but i think it could be done elseway, no ?
 

Attachments

CrazyCoder

Member
arfff i should order the languages available list, order from A to Z, hihihiiiiiiii
just a code line to add ... but lets wait after our big ones boss coders, to answer to this post,
And comment this very very very ....... very very tiny code , :))))
 

CrazyCoder

Member
Oops , in fact the require_once of the plugin language does crash the plugin,
so i directly added the extra languages var, to each /languages/ folder concerned file
so REMOVED from global_start.php those 2 lines :

Code:
require_once("{$CONF['path']}/plugins/SelectLang/languages/english.php");
require_once("{$CONF['path']}/plugins/SelectLang/languages/french.php");
and added the languages var to root /languages/ files :
So in english.php, and french.php.

AS I SAID DONT USE THIS PLUGIN !!!
TILL Mark and / or Basti come to help to chek it :))))

Its running along with many others on my test site, so, just wait :)

I hope we will be able to create our own plugins,
and maybe contribute to VL !
 
Top