Post by Ariskos » Sat Nov 03, 2012 2:59 am

Hello,
I am building an extension and I want to ask:
I have a "description" field where I want to appear the description of a note. The description variable is stored in the database with its html tags for bold, paragraphs, etc.
What is happening now:
It appears the text of the decription with the html tags, so as a result I take "This is a <b>description</b>"
What I want is:
I want the printed result to be without the html tags but the tags to be applied in the description like this: "This is a description"
And ofcourse this goes further with all tags (b, p, img, links etc.)
Any help on how to do this?
Last edited by Ariskos on Fri Nov 09, 2012 3:14 am, edited 1 time in total.

Web Developer specialized in Opencart. Visit my extensions:
(1)SKU Generator 1.5.x / (2) Opentasks


User avatar
New member

Posts

Joined
Wed Jun 08, 2011 9:28 pm
Location - Athens

rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Ariskos » Sat Nov 03, 2012 6:52 pm

I don't want to just remove the html tags.
I want them to be applied but not be visible.
So as I said I want this: "This is a description with the word description in bold" and NOT this: "This is a <b>description</b> with the word description in bold"

Web Developer specialized in Opencart. Visit my extensions:
(1)SKU Generator 1.5.x / (2) Opentasks


User avatar
New member

Posts

Joined
Wed Jun 08, 2011 9:28 pm
Location - Athens

Post by labeshops » Sat Nov 03, 2012 7:26 pm

Are you writing this in the description field of the product or category?

If so, select all text and codes you have now, cut it. Click on "Source" and paste it. Save. Source is the source code for that section which is where you can enter codes so they are parsed correctly.

Running Opencart v3.0.3.2 with multi-stores and the default template from https://www.labeshops.com which has links to all my stores.


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by rph » Sun Nov 04, 2012 2:50 am

Ariskos wrote:
I don't want to just remove the html tags.
I want them to be applied but not be visible.
I don't understand what that means. As long as you're properly outputting HTML/XHTML this should always happen.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Ariskos » Fri Nov 09, 2012 2:58 am

Ok, let me explain it further using steps:
1) In the input textarea, I write the description where I use the CKEDITOR.
2) Then I insert that description into the database using the escape function (which makes use of the mysql_real_escape_string function). So in the database, the description is stored in the following form ( I am using utf8_general_ci for that field):

Code: Select all

<p>This is a <strong>description</strong></p>
3) And I appear that description in the admin panel which is shown as:
<p>This is a <strong>description</strong></p>

BUT what I want is the html tag to be applied in the description and instead of the above line I want to take the line below:
This is a description (<-- where the <strong> tag is already applied)

What makes tags to appear as text instead of being applied to the strings?

Web Developer specialized in Opencart. Visit my extensions:
(1)SKU Generator 1.5.x / (2) Opentasks


User avatar
New member

Posts

Joined
Wed Jun 08, 2011 9:28 pm
Location - Athens

rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Ariskos » Fri Nov 09, 2012 3:13 am

Thanks for the quick respone, indead I had to pass the string through html_entity_decode function before appearing it.
Topic solved.

Web Developer specialized in Opencart. Visit my extensions:
(1)SKU Generator 1.5.x / (2) Opentasks


User avatar
New member

Posts

Joined
Wed Jun 08, 2011 9:28 pm
Location - Athens
Who is online

Users browsing this forum: No registered users and 195 guests