Search
Other Sourcerer questions
Forum

Styling not working

dimitski dt's Avatar dimitski dt
Hello, could you please help me find out the reason why styling is removed from my {srouce} code.
I have used the following in an article in Joomla 4.4.1 running PHP 8.2.0
{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}

but get no styling in the back nor in the front end

This text should be red! document.write('This text is placed through JavaScript!'); This text is placed through PHP!

If I use the </Code> editor of RL in the article and do "Insert" the following conent is created

{source}<span style="font-family:monospace;color:#555555;"><span style="color:#117700;">&lt;span style="color:red"&gt;</span>This text should be red!<span style="color:#117700;">&lt;/span&gt;</span><br><span style="color:#117700;">&lt;br /&gt;</span><br><span style="color:#117700;">&lt;script type="text/javascript"&gt;</span><br><img src="/media/sourcerer/images/tab.svg">document.write('This text is placed through <span style="color:#117700;">&lt;strong&gt;</span>JavaScript<span style="color:#117700;">&lt;/strong&gt;</span>!');<br><span style="color:#117700;">&lt;/script&gt;</span><br><span style="color:#0000cc;">&lt;?php<br><img src="/media/sourcerer/images/tab.svg">echo '<span style="color:#117700;">&lt;p&gt;</span>';<br><img src="/media/sourcerer/images/tab.svg">echo 'This text is placed through <span style="color:#117700;">&lt;strong&gt;</span>PHP<span style="color:#117700;">&lt;/strong&gt;</span>!';<br><img src="/media/sourcerer/images/tab.svg">echo '<span style="color:#117700;">&lt;/p&gt;</span>';<br>?&gt;</span></span>{/source}

The above code displays correct with the styling (bold, colour) in the front end but is completely undreadble and hard to mainting.

Could you pleae help.

Thank you!
Peter van Westen's Avatar Peter van Westen ADMIN
Sourcerer is to be used with a wysiwyg editor. So not in the code view.

See: docs4.regularlabs.com/sourcerer/going-fu...ing-a-wysiwyg-editor
Please post a rating at the Joomla! Extensions Directory
dimitski dt's Avatar dimitski dt
Hi Peter!

Just wanted to say thank you.
Using the appropriate attribute solved my issue.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription