SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist stef25's Avatar
    Join Date
    Nov 2004
    Location
    belgium
    Posts
    465
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    tinymce: how to force use of <p> if only one line of text?

    i discovered that if i just enter "test test test" into a basic tinymce textarea, it doesnt store any html in the db. only when i hit enter at the end of a line does it wrap <p> around both sentences. and, if i just paste a block of text in to tinymce (no linebreaks), it doesnt add html markup either

    so i have to tell client to hit enter at the end of any sentence, or the db just returns text with no html markup. i cant use the code below either cause what if they enter two lines? in that case there will be two <p>'s wrapped around the text?

    Code:
    <p><? echo row['text'];?></p>
    anyone know how to get around this?
    I need someone to protect me from
    all the measures they take in order to protect me

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,107
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Include the format selection so the user can select the text and choose if it is a paragraph, Heading 1 etc..

    I wouldn't worry about this personally, I think it's just about learning the tool.

  3. #3
    SitePoint Evangelist stef25's Avatar
    Join Date
    Nov 2004
    Location
    belgium
    Posts
    465
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what do you mean by format selection, are you referring to some of the optional buttons that can be added to the basic installation?

    to ppl like us this is a non issue, but i can just hear the client screaming "this doesnt work" already. this tool is sort of geared toward non tech clients, isnt that the whole point of the tool? I do find it kinda strange it doesnt add any markup at all on just a few words of text (or even one single paragraph), surely thats a bit of a flaw? in modern web dev there should be no such thing as text without proper markup.
    I need someone to protect me from
    all the measures they take in order to protect me

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,107
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Try looking at the valid_elements and extended_valid_elements option in the configuration

  5. #5
    SitePoint Evangelist stef25's Avatar
    Join Date
    Nov 2004
    Location
    belgium
    Posts
    465
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually, this is exactly what i need. it creates a p as soon as you start typing something. ill checkout your links too though, thanks
    I need someone to protect me from
    all the measures they take in order to protect me

  6. #6
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,107
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    I'll keep that one in mind, thanks for the link


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
  •