Events not working

For support and discussion related to templates, themes, and imagesets in phpBB 3.2.
Post Reply
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 5871
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Events not working

Post by thecoalman »

I created a file :

forum_root/styles/prosilver/template/event/viewtopic_body_postrow_post_after.html

Contents of the file are simple:

Code: Select all

<p>test</p>
Purged the cache and I'm not seeing anything. I also tried placing it in all/template/event folder and no luck with that either.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
exxos
Registered User
Posts: 124
Joined: Fri Sep 10, 2010 12:37 pm

Re: Events not working

Post by exxos »

Have you viewed source on the page once loaded to see whats really there ?
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Events not working

Post by david63 »

Are you saying that you just created a single file? If so that is not how template events work - they need to be in and extension.
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
thecoalman
Community Team Member
Community Team Member
Posts: 5871
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Events not working

Post by thecoalman »

exxos wrote: Fri Aug 18, 2017 11:37 am Have you viewed source on the page once loaded to see whats really there ?
Yep, nothing.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 5871
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Events not working

Post by thecoalman »

david63 wrote: Fri Aug 18, 2017 11:43 am Are you saying that you just created a single file? If so that is not how template events work - they need to be in and extension.
I guess I misread the documentation, why does this have to be so hard? ;) I know I can include another template but that requires editing the core template and for maintenance purpose I'd prefer not doing that.

I'm not interested in doing anything but loading the custom template so I guess i need to just create a basic custom extension so they load?
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Events not working

Post by david63 »

thecoalman wrote: Fri Aug 18, 2017 12:15 pm guess i need to just create a basic custom extension so they load?
Yes - all you need for template events to run is a composer.json file and the template event files in the correct directory structure.
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
thecoalman
Community Team Member
Community Team Member
Posts: 5871
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Events not working

Post by thecoalman »

Working, thanks. For anyone else coming across this post copy this code and name the file composer.json

Code: Select all

{
    "name": "yourname/loadtemplates",
    "type": "phpbb-extension",
    "description": "Basic extension so template events can be used for custom templates",
    "version": "1",
    "license": "Dont steal my stuff LOL",
    "authors": [
        {
            "name": "Some Dude"
        }
    ],
    "require": {
        "php": ">=5.4.0",
        "composer/installers": "~1.0"
    },
    "extra": {
        "display-name": "Load Custom Templates",
        "soft-require": {
            "phpbb/phpbb": "~3.2"
        }
    }
}

Upload to:

Code: Select all

forum_root/ext/yourname/loadtemplates/
Activate the extension in the ACP.

Create a folder:

Code: Select all

forum_root/ext/yourname/loadtemplates/styles/prosilver/template/event
In the regular templates you'll find places to inject code:

Code: Select all

<!-- EVENT viewtopic_body_postrow_post_after -->
Name a file viewtopic_body_postrow_post_after.html and upload it to forum_root/ext/yourname/loadtemplates/styles/prosilver/template/event


------------------
I'm surprised something like this doesn't ship with phpBB, one issue I alwasy had in the past was maintenance on templates I customized. This will avoid a lot of that since I won't have to edit them to load custom templates
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

Re: Events not working

Post by david63 »

thecoalman wrote: Fri Aug 18, 2017 1:36 pm I'm surprised something like this doesn't ship with phpBB
Not ship but in CDB - https://www.phpbb.com/customise/db/offi ... _skeleton/
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 “[3.2.x] Styles Support & Discussion”