SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,939
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    print(ereg_replace($term, "<b>$term</b>", $main2[synopsis]));

    Okay. This is what I'd like. The problem is I'm having trouble with the middle arguement.

    I do it like above and it doesn't utilize the term variable like I want it to. I remove the quotes I get a parse error, single quotes parse error, just quote the bold tags - parse error.

    Any ideas?

    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm....

    I tried this and it worked perfect.
    $str["synop"] = "This is a very old house";
    $term = "old";
    print ereg_replace($term, "<b>$term</b>", $str["synop"]);


    It printed This is a very old house.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    Non-Member
    Join Date
    Apr 2000
    Location
    Waco, Texas.
    Posts
    188
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Add quotes around "$term"
    print(ereg_replace("$term", "<b>$term</b>", $main2[synopsis])); worked for me.


  4. #4
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,939
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    adding quotes around term does this.


    this is a very $term house.

    but I'll try what freddy did... specifically with the added quotes inside the array

    yup freddy's way worked
    <Edited by aspen on 01-16-2001 at 09:33 AM>
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums

  5. #5
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What Rob said should produce something rather than $term eh?
    It's double quote right? PHP should manipulate the inside var!

    Btw, using str_replace is faster in this situation.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy


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
  •