问题
I have successfully installed sourcerer, but the following code in a module doesnt show the expected result (only TEST1 and TESt2 get displayed). What am I missing?
<p>TEST1
{source}
<!--?php echo "My first php snippet";
?-->
{/source}
TEST2
</p>
回答1:
If the article mentioned here is right you need to change
<?php echo "My first php snippet";?>
to
[[?php echo "My first php snippet";?]]
to avoid it being produced as a comment in html
https://www.nonumber.nl/extensions/sourcerer#code-is-stripped-when-i-save-the-article
Maybe the double brackets syntax mentioned in the article is what you need.
If you are just starting out this little "manual" looks handy https://www.nonumber.nl/extensions/sourcerer#php-is-not-working
It also appears that there are options you need to set to allow php among other types of script such as javascript or css: https://www.gavick.com/documentation/joomla/disable-html-filters and https://www.gavick.com/documentation/joomla/templates/customization/custom-javascript-css-php-code
来源:https://stackoverflow.com/questions/34363297/joomla-php-within-sourcerer-not-displayed