"Hello World!" - Extension & Skeleton Tool

Discussion forum for Extension Writers regarding Extension Development.
User avatar
pierredu
Registered User
Posts: 800
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)
Name: Pierre Duhem

Re: "Hello World!" - Extension

Post by pierredu » Fri Feb 27, 2015 2:59 pm

Hello,

I'm testing this demo extension to check the overall way of working and there is something I don't understand.

How can I have two languages and check the language declared by the user to use the correct wording?
I tried to create a fr folder in the language folder, but it doesn't seem to be enough.

Thanks in advance for any help.

User avatar
david63
Jr. Extension Validator
Posts: 13188
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: "Hello World!" - Extension

Post by david63 » Fri Feb 27, 2015 3:12 pm

You should be able to use any language that is in the language folder.

You simply put an fr folder, containing a language file with the same name as the one in the en folder, in the language folder and if that language is installed in the core and the user has that language selected then it should pick it up.

You may have to disable/enable to make sure that it works
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
pierredu
Registered User
Posts: 800
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)
Name: Pierre Duhem

Re: "Hello World!" - Extension

Post by pierredu » Fri Feb 27, 2015 3:37 pm

Thanks. I'll check again.

User avatar
pierredu
Registered User
Posts: 800
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)
Name: Pierre Duhem

Re: "Hello World!" - Extension

Post by pierredu » Sun Mar 01, 2015 2:32 pm

Hello,

Another question: where should I put php code to be executed before calling the template. My objective is to produce a kind of dictionnary, like the one to be seen at http://www.insecte.org/forum/glossaire_entomologie.php. This is a classical pattern. The data is in a mySQL table.

Should I put the code in the handle function? But, in such a case, how can I manage the recursive calling of the code with a different initial letter?

Thanks in advance for any clues.

User avatar
david63
Jr. Extension Validator
Posts: 13188
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: "Hello World!" - Extension

Post by david63 » Sun Mar 01, 2015 2:35 pm

It would be better if you started another topic to discuss particular issues - that way you will stand more change of getting a response
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
pierredu
Registered User
Posts: 800
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)
Name: Pierre Duhem

Re: "Hello World!" - Extension

Post by pierredu » Sun Mar 01, 2015 3:18 pm

Hello,

OK, I'll do it.

User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: "Hello World!" - Extension

Post by Megakyoto » Thu Sep 24, 2015 2:36 am

Hey guys, I'd like to learn to make extensions but looking at the 'hello world' zip I see it too complicated for a n00b like me, so my question is… is it possible to write simple extensions with just a couple of files instead of dozens spread in tens of folders?

I have some utilities I'd like to show in a tab in the ACP, so a simple list of options that run the specific file would suffice.

Any pointers to the simplest tutorial of all?

User avatar
david63
Jr. Extension Validator
Posts: 13188
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: "Hello World!" - Extension

Post by david63 » Thu Sep 24, 2015 7:34 am

Megakyoto wrote:is it possible to write simple extensions with just a couple of files instead of dozens spread in tens of folders?
Yes and no.

I have created extensions that only have two or three files in them, yet there are others with many, many files. It all depends on what you are trying to do.

If you want to start creating extensions then you will need to "bite the bullet" and spend time learning how to do it - just like the rest of us have had to do.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: "Hello World!" - Extension

Post by Megakyoto » Fri Sep 25, 2015 8:27 pm

Ok, here are some simple tasks I've coded I know will be overwritten with an upgrade and I'd like to know if I can write them as extensions or any other form.

- Convert all uppercase subjects to lowercase (leave first upper only)
- Automod: allow topic authors to delete messages posted in the last 24 hours (enable delete button)
- Strikethrough button: not as a bbcode but as part of the original B I U S buttons (fourth position in edit buttons)
- Admin programs: just a list of some programs I run once in a while I'd like to have in the admin panel as a menu

These are pretty simple tasks, some take no more than a couple of lines and I would really like to learn extensions for my own peace of mind in the case of a much needed upgrade.

Simplicity is my motto, if you can point me to resources where you've managed to solve your problems with a couple of files, much appreciated.

forumGamer
Registered User
Posts: 42
Joined: Sat Oct 31, 2015 1:53 am

Re: "Hello World!" - Extension

Post by forumGamer » Mon Nov 02, 2015 6:21 pm

