"Hello World!" - Extension & Skeleton Tool

Discussion forum for Extension Writers regarding Extension Development.
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 »

but the point is, that the fact that the install folder needs to be deleted after install has nothing to do with installing extensions. extensions do not have a folder named install in them.

if you are installing phpbb then you would normally read the instructions for installing.

therefore, you would have already seen the instruction to delete that folder and it would not be there after you had installed a extension.


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 »

I initially thought the folder only needed deleting at the point where the board needs to be available to the public. Since this was just a local install for me to experiment and try things out, and I didn't know if I'd need it later on, I left it alone. I figured out the problem quickly enough and just posted here to help save time for others.

Speaking of experimentation, I'm struggling to find the part of this extension that actually stores the "Hello World" string and handles the click so I can experiment with changing the functionality. There was mention of a link to phpBB/app.php/demo/world, but I couldn't find which file contained that.
User avatar
mrgoldy
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs
Contact:

Re: "Hello World!" - Extension

Post by mrgoldy »

It's through the config/routing.yml. There the {name} variable is set. So what ever is put there is the name.

Then in controller/main.php there is this function.

Code: Select all

public function handle($name)
	{
		$l_message = !$this->config['acme_demo_goodbye'] ? 'DEMO_HELLO' : 'DEMO_GOODBYE';
		$this->template->assign_var('DEMO_MESSAGE', $this->user->lang($l_message, $name));
		return $this->helper->render('demo_body.html', $name);
	}
$l_message checks if we're saying "Hello" or "Goodbye", set from the ACP.
Then assigning a single template var, the 'DEMO_MESSAGE'.
Which holds the value of $this->user->lang($l_message, $name). Note that coding it like this is pretty much the same as: sprintf($this->user->lang['DEMO_HELLO'], $name), it's just easier as you don't have to use the sprintf part.
Then the return 'sets' the template. First parameter is the template file and the second is the Page Title.

Hope this helps ;)
phpBB Studio / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
LaxSlash1993
Registered User
Posts: 182
Joined: Sat Sep 22, 2012 2:20 am

Re: "Hello World!" - Extension

Post by LaxSlash1993 »

As per this tutorial relating to this extension: https://area51.phpbb.com/docs/dev/31x/e ... migrations

Code: Select all

<?php
/**
 *
 * This file is part of the phpBB Forum Software package.
 *
 * @copyright (c) phpBB Limited <https://www.phpbb.com>
 * @license GNU General Public License, version 2 (GPL-2.0)
 *
 * For full copyright and license information, please see
 * the docs/CREDITS.txt file.
 *
 */

namespace acme\demo\migrations;

use phpbb\db\migration\migration;

class add_module extends migration
{
    public function effectively_installed()
    {
        return isset($this->config['acme_demo_goodbye']);
    }

    static public function depends_on()
    {
        return array('\phpbb\db\migration\data\v31x\v314');
    }

    public function update_data()
    {
        return array(
            array('config.add', array('acme_demo_goodbye', 0)),

            array('module.add', array(
                'acp',
                'ACP_CAT_DOT_MODS',
                'ACP_DEMO_TITLE'
            )),

            array('module.add', array(
                'acp',
                'ACP_DEMO_TITLE',
                array(
                    'module_basename'       => '\acme\demo\acp\main_module',
                    'modes'                         => array('settings'),
                ),
            )),
        );
    }
}
returns:

Code: Select all

mod_fcgid: stderr: PHP Fatal error:  Cannot redeclare class acme\\demo\\migrations\\add_module in /var/www/clients/client0/web2/web/forum/ext/acme/demo/migrations/migration.php on line 51
User avatar
Sajaki
Registered User
Posts: 1390
Joined: Mon Mar 02, 2009 1:41 pm
Location: Amsterdam
Contact:

Re: "Hello World!" - Extension

Post by Sajaki »

For the visually inclined like me, i tried to picture the logic flow involved in acme.demo.
acme.demo.png
mike2003
Registered User
Posts: 91
Joined: Sun Mar 20, 2016 12:10 am

Re: "Hello World!" - Extension & Skeleton Tool

Post by mike2003 »

does not work?
Fatal error: Class 'Symfony\Component\Finder\Finder' not found in C:\xampp\htdocs\phpBB32\ext\phpbb\skeleton\helper\packager.php on line 201
after Submit
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: "Hello World!" - Extension & Skeleton Tool

Post by david63 »

mike2003 wrote:does not work?
Fatal error: Class 'Symfony\Component\Finder\Finder' not found in C:\xampp\htdocs\phpBB32\ext\phpbb\skeleton\helper\packager.php on line 201
after Submit
Known issue - see viewtopic.php?f=64&t=2366391
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
mike2003
Registered User
Posts: 91
Joined: Sun Mar 20, 2016 12:10 am

Re: "Hello World!" - Extension & Skeleton Tool

Post by mike2003 »

i am use 3.1.8 not 3.2
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 & Skeleton Tool

Post by RMcGirr83 »

Finder is not within 3.1.8, it is only in 3.2.*
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
mike2003
Registered User
Posts: 91
Joined: Sun Mar 20, 2016 12:10 am

Re: "Hello World!" - Extension & Skeleton Tool

Post by mike2003 »

this ext in 3.1.*
Image
why??
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 & Skeleton Tool

Post by RMcGirr83 »

Do you see a 3.2 forum?
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
mike2003
Registered User
Posts: 91
Joined: Sun Mar 20, 2016 12:10 am

Re: "Hello World!" - Extension & Skeleton Tool

Post by mike2003 »

How is it run on a 3.1.8?
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 & Skeleton Tool

Post by RMcGirr83 »

Currently, you have to install composer and then run composer update to get the dependencies. Not for the faint of heart nor for those less knowledgeable.
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
mike2003
Registered User
Posts: 91
Joined: Sun Mar 20, 2016 12:10 am

Re: "Hello World!" - Extension & Skeleton Tool

Post by mike2003 »

About which "composer" you talking about?
I have this EXT and phpbb 3.1.8
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: "Hello World!" - Extension & Skeleton Tool

Post by david63 »

mike2003 wrote:About which "composer" you talking about?
I have this EXT and phpbb 3.1.8
If you do not know about "Composer" then I would suggest that you Google it.
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
Post Reply

Return to “Extension Writers Discussion”