Extension changes sourcecode based on page trigger

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
L00ncan
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Thu Apr 15, 2021 1:41 am

Extension changes sourcecode based on page trigger

Post by L00ncan » Sun May 16, 2021 8:41 pm

I want to repeat a module without cloning it a couple hundred thousand times, for research study papers purpose. Would be perfect if i could use a single module instead but change some source code based on a text txt title trigger i place on the page. Repeating a module a couple hundred thousand times isn't practical. Trigger = sourcecode change
.
the sourcecode i want to change is literally just one letter that'll solve me from cloning hundred thousand modules, one letter change in sourcecode based on a txt trigger

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 27819
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Extension changes sourcecode based on page trigger

Post by Per Yngve Berg » Mon May 17, 2021 8:56 am


L00ncan
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Thu Apr 15, 2021 1:41 am

Re: Extension changes sourcecode based on page trigger

Post by L00ncan » Mon May 17, 2021 10:49 pm

Thankyou i will do, i'm waiting for the Joomla 4 release before i start creating a heck of alot of research papers as doing this in Joomla3 near the end of tenure would also be unpractical, but i will have a look and fingers crossed will be able to use it for Joomla 4 🤞

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 10348
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Extension changes sourcecode based on page trigger

Post by sozzled » Mon May 17, 2021 10:53 pm

L00ncan wrote:
Mon May 17, 2021 10:49 pm
I'm waiting for the Joomla 4 release ...
Don't wait! Have you read the discussions in the J! 4 forum? It is unlikely that a stable version of J! 4.0—suitable for production usage—will be released before late-2022 or, at least, well-enough understood by the community to help you if you have problems with it (and if you can wait that long).
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

L00ncan
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Thu Apr 15, 2021 1:41 am

Re: Extension changes sourcecode based on page trigger

Post by L00ncan » Tue May 18, 2021 4:32 pm

I still need to write the research, i can do that in k2-J3 while i wait, in a perfect world i wouldn't wait but...I need to know if these extensions will work in Joomla4 before i invest time

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 10348
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Extension changes sourcecode based on page trigger

Post by sozzled » Tue May 18, 2021 8:38 pm

K2 is a content construction "kit" for J! 3; it was last updated over one year ago. It is unsuitable for J! 4. That's the answer to your question.
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

L00ncan
Joomla! Apprentice
Joomla! Apprentice
Posts: 35
Joined: Thu Apr 15, 2021 1:41 am

Re: Extension changes sourcecode based on page trigger

Post by L00ncan » Wed May 19, 2021 1:37 pm

K2 should migrate however for business purposes. But! No, i was looking at the extension provided above, it won't work. What i'm looking for is each individual page to be different in the source code by combination few letters or a few to randomize them, enough for me to change the entire page dynamically
.
I was maybe hoping that there was an extension that would allow a trigger, this extension recommended above only allows one trigger to change all pages, i need every page different by one letter (or few) in the source code or a series of.
.
Page 154 loads = trigger 154
page 685 loads = trigger 685 perhaps based on a {685 trigger}

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 27819
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Extension changes sourcecode based on page trigger

Post by Per Yngve Berg » Wed May 19, 2021 4:26 pm

Look at the Protostar Template. It puts Itemid among other info to the body tag of the page.

Code: Select all

// Detecting Active Variables
$option   = $app->input->getCmd('option', '');
$view     = $app->input->getCmd('view', '');
$layout   = $app->input->getCmd('layout', '');
$task     = $app->input->getCmd('task', '');
$itemid   = $app->input->getCmd('Itemid', '');
$sitename = htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8');

Code: Select all

<body class="site <?php echo $option
	. ' view-' . $view
	. ($layout ? ' layout-' . $layout : ' no-layout')
	. ($task ? ' task-' . $task : ' no-task')
	. ($itemid ? ' itemid-' . $itemid : '')
	. ($params->get('fluidContainer') ? ' fluid' : '')
	. ($this->direction === 'rtl' ? ' rtl' : '');
?>">
All this code is from the index.php of the Protostar Template.

There is also extensions like Sourcerer and Jumi that allow php code to be used inside articles and modules.


Post Reply

Return to “Extensions for Joomla! 3.x”