SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: CMS Help

  1. #1
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am building a cms for a client and i need some advice

    i have used htmlspecialchars so that it dosen't output the html

    HOWEVER, is there a way to be able to execute html just inside a html tag?

    i.e

    HTML Code:
    <font face=verdana>
    cheers
    Alex
    Nearly 7 years old!

  2. #2
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Heh... funny you should mention this. I just finished implementing this feature in SitePoint's CMS yesterday. I can't give away the code, but I'll give you some hints.

    It involved the use of preg_match() (Perl-style regular expressions, which allow you to use non-greedy modifiers and have your matches span linebreaks (e.g. "/.*?[html].*?[\/html].*/s") in a while loop.

    Go nuts!
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  3. #3
    SitePoint Evangelist AlexC's Avatar
    Join Date
    Oct 2000
    Location
    Sheffield, UK
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, that was like french to me (i can understand some of it )

    Thanks Anyway
    Alex
    Nearly 7 years old!

  4. #4
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Read up on the preg functions and Perl Regular Expressions to get started.
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  5. #5
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.jrap.org/source/htmlreplace.txt
    That is the code I hope you are looking for. There probably is a more efficient way of doing this task, but I couldn't think of one. Too bad there is no reverse to htmlspecialchars().

    I was going to post the code here, but the [ php ] and [ code ] are pieces of ****, and kept on screwing up the code.

    Hope that helps


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
  •