Adding ext to custom page (portal)

Discussion forum for Extension Writers regarding Extension Development.
User avatar
Stoker 4.0
Registered User
Posts: 1506
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen

Adding ext to custom page (portal)

Post by Stoker 4.0 »

Hello,

I hope somebody can guide me on this problem.

I have made a portal ext and an ext called forumgoal.
The ext forumgoal is loaded on index

Code: Select all

static public function getSubscribedEvents()
	{
		return array(
			'core.index_modify_page_title'	=> 'index_modify_page_title',
		);
	}
How do I load the forumgoal ext on the portal without copying all the code?
Regards Stoker
User avatar
Toxyy
Registered User
Posts: 966
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek

Re: Adding ext to custom page (portal)

Post by Toxyy »

You could try this approach in your portal extension (remember to change the include code to the new twig syntax):
viewtopic.php?p=14533096&hilit=include+ ... #p14533096

If that doesn't work, since the portal itself is a custom page, you could add
{% EVENT index_body_stat_blocks_before %}
(or whatever the event name is that you actually use for forumgoal)
to your portal.html file, which should add the event that you use for your forumgoal and whatever else uses that event to your portal as well.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

Some of my extensions:
[3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension
User avatar
Stoker 4.0
Registered User
Posts: 1506
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen

Re: Adding ext to custom page (portal)

Post by Stoker 4.0 »

Toxyy wrote: Thu Jun 13, 2024 2:01 pm You could try this approach in your portal extension (remember to change the include code to the new twig syntax):
viewtopic.php?p=14533096&hilit=include+ ... #p14533096

If that doesn't work, since the portal itself is a custom page, you could add
{% EVENT index_body_stat_blocks_before %}
(or whatever the event name is that you actually use for forumgoal)
to your portal.html file, which should add the event that you use for your forumgoal and whatever else uses that event to your portal as well.
Thanks, I have considered how to do this.
The only way that makes sense, is to copy the code to the portal ext.
Otherwise users will be forced to install the other ext to make it work on portal. I dont think its a good idea.
Regards Stoker
User avatar
Toxyy
Registered User
Posts: 966
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek

Re: Adding ext to custom page (portal)

Post by Toxyy »

Stoker 4.0 wrote: Fri Jun 21, 2024 9:31 am Otherwise users will be forced to install the other ext to make it work on portal.
Yes, that was what I had in mind with my two recommendations, based on this:
Stoker 4.0 wrote: Thu Jun 13, 2024 1:40 pm How do I load the forumgoal ext on the portal without copying all the code?
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

Some of my extensions:
[3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension

Return to “Extension Writers Discussion”