Urdu English
English English Deutsch Deutsch Español Español Français Français Italiano Italiano Nederlands Nederlands Português Português Русский Русский Ελληνικά Ελληνικά
Login



 
Welcome to Jumi! >> Tutorial >> Basic Jumi demo

Here you will find a few basic examples of Jumi plugin usage: including very simple script files and using Jumi arguments.

Jumi module usage is the same with an exception of parameters that are set up in an admin interface of the module. Jumi simple module live examples can be seen throughout this site: all adds are made by Jumi.

PHP code - jumi_demo.php - with arguments

Let us show the result of jumi_demo.php script introduced in Jumi usage article.

If you write into the article the following code ...

{jumi [pathname_to_jumi_demo.php] hello[Hello world!] and again[Hello!]}

... it gives:

jumi_demo.php output:

Hello in the world of Jumi!

This is the default Jumi demo file "jumi_demo.php".

For quick introduction to Jumi read Concise guide to Jumi.

The real strength and great flexibility of Jumi lies in its ability to pass practically any number of argument values into your php scripts very easily. Values can be referrenced by $jumi[] array in your code.

Your current content of $jumi[] array is:

  • $jumi[0] = Hello world!
  • $jumi[1] = Hello!

Note please that everything outside the brackets is omitted at the output. It can be useful for your notes - reminders. For Jumi module applies the same (although there is a notepad too).

When you give the same jumi_demo.php another set of arguments e.g.:

{jumi [pathname_to_jumi_demo.php] [1.235][<i class="info">This is info</i>]}

... the output is:

jumi_demo.php output:

Hello in the world of Jumi!

This is the default Jumi demo file "jumi_demo.php".

For quick introduction to Jumi read Concise guide to Jumi.

The real strength and great flexibility of Jumi lies in its ability to pass practically any number of argument values into your php scripts very easily. Values can be referrenced by $jumi[] array in your code.

Your current content of $jumi[] array is:

  • $jumi[0] = 1.235
  • $jumi[1] = <i class=info>This is info</i>

Notice that the second argument is injected into your pages "as is" and interpreted by the browser as expected.

There can be unlimited (yeh - within limits of computer memory or disk space) number of Jumi arguments. An argument can contain whatever you can write with your keyboard. Jumi takes an argument as a text and fills with it content of the $jumi[] array elements. PHP interprets the content of a variable (here array element) sometime as number sometime as text - read PHP manual for details.

Static html script

So let us see the first demo. Lets try to include into Joomla! static html script. For example

<p>This is my html test.</p>

You can copy paste the code above into your favorite text editor and save it under a name test1.html. Upload it into your server into some directory.

Then open any Joomla! article. In an appropriate place write a Jumi plugin command

{jumi [pathname_of_test1.html]}

Should you do not know what pathname means read Jumi usage manual once again please.

Save the article. Go to the Joomla! frontend and navigate with your browser to the article you have just edited. If you have the article opened before its editing just refresh the browser window to see the changes.

You should see something like this

test1.html output:

This is my html test.

Notice please that there is no html header tag in test1.html. Jumi includes files into Joomla! html body. So no header tags please! in your scripts. If you want to include complete html pages (that means pages with head, body tags) you can include them via Jumi as well. It will be demonstrated in an another tip - trick article.

Notice too that html page you have included inherits css styles from Joomla! template.

That does not mean that you cannot include via Jumi css or js files into the page header. It is possible. But it is not a feature of Jumi but your smart scripting.

I will not repeat previous and detailed step by step procedure (copy - paste - save etc) in the following. Rather will concentrate on content and calling of the scripts.

Other filetypes

Besides including html and php scripts Jumi can include any file that is stored on your server. You can try *.css, *.javascript, *.txt files. But bear in mind Jumi is not clever and cannot decide itself whether its effort - file inclusion - makes sense. The mental work is up to you.

Summary

In this demo you could see basic Jumi features: it can include different file types into Joomla!. If the included file is a php file it can pass into it an arbitrary number of arguments very easily.