Search
Other Sourcerer questions
Forum

Can I share variables from custom SQL-queries between different sourcerer code on same PHP-page?

Nifa's Avatar Nifa
Hi,

I use different sourcerer SQL-query scripts on different modules, which are shown on one page.

Now my page run multiple almost the same SQL-queries when loading a page. It would be nice if I could fire just one SQL-query that gets all needed variables that I will need on a page, and I can use that variable's output on different places/modules on that same page?

Is it possible to make sure the SQL-query is run first and after that the output/variables are global exported, so the wanted variable's can be used on different other places on the same PHP-page?

Many thanks in advance,
Nico
Peter van Westen's Avatar Peter van Westen ADMIN
I recommend you create a separate php file that has a custom PHP class in it. In there you can create methods that do what you need. And you could store the data you get from the database in a (static) property that only gets filled when it is still empty (or null).
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription