"Hello World!" - Extension & Skeleton Tool

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

Re: "Hello World!" - Extension

Post by pierredu »

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
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: "Hello World!" - Extension

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here
User avatar
pierredu
Registered User
Posts: 1256
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)

Re: "Hello World!" - Extension

Post by pierredu »

Thanks. I'll check again.
User avatar
pierredu
Registered User
Posts: 1256
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)

Re: "Hello World!" - Extension

Post by pierredu »

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
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: "Hello World!" - Extension

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here
User avatar
pierredu
Registered User
Posts: 1256
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)

Re: "Hello World!" - Extension

Post by pierredu »

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 »

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
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: "Hello World!" - Extension

Post by david63 »

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!

I now no longer support any of my extensions but they will start to become available here
User avatar
Megakyoto
Registered User
Posts: 30
Joined: Sat Sep 19, 2015 12:25 am

Re: "Hello World!" - Extension

Post by Megakyoto »

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 »

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
Former Team Member
Posts: 22011
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: "Hello World!" - Extension

Post by RMcGirr83 »

Please stop cross posting in multiple forums on here. The answer is because you are using subsilver2 which many extension aren't written for.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then buy me a beer Image
AesirHod
Registered User
Posts: 13
Joined: Wed Nov 25, 2015 4:42 pm

Re: "Hello World!" - Extension

Post by AesirHod »

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: 18282
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: "Hello World!" - Extension

Post by DavidIQ »

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: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: "Hello World!" - Extension

Post by Lumpy Burgertushie »

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
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
AesirHod
Registered User
Posts: 13
Joined: Wed Nov 25, 2015 4:42 pm

Re: "Hello World!" - Extension

Post by AesirHod »

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”