Search code examples
javascriptjoomlawufoo

How to add javascript in addition to pure text in Joomla Article


More specifically I am trying to implement a wufoo form in a joomla article, but I need to add text, in addition to the code. I tried to just paste the code the article but all I get is the code as text. What am I missing? If it helps I have installed jCode, but I cannot find a way to add text as well in addition to the form. I am open to other ways as well to solve this issue.


Solution

  • Joomla by default doesn't allow you to import code like PHP or Javascript through articles. For this, a plugin need to be used. I see you've tried using jCode, I've never used this before so can't provide any documentation on it.

    I would strongly recommend using Sourcerer as a plugin for importing Javascript and PHP through your articles. It's free, well documented, well supported and easy to use. Once you've installed it, enable the plugin. Then in your article, you can use something like the following:

    {source}
    <script type="text/javascript">
        alert('Hello world');
    </script>
    
    <?php
        echo '<p>Hello world</p>!';
    ?>
    {/source}
    

    There will be a small button under the article textarea for Sourcerer which will bring up a popup window for you to enter all your code in.

    Hope this helps