echterhoff / plg-globalvariables

Joomla Plugin GlobalVariables (plg-globalvariables)
2 stars 2 forks source link

Dynamic external variable sources #3

Open jasbo opened 9 years ago

jasbo commented 9 years ago

Hi--love your plugin, thank you thank you.

I am developing an app based in Joomla that carries out a bunch of financial calculations based on input from the user. A fairly large variable source file is then written to the server and used to produce a sales presentation. My next step is to allow different users to use the app simultaneously. What I want is to use a different ini file for each user.

Is there any possibility of passing a filename in a request to produce an article and use that file as the variable source?

echterhoff commented 9 years ago

Hi Jasbo,

thank you, simply for the thanks and for using my solution. ;-)

If I got your problem right, I think there is a more performant and more simple solution to your task. You should fiddle around with the query-attribute. I think you can solve your task by writing an API-like script that dispenses the requested variable. Maybe direct from a database. (You mentioned your resource is rather large. So the file must not get parsed for each request.)

Place a variable tag equipped with a resource. In this case a script on your server. You can simply place it somewhere in the joomla sources or in a seperate subdomain. Than form a query containing the user id and an associated secret passkey. (Like $secrectkey = hash('md5',userid+'your secret key phrase'); But that is up to up.)

In the mean time, I am gonna take a look at how to form that proper query-string including such a key and pass it to the query string.

So each request points to your script passing the requested variable to your API and you can simply echo the result.

Gonna get back to you as soon as I got a clue wether its possible or how long it will take until its possible. Okay?

Have a nice night/evening/day, Lars

echterhoff commented 9 years ago

Okay. It works.

Interface header/query info: {{queryinfo source="interface" data="some additional data" query}}

The source interface must point to an external resource. A php script file to be exact. This script takes then the request and answers with an echo. If you need to know what exactly is in the request, simple write a myapi.php with just a var_dump($_REQUEST); in it.

Have updated the master repository at github with the additional user data.

Within your own script you should be able to query your data and return (echo) the desired result.

Hope this solves your problem. Otherwise, dont hesitate to contact me. Would be nice if you could review my plugin at the extension directory.

Lars