2

I'm trying to introduce a simple php in a custom html module and it doesn't let me do it.Why?

This is the code:

<p> </p>
< ? php 
   echo " Hello World" . "\n";
?>
  • 1
    You'll need to provide more than just a line of code...what/where is the file, what does "won't let me" mean? An error code, no output, blank screen? – GDP Jan 25 '15 at 15:17
  • While editing the question, I notice that your PHP tag contains blanks - it should be <?php , not < ? php – GDP Jan 25 '15 at 15:22
2

By default, Joomla doesn't allow you to use PHP in the editor. You will need to download a 3rd party extension to allow this feature. I would strongly recommend Sourcerer.

Once installed, simply wrap your code around {source} tags like so:

{source}
<?php
     echo " Hello World" . "\n";
?>
{/source}
  • I have tryed to install Sourcerer and it says it's not compatible :(. So what can I do?. Regards – zoit Jan 25 '15 at 15:43
  • @zoit - As of version 4.4.8, compatibility was removed for Joomla versions under 3.3.0, so please make sure you update your Joomla site to the latest version which is currently 3.3.6. There is no reason why you should ever be on an out of date version when using a STR. If for some reason you are unable to upgrade to Joomla 3.3.6, then you will need to download an older version of Sourcerer: nonumber.nl/extensions/sourcerer#changelog – Lodder Jan 25 '15 at 15:50
  • Yes it's the 3.3.6 right now – zoit Jan 25 '15 at 15:52
  • If that's the case, then there should be no errors messages when trying to install Sourcerer. – Lodder Jan 25 '15 at 15:53
  • It says: This extension is not compatible with PHP 5.3.10-1ubuntu3.15. Need PHP 5.3.13 or higher to install and use this extension. – zoit Jan 25 '15 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.