PHP variable will not store html tags in Sourcerer
Moderators: pe7er, General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sun Mar 15, 2020 7:03 am
PHP variable will not store html tags in Sourcerer
I have been trying to set a php variable with some html code in it in an article and it gets stripped out as I have tested the length. A very simple example is:
$test = '<b>Some text</b>';
echo $test . strlen($test);
All I get back is Some text, not bolded, and with length of 9. I have searched in vain to find an answer but unsuccessful. I am sure there is a simple solution. Hopefully someone can help.
$test = '<b>Some text</b>';
echo $test . strlen($test);
All I get back is Some text, not bolded, and with length of 9. I have searched in vain to find an answer but unsuccessful. I am sure there is a simple solution. Hopefully someone can help.
Last edited by toivo on Tue Nov 29, 2022 8:42 pm, edited 3 times in total.
Reason: mod note: moved from 3.x General Questions, retitled
Reason: mod note: moved from 3.x General Questions, retitled
-
- Joomla! Hero
- Posts: 2902
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: PHP variable will not store html tags
Not reproducible. This need more context.
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sun Mar 15, 2020 7:03 am
-
- Joomla! Hero
- Posts: 2902
- Joined: Fri Jul 05, 2013 10:35 am
- Location: Parts Unknown
Re: PHP variable will not store html tags
Still not reproducible. strlen($test) returns 16 https://3v4l.org/c1q42.
- Webdongle
- Joomla! Master
- Posts: 44088
- Joined: Sat Apr 05, 2008 9:58 pm
Re: PHP variable will not store html tags
When you 'inspect' the front end what do you see?
I see comment tags added to the code when placed in an Article.
I see comment tags added to the code when placed in an Article.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Fledgling
- Posts: 3
- Joined: Sun Mar 15, 2020 7:03 am
Re: PHP variable will not store html tags
I have provided more information which hopefully helps. Below is the code which I have inserted in an article:
{source} <?php
//
defined('_JEXEC') or die;
//
$item1Content = 'Test <b>string</b>';
echo 'Test string is: ' . $item1Content . ', Length is: ' . strlen($item1Content);
?>{/source}
How it appears is in the image. Note that the word string is not bolded, and length is 11.
We are using Joomla 3.9.28, RocketTheme Callisto template, and php 7.4.33.
{source} <?php
//
defined('_JEXEC') or die;
//
$item1Content = 'Test <b>string</b>';
echo 'Test string is: ' . $item1Content . ', Length is: ' . strlen($item1Content);
?>{/source}
How it appears is in the image. Note that the word string is not bolded, and length is 11.
We are using Joomla 3.9.28, RocketTheme Callisto template, and php 7.4.33.
You do not have the required permissions to view the files attached to this post.
- toivo
- Joomla! Master
- Posts: 17435
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: PHP variable will not store html tags in Sourcerer
Moved this topic to 3.x Extensions sub forum because of Sourcerer.
If you have a Pro subscription, post the issue to the Regular Labs support forum.
If you have a Pro subscription, post the issue to the Regular Labs support forum.
Toivo Talikka, Global Moderator
- Webdongle
- Joomla! Master
- Posts: 44088
- Joined: Sat Apr 05, 2008 9:58 pm
Re: PHP variable will not store html tags in Sourcerer
Tried with sorcerer
Tested with fresh Joomla with sample data default Protostar TemplateYou do not have the required permissions to view the files attached to this post.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".