nickvergessen wrote:I made an as-simple-as-possible Extension that uses some of the basic mechanisms in phpBB 3.1 your extension will use aswell:
  • Events: for adding a link to a new page in the header and loading a language file globally
  • Routes and Controllers: which display the new page
  • Ext Language files: so your files are where your code is
  • Ext Style files: so your style files are where your code is
  • Migrations: Database changes similar to UMIL in 3.0
  • ACP Module
You can find the code at https://github.com/nickvergessen/phpbb-ext-acme-demo
To install it and see the demo:
  1. Download the .zip
  2. Create the folder ext/acme/demo/ next to your config.php
  3. Copy the content from the .zip to the new folder
  4. Go to ACP > Customise > Extensions >
    and enable the Acme Demo Extension extension
Now you should see the link in the header:
Image
and if you click it, you should see the "Hello World!"
Image
If you change the url from phpBB/app.php/demo/world to phpBB/app.php/demo/nickvergessen,
you will see the message "Hello nickvergessen!"
I downloaded the Extension, enabled it on my ACP, though the "demo" doesn't appear for me. I tried purging the cache in the ACP on the general tab, though still no "demo" link appearing. I tried getting another extension ("Collapsible Forum Categories") to see if I was able to get other extensions to work, though that one isn't appearing on the forum either (even after I enable it in the Customise >> Extension Manager). Is there another setting I forgot to enable?

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20442
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: "Hello World!" - Extension

Post by RMcGirr83 » Mon Nov 02, 2015 8:29 pm

Please stop cross posting in multiple forums on here. The answer is because you are using subsilver2 which many extension aren't written for.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

AesirHod
Registered User
Posts: 13
Joined: Wed Nov 25, 2015 4:42 pm

Re: "Hello World!" - Extension

Post by AesirHod » Sun Dec 13, 2015 1:35 am

This example could do with a note that the install directory must be deleted or renamed before the demo button will function. It might seem obvious to experienced users, but I initially left the folder in case I still needed anything from it.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 16544
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: "Hello World!" - Extension

Post by DavidIQ » Sun Dec 13, 2015 4:38 am

AesirHod wrote:This example could do with a note that the install directory must be deleted or renamed before the demo button will function. It might seem obvious to experienced users, but I initially left the folder in case I still needed anything from it.
You mean the phpBB install directory? There's a colorful notice on the front of the forum that indicates the forum is currently unusable with the directory present. Why would you assume that an extension will work with the forum in that state?
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.

User avatar
Lumpy Burgertushie
Registered User
Posts: 63196
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: "Hello World!" - Extension

Post by Lumpy Burgertushie » Sun Dec 13, 2015 5:19 am

AesirHod wrote:This example could do with a note that the install directory must be deleted or renamed before the demo button will function. It might seem obvious to experienced users, but I initially left the folder in case I still needed anything from it.
not sure what you are talking about. no extension has a folder named install as part of it that I know of.

as for the install folder that comes with phpbb,that should have been deleted way before you started installing extensions.
there are probably hundreds of posts here that tell you that the board does not work as long as that folder is present. it is repeated in every set of install instructions etc.

robert
I am available for custom work on a donation basis. Please send me a PM with your needs.
Premium phpBB 3.2 Styles by PlanetStyles.net

New phpbb 3.0 support site

AesirHod
Registered User
Posts: 13
Joined: Wed Nov 25, 2015 4:42 pm

Re: "Hello World!" - Extension

Post by AesirHod » Sun Dec 13, 2015 11:38 pm

Lumpy Burgertushie wrote:
AesirHod wrote:This example could do with a note that the install directory must be deleted or renamed before the demo button will function. It might seem obvious to experienced users, but I initially left the folder in case I still needed anything from it.
not sure what you are talking about. no extension has a folder named install as part of it that I know of.

as for the install folder that comes with phpbb,that should have been deleted way before you started installing extensions.
there are probably hundreds of posts here that tell you that the board does not work as long as that folder is present. it is repeated in every set of install instructions etc.

robert
Sorry about that. I assumed I'd only need to read the posts that answered questions I actually had. I was merely suggesting that it would save a bit of time for beginners.

Post Reply

Return to “Extension Writers Discussion”

Who is online

Users browsing this forum: No registered users and 10 guests