SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: .odt to .xhtml

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    288
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    .odt to .xhtml

    Seems to me a sitepoint author (Kevin Yank?) wrote a function that would generate html from a text file looking for "\r" or "\t" or both -- converting them into "<p>" or "<br>" [obviously before xhtml].

    I can't find that function. And, in any case, would like to extend it to handle italics and bold using an OpenOffice text file (.odt) source.

    I know there are "free" converters out on 'net -- but they require email address and cookies permissions -- I'd just as soon not (PRISM not withstanding).

    Anyone got such an animal?

    Regards,

    grNadpa

  2. #2
    SitePoint Addict
    Join Date
    Apr 2011
    Posts
    265
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi
    You can use str_replace() to convert "\r" and "t" into <br/>.
    Example:
    Code:
    $str = "Some tet.\r Other text.\t And so on ...";
    $str2 = str_replace(array("\r", "\t"), '<br/>', $str);
    echo $str2;
    Free: Web Programming Courses HTML, CSS, Flash
    Web Programming: AJAX Course and PHP-MySQL Course video Lessons
    Good JavaScript and jQuery course for beginners


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
  •