+ Reply to Thread
Results 1 to 12 of 12

Thread: Replace words on a php page
      
   

  1. #1
    Antonio878's Avatar
    Antonio878 is offline Master Sergeant
    Join Date
    Sep 2007
    Posts
    68

    Question Replace words on a php page

    Can someone help me, i want a code that will automatically change words on the page like for example if i have kewl i want to be able 2 change all the words kewl to fool. I want to do something like that and it will replace on the kewls on the page and replace them as fool.

    So can someone help, Thank You

  2. #2
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,354

    Default Re: Replace words on a php page

    I have a program that does that.. but not a CODE. Not sure what purpose you want that done for.. but if you want something that changes each time its viewed try looking for "print praise" or a java script

    Karen

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  3. #3
    Andy128's Avatar
    Andy128 is offline Major General
    Join Date
    Dec 2005
    Location
    Michigan
    Posts
    2,322

    Default Re: Replace words on a php page

    Antonio- do you have an example? A little more explaination might help.

    Andy
    PHP- is a blast!

  4. #4
    Antonio878's Avatar
    Antonio878 is offline Master Sergeant
    Join Date
    Sep 2007
    Posts
    68

    Default Re: Replace words on a php page

    Quote Originally Posted by Andy128 View Post
    Antonio- do you have an example? A little more explaination might help.

    Andy
    Ok here is 1, u know emotions on sites and when they put :) then it automatically changes to the smile face emotion when the post is made on the site.

  5. #5
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,354

    Default Re: Replace words on a php page


    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  6. #6
    Antonio878's Avatar
    Antonio878 is offline Master Sergeant
    Join Date
    Sep 2007
    Posts
    68

    Default Re: Replace words on a php page

    Quote Originally Posted by Karen Mac View Post
    Thats only xanga chat rooms and thats it u can't use it on a webpage itself only xanga

  7. #7
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,354

    Default Re: Replace words on a php page

    So Google for another one. What do you want for free? Im sure they are out there.

    Karen

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  8. #8
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,060

    Default Re: Replace words on a php page

    You need to read the page code and then replace the original words.

    Usually you work like this:

    <?
    $url = "http://www.yourdomain.com/originalpage.html"; // The original page
    $string = file_get_contents($url);
    $pattern = " kewl ";
    $replacement = " fool ";
    $string = str_replace($pattern, $replacement, $string);
    // At this point ALL occurences of the word "kewl" are replaced
    echo $string; // This will output the new page to the browser.
    ?>
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  9. #9
    marsus is offline Private
    Join Date
    Jun 2009
    Posts
    2

    Default Re: Replace words on a php page

    Quote Originally Posted by navaldesign View Post
    You need to read the page code and then replace the original words.

    Usually you work like this:

    <?
    $url = "http://www.yourdomain.com/originalpage.html"; // The original page
    $string = file_get_contents($url);
    $pattern = " kewl ";
    $replacement = " fool ";
    $string = str_replace($pattern, $replacement, $string);
    // At this point ALL occurences of the word "kewl" are replaced
    echo $string; // This will output the new page to the browser.
    ?>
    I tried to replace " Link#1 " with " Play " and saved it in a php file but it is not working.any help? (you can find Link#1 by clicking on a game )

    <?
    $url = "http://www.livescorehunter.com/Live-Streaming-Video/P2P-Links/"; // The original page
    $string = file_get_contents($url);
    $pattern = " Link#1 ";
    $replacement = " Play ";
    $string = str_replace($pattern, $replacement, $string);
    // At this point ALL occurences of the word "kewl" are replaced
    echo $string; // This will output the new page to the browser.
    ?>

  10. #10
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,060

    Default Re: Replace words on a php page

    These are Joomla pages, with content directly taken from the database. It can't work with such pages.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  11. #11
    marsus is offline Private
    Join Date
    Jun 2009
    Posts
    2

    Default Re: Replace words on a php page

    Quote Originally Posted by navaldesign View Post
    These are Joomla pages, with content directly taken from the database. It can't work with such pages.
    ah thanks.yes they are joomla Pages but what i dont understand is what do you mean by " with content directly taken from the database " ? they add Links from the database?

  12. #12
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,060

    Default Re: Replace words on a php page

    Joomla content is generated directly from content stored in the database.
    It is output to the browser at the moment of request. So simply fix your page to have the wording / linking you want.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49