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";
?>
2
  • 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? Commented Jan 25, 2015 at 15:17
  • While editing the question, I notice that your PHP tag contains blanks - it should be <?php , not < ? php Commented Jan 25, 2015 at 15:22

1 Answer 1

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}
10
  • I have tryed to install Sourcerer and it says it's not compatible :(. So what can I do?. Regards Commented Jan 25, 2015 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 Commented Jan 25, 2015 at 15:50
  • Yes it's the 3.3.6 right now Commented Jan 25, 2015 at 15:52
  • If that's the case, then there should be no errors messages when trying to install Sourcerer. Commented Jan 25, 2015 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. Commented Jan 25, 2015 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.