Forum Moderators: coopster

Message Too Old, No Replies

Replacing sentence on html with php

How to replace words on html page with php

         

AlexB77

3:53 pm on Feb 14, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



HI Guys,

I have concerns about one thing that does not let me sleep any more.

I have a standard html page with terms of use for the certain list of products.

Now the question is: instead of creating a separate html (terms of use page) file for each of the products that have exactly identical terms of use, how can I replace the name of the product with actual name?

for example if I have a sentence on my html page like the one below:

BY USING THIS [Name of Software] software and so on .....

I have seen it done with link like this:

[yousite.com...] Name of software

I can not understand the process in the (softwaretitle) file and not sure whether it is php at all or not.

Can someone out there give me a little advise please?

Thanks to all of you in advance

AlexB77

4:05 pm on Feb 14, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month


HI Guys,

I have concerns about one thing that does not let me sleep any more.

I have a standard html page with terms of use for the certain list of products.

Now the question is: instead of creating a separate html (terms of use page) file for each of the products that have exactly identical terms of use, how can I replace the name of the product with actual name?

for example if I have a sentence on my html page like the one below:

BY USING THIS [Name of Software] software and so on .....

I have seen it done with link like this:

yousite.com/EULA_commercialuse.html?softwaretitle=Real Name of software

I can not understand the process in the (softwaretitle) file and not sure whether it is php at all or not since it does not have any extension.

Can someone out there give me a little advise please?

Thanks to all of you in advance

rocknbil

5:04 pm on Feb 14, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's a lot of ways to do this, the simplest would be to use a delimited placeholder within a plain text file.

|THIS-SOFTWARE|

then read in the text file and use st_replace or preg_replace to swap out the placeholder with the item's value.

AlexB77

5:26 pm on Feb 14, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thank for you reply.

Since it is all very new for me I can not really understand it>

any chance of getting a little code that can help me with my problem

Thanks again

AlexB77

6:36 pm on Feb 14, 2011 (gmt 0)

10+ Year Member Top Contributors Of The Month



<?php
$file_code = filter_input( INPUT_GET, 'softwaretitle' );
echo ($file_code);
?>

I think I have done it myself unless someone can suggest to do it in any better way

rocknbil

6:03 pm on Feb 15, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ha! Simple and perfect. :-)