1

I have a module that gets the HTML written by the user on the backend, and the module should retrieve this HTML string and render it on the page, but instead it's printing the HTML string instead of rendering it.

So, I load my module in a specific page and in a specific position, and it should render the HTML, but instead it's just printing the string.

Here is my code:

mod_publicidade.php

<?php

defined('_JEXEC') or die;

$html = $params->get('html');

tmpl/default.php

<?php

defined('_JEXEC') or die;

echo $html;

mod_publicidade.xml

<?xml version="1.0" encoding="utf-8"?>
<extension
    type="module"
    version="3.1"
    client="site"
    method="upgrade">
    <name>Publicidade</name>
    <author>Roger</author>
    <creationDate>2015</creationDate>
    <copyright>Copyright (C) 2015 All rights reserved.</copyright>
    <license>GNU General Public License</license>
    <authorEmail>my@email.com</authorEmail>
    <authorUrl>www.rogcg.com</authorUrl>
    <version>1.0.0</version>
    <description>Criar página de publicidade.</description>
    <files>
        <filename module="mod_publicidade">mod_publicidade.php</filename>
        <folder>tmpl</folder>
        <filename>mod_publicidade.xml</filename>
    </files>

    <config>
        <fields name="params">
            <fieldset name="basic">

                <field name="html" type="textarea" rows="10" cols="30" filter="raw"/>

            </fieldset>

        </fields>
    </config>
</extension>
1

There is nothing wrong with the plugin itself, apart that you are not actually calling the template:

require JModuleHelper::getLayoutPath('mod_publicidade');. 

From what you are describing, the HTML is probably not properly saved in the database, maybe a HTML filter.

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.