Giter Club home page Giter Club logo

plg-globalvariables's Introduction

Joomla Plugin Global Variables (plg-globalvariables)

### Latest changes Complete rewritten from scratch. ...and since this is a complete rewrite I have cut compatibility and reduced the variable syntax to {{varname}} and {global}varname{/global} only. Please dont complain about that.

Global Variables for Joomla! 3.4+

This plugin parses the content on prepare time for variables within the content elements and replaces the variables with defined values. I wrote this plugin just because I did not find a plugin that could serve me with a easy solution like this...

If you ever messed around with information fragments like phone number, vat number or kind of information that is used in more than one place you gonna love this plugin. Instead of crawling the page for each occurance it is way more convenient to change this information just in one place.

This new version offers much more control over every aspect of variable handling and variable sources. Valid variable sources are articles, files and scripts as well as an internal variable management.

Defining a variable file is as easy as writing an ini-File. Specify a variable name followed by a equal sign (=). Type in your variable content and end the definition with a semicolon (;). If you like to define a more complex content, surround the value with (").

You dont need to close your definition by a semicolon. Just quote the variable content with ' or "

To use a variable, just place the variable name in your article as {{varname}}. As an alternative wrap your variable name with {global}varname{/global}.

This is the basic usage.

Since this is a all new version, there are several improvement like:

  • Support for multilanguage use. {{varname lang=de-DE}} or {{varname.de-DE}} or simply {{varname}} and let Falang handle it. (Falang compatibility)
  • Source selection beside the selected default source. {{varname source=myname}}
  • Use files from Dropbox, your public ftp or what ever is accessible from your web server as source.
  • Script request. {{varname query=1}}
  • Debug modes: Highlight or expose the tags in your page.

Installation

Download the plugin from here. https://github.com/echterhoff/plg-globalvariables/archive/master.zip

  1. Go to your Joomla! administration interface
  2. Install the .zip file with the installer
  3. Check, the plugin got activated correctly.
  4. Open the plugin configuration. (The plugin MUST be activated in order configure it correct!!!)

Use

Define some variables and place them within your articles or modules

Define variables like:

myvariable="this is my var";

Use them within your content with:

<p>Blahblah</p>
<p>This is my article content and {global}myvariable{/global}!</p>

This will result in:

This is my article content and this is my var!

I hope you will find this tool as useful as me. If you got questions or problems, dont hesitate to contact me.

Cheers Lars

plg-globalvariables's People

Contributors

echterhoff avatar

Stargazers

Patrick Münster avatar Saurabh Shah avatar

Watchers

James Cloos avatar  avatar

plg-globalvariables's Issues

Dynamic external variable sources

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?

example on multilanguage problems

I created an example at the site:

http://xp.studio-v.biz

Click on reed button "SEE PLANS". All the prices in the price tables use variables as defined in article "variables"

p_economy_en="294"
p_standard_en="442"
p_deluxe_en="589"
p_ecommerce_en="1035"
p_economy_it="299"
p_standard_it lang=it_IT="399"
p_deluxe_it="569"
p_ecommerce_it="989"
p_economy_th="9900"
p_standard_th="14900"
p_deluxe_th="19500"
p_ecommerce_th="34900"
p_cpanel_en = "90"
p_cpanel_it = "90"
p_cpanel_th = "3390"
p_helpdesk_en = "45"
p_helpdesk_it = "39"
p_helpdesk_th = "1590"

and in that case:

p_economy_en="294"
p_standard_en="442"
p_deluxe_en="589"
p_ecommerce_en="1035"

Now please switch language to "Italian" and click on the red button "SOLUZIONI"

The first price in the char uses variable: p_economy_it but you can see... it doesn't show. All variables are available just in EN pages.

I was not sure you understood this issue so I wanted you to know.

Thanks.

Joomla 3.9.10 PHP 7.2

I have installed this plugin and get these error messages when I activate the plugin I Have turned error reporting off as this is an error I am getting with some modules But I still get this error when reporting is switched to none and the errors disappear when I turn off the plugin.

Warning: Illegal string offset 'style' in /home/root/htdocs/libraries/src/Helper/ModuleHelper.php on line 235

Warning: Illegal string offset 'style' in /home/root/htdocs/libraries/src/Helper/ModuleHelper.php on line 252

I have another site which has a similar setup but I was using your plugin prior to upgrading to PHP7.2 and although I had similar errors they disappeared when I turned of Error reporting.

Any thoughts

Syntax issues

Hi there!
Loved your plugin. Really helps me on something I got stuck on.
I have a little problem with using the query tough. I'm not so sure about how to use it, and i'll be glad if you'll answer a few questions.

Let's say I have a php script that goes to the DB and selects a variable and echoes it back. I put it in the root folder of my site and call it "selectDataFromDB.php".
Then I go to "Configure Sources", add a new source (because I don't want it to be a default), give it the alias name "dbQuery", and put in the external link "http://mysite.com/selectDataFromDB.php".

Now I'm not so sure what to do from here:
Do I need to define a new variable in the "Start Editor"? and how my {{}} tag is supposed to look like?

Thanks in advance,
Ronny Orot

How to use?

Here's what I've tried:

I declared a variable:
image

I checked the extension is enabled:
image

I included the variable in the article edit window:
image

On the published page, it just shows {global}currentVersion{/global}:
image

How do I get it to replace the bracketed text with the value of the variable.

I'm using Joomla! 3.10.3 Stable on Ubuntu

Joomla 3.7 crash by activating the plugin

Hi, thanks for your plugin!
But I'm sorry, I don't get this plugin to run. After activating the plugin I'm not able to load the frontend of the website. The following error is shown:
Fatal error: Cannot declare class JDocumentHTML, because the name is already in use in /mnt/web108/a2/75/5511575/htdocs/Joomla3.x/libraries/joomla/document/html/html.php on line 701

I'm not deep enough in Joomla for this I think. Would you please help me? Any idea?

Do not work with themexpert/Quix in backend

Hello,

I just installed the plugin.

When I open QUIX (a themexpert page builder) at the backend
Click to update an Addin, the page is stuck.

Only close window can solve it.

Please advise
Thank you
Udi

Where do you publish variables?

I think I'm missing something... where exactly do/can I put the variables (source)? The instructions say in modules or articles, but they need to be hidden and published, right? I also saw a reference to an ini file, is that required?

What I'm trying to do: I have four custom modules with numbers that need to be updated by a client without giving them access to editing the modules.

Thanks for any clarity you can provide!

Multilanguage

Hi, how do I define variable for multilanguage use, so that Joomla will select the right value for that variable according to language?

Example, I have a variable "name", for English pages it has to be set to "EN" and for Italian to "IT" and so on...

I tried to define

name.en_EN="EN"
name.it_IT="IT" but it doesn't work.

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.