SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: PHP Templates

  1. #1
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Templates

    I've been looking for a while now and can't find much... I'm making a script that requires a skinning engine, I'd rather not use Smarty or any pre-made scripts - isn't there just a tutorial on how to do it? Do I use tons of replace's?

  2. #2
    SitePoint Wizard Mincer's Avatar
    Join Date
    Mar 2001
    Location
    London | UK
    Posts
    1,140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey thanks, thats very helpful! This: http://www.sitepointforums.com/showt...threadid=98001 was the best

  4. #4
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How does vBulletin turn {this} into "This" ? Thats what I ultimately want to achieve.

  5. #5
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Via the replacements table and code .

    If you really wanted to change {this} into "this", just strip { and }. But I know that's not what you want.

    So.. you're a dev on OYSO's Site Render and you're asking for help? Heh.

  6. #6
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol I knew someone was going to say that This is about the only thing I've never done before I've already written a function that replaces it via ereg_replace but I thought to be a wee bit ineficient...

  7. #7
    SitePoint Addict CeleronXL's Avatar
    Join Date
    Dec 2002
    Location
    United States of America
    Posts
    349
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use preg_replace instead. It's faster.

  8. #8
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I know, considering right there in the PHP manual

    Note: preg_replace(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg_replace().
    I was just testin it along with output buffering.

  9. #9
    SitePoint Wizard Mincer's Avatar
    Join Date
    Mar 2001
    Location
    London | UK
    Posts
    1,140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Surely for a "{this}" to "that" you can just use a str_replace with a couple of arrays. str_replace is more effecient than using regex for simple replacements.

    Matt.


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
  •