PHP-Code in Joomla Content

  • how to write php code in joomla

Joomla is great for building all kinds of cialis canadian pharmacy websites, but I find that the real power of the position of mix and match PHP / MySQL code with the rest of the Joomla code does.

There are many ways to do this:

1st If you want it the right way, then you can always  write a custom module or component. A module is not that difficult, but a component is a bit of a different story. I will not comment on how to write a component here, since the focus of this entry is rather a quick and dirty!

I have seen this extension to the Joomla site:
It is a developer toolkit for Joomla, that among other things, “boiler plate creates components” – check it out in these days and write some feedback.

2nd You can use the static component files. I have this in great detail about some of my pages, and it works quite well.

You can download it and http://www.joomlaxt.com/ The author has a bit that will help you go with it should be written. You can find it on this link.

Update: 26 January 2008: I do not use them at all anymore, but KL_PHP, as described below.

3rd But here’s the trick! The best way to do “quick and dirty” PHP programming in Joomla Mambot is this: Use KL_PHP. This plugin will not be publicly available, but more can be downloaded here KL_PHP Mambot.
You also can not use this bot is not directly into modules for which you need the module: mod_kl_evalphp.zip
Now, I realize that there are other options by now, as commented below but that has worked very well for me until now so I’m not really interested at this time to try something different!

4th Here are my tips are to get the best out of it:

o First, do not even try and use it if your WYSIWYG editor to have. The WYSIWYG editor is destroyed, your code, you can never be sure that its the code that you entered so painstakingly still there after you have saved it. You must have your WYSIWYG OFF when you open it in any quarter.
o Then make sure that the mambot is actually published!
o I am running the Joomla ‘Static Pages “for almost all of my PHP code. Since they do not own any categories, making it easy, just create a page and refer directly to him.
o I either s404SEF or OpenSEF, all my static pages are beautiful names like “/ select-item.html ‘, or’ / display-pics.html”. You can now do the following directly into your pages:
<form action = http://www.yoursite.com/some-page.html action = post>

<input type = “text” size = “20” name = “invoice_id”>

<input type = “submit” value= “submit”>

</form>

You can then select a “Static Page ‘. Make the name and title of both” some page “and link it to a menu item” Some Page’. I normally use the Othermenu or user menu for this type of pages to be published for testing purposes. Their “Some Page ‘page with your kl_php mambot will be as follows:

{ kl_php}

$inv_num = $_POST[‘invoice_id’];

and so on …ending with

{ /kl_php }

Here are a few power tips:

* You can have several () kl_php … (/) Kl_php combinations by your side, but if you want to refer to $ inv_num, as in the example above, then in your page to another () kl_php … (/ Kl_php) block, you must declare it as a world first, in the other two or it is not the value you originally allocated, it will be regarded as a new variable.
* Apart from that, you can also other PHP files in your () kl_php … (/ Kl_php) block. This is very powerful, because if you do not want to be bothered to write the PHP code into your Joomla content, you can use it as an external PHP files and just write the PHP files. For maintenance purposes, this might be better off if something happens to your Joomla install your PHP code will be gone!
* Please note: For security purposes, always include an analysis at the beginning of the file to ensure that the included file from the Joomla ENVIRONMENT is called. For example, make sure you include the following line at the beginning of your PHP code:
defined (‘_VALID_MOS’) or die (‘Restricted access’);

* You can print output directly to the front end with ‘echo’ and ‘print’ – at least in all cases that I have used it. In some of the earlier postings, it is determined that you ‘Return’ to issue all use values on the front end, but I have not found that the case any more.
* In my recent use of the mambot, I have even found that it is possible to arrange meetings. It is possible, therefore, very complex application code directly into your Joomla content by passing parameters through forms and conventions.

This is just a quick write-up of the essential functions of this major expansion – more questions, just write a comment or drop me an e-mail and I’ll see if I can elaborate.

Comments Closed