Here are some simple examples of how to place code with Sourcerer.
HTML tags
{source}<span style="color:red">This text should be red!</span>{/source}
This text should be red!
HTML tags (with double square brackets)
If your editor has problems saving tags entered in the WYSIWYG view, and strips these upon saving, then you can use the double bracket syntax for tags.
So [[tag]]
instead of <tag>
.
{source}[[span style="color:red"]]This text should be red![[/span]]{/source}
This text should be red!
JavaScript
{source} <script type="text/javascript"> document.write('This text is placed through <strong>JavaScript</strong>!'); </script> {/source}
PHP
{source} <?php echo 'This text is placed through <strong>PHP</strong>!'; ?> {/source}
This text is placed through PHP!
Combined (HTML, JavaScript and PHP)
{source} <span style="color:red">This text should be red!</span> <br /> <script type="text/javascript"> document.write('This text is placed through <strong>JavaScript</strong>!'); </script> <?php echo '<p>'; echo 'This text is placed through <strong>PHP</strong>!'; echo '</p>'; ?> {/source}
This text should be red!
This text is placed through PHP!