Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Plain text is adding HTML tags

    hi
    I'm trying to use the plain text for product descriptions and when i preview it; it shows fine, but when i look at my product in the catalog i notice html "<br/>" tags in the description, for every time i pressed enter (it acts like a wysiwyg) so i can not write any script because it keeps on adding unwanted tags

    i'm running 1.3.9, php5, mySql5,
    and I'm hosted by GoDaddy

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Plain text is adding HTML tags

    You haven't said anything about how you're adding this text, but I suspect that what is happening is that Zen Cart is converting the end of line characters in your plain text into <br/> tags.

    It has to really, as the XHTML used to render your plain text in a browser doesn't recognise end of line characters. The XHTML equivalent is a <br/> tag and so is appropriate to substitute, otherwise your entire product description would come out as a single line.

    I'm puzzled by your comment about being unable to write script. Your product descriptions aren't the place for script. Maybe if you could expand on what you're trying to do, we can help more.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: Plain text is adding HTML tags

    Thanks for replying

    I'm entering the characters only myself no pasting or copying
    Ex:
    Code:
    this is text
    this is some more
    should give you "this is text this is some more"
    but it gives you

    "this is text
    this is some more"


    and in the source i can see added <br>tags
    this should not happen in plain text mode

    here is the url of the page
    https://www.voucher-checks.com/compu...lips-p-86.html

    The reason why I need to be able to add client-side scripts like JS or inline CSS is quite simple, i need some java script and css for a few particular pages and not for the whole site

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Plain text is adding HTML tags

    The products_description is managed by:
    Code:
      $products_description = (!preg_match('/(<br|<p|<div|<dd|<li|<span)/i', $product_info->fields['products_description']) ? nl2br($product_info->fields['products_description']) : $product_info->fields['products_description']);
    So if anything is contained in the products_description then the products_description is used, as is ...

    if nothing is in the products_description then the nl2br is adding the line breaks as entered ... in essence the enters you hit in plain text are doing just what you said when you hit enter ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Plain text is adding HTML tags

    Nice job on the site. Very clean and professional looking. Very well suited to the products you're selling.

    You have three options.
    1. You could remove the nl2br function call that Ajeh has highlighted and deal with any fallout elsewhere.
    2. You could selectively remove this function by wrapping it in an if ... else ... statement so that it isn't called for the specific products that you want to handle differently.
    3. You could use the Zen Cart's built-in javascript and css loading. These are documented in detail the respective readme files that come in the docs folder of a Zen Cart download. But in summary you can load css for individual products and javascript for a specific page (so you'd still need an if ... else ... statement if you needed it not to be loaded for other products).
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  6. #6
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: Plain text is adding HTML tags

    thanks you both Ajeh and kuroi

    please bare with me, lets not talk about "valid syntax" for now.
    if i use white space to it should not show in the browser; however in the source code it will. line breaks are not carriage renters in plain text; they are displayed as a single "nbsp" (non breaking space).

    so how can this be? both have the same descriptions
    http://www.aacellphone.com/test-some-stuff-p-133.html

    https://www.voucher-checks.com/compu...lips-p-86.html


    Code:
    non p test: top line
    middle line
    bottom line
    
    <style type="text/css">
    <!--
    @import "https://voucher-checks.com/includes/templates/vc/css/reset_att.css";
    
    -->
    </style>
    and the out put are really different

    the first acts as it should and the second adds 8 break tags and screws up my code

    nl2br is not at fault, or i think so HELP!!

  7. #7
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: Plain text is adding HTML tags

    i checked in the database
    and they both are represented exactly the same
    like this

    (133,1,'test some stuff','non p test: top line\r\nmiddle line\r\nbottom line\r\n\r\n<style type=\"text/css\">\r\n<!--\r\n@import \"https://voucher-checks.com/includes/templates/vc/css/reset_att.css\";\r\n\r\n-->\r\n</style>','',4)

    how come they appear so differently????

  8. #8
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Plain text is adding HTML tags

    One reason is that the Computer Deposit Slips is a product info page, while the 'test some stuff' is a product listing. Zencart strips HTML from the product listing description by default.

    That doesn't explain why the HTML is applied to the description when entered as Plain Text, but my bone-stock test site does the same thing.

  9. #9
    Join Date
    Nov 2009
    Location
    In beautyful New York
    Posts
    160
    Plugin Contributions
    2

    Default Re: Plain text is adding HTML tags

    thanks
    but NO its not a listing

    it looks like a listing because i added an add to cart but its a product info page

    the listing is
    http://www.aacellphone.com/verizon-usb-cards-c-9.html

    the info is
    http://www.aacellphone.com/test-some-stuff-p-133.html

    BTW i do not have problems in the listing, nor do i have any problems when i preview the product in the admin (before updating)

    i have an ugly feeling about it cus 1.3.8 gets it fine and 1.3.9 is giving me problems , the only thing that i added to the voucher-checks site is CKeditor but its terned off and i'm working in plain text mode

    if i add a <p>tag to the description like this
    non p test: top line
    middle line
    bottom line

    <style type="text/css">
    <!--
    @import "https://voucher-checks.com/includes/templates/vc/css/reset_att.css";

    -->
    </style>
    it gets it right
    https://www.voucher-checks.com/test-...uff2-p-87.html

  10. #10
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,024
    Plugin Contributions
    3

    Default Re: Plain text is adding HTML tags

    You're right, sorry.

    Another 'clue' is the fact that looking at the pages using Web Developer, the product description of 'test some stuff' is inside #product_details_wrapper, and the other isn't, so it may be a template thing.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 5
    Last Post: 4 Mar 2011, 03:54 AM
  2. HTML Newsletters arriving as plain text
    By dapottster in forum General Questions
    Replies: 12
    Last Post: 25 Jan 2011, 04:34 AM
  3. HTML Editor preview changes to Plain Text with HTML code
    By Morph99 in forum Basic Configuration
    Replies: 5
    Last Post: 3 Jan 2011, 10:12 PM
  4. Plain text/HTML add text or...
    By Monica79 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 Mar 2009, 06:32 AM
  5. Newsletter arrives as plain text, no HTML
    By OfficeRat in forum General Questions
    Replies: 2
    Last Post: 12 Jan 2007, 06:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR