| | |
Repalce content in html??
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 293
Reputation:
Solved Threads: 11
Hi,This is my php file.
I want to replace
$$FullName$$ with Jon Rama
And $$FirstName$$ with Jon and $$Gender$$ with Male
And create to new file Jon_Rama.php
How to do this??
I want to replace
$$FullName$$ with Jon Rama
And $$FirstName$$ with Jon and $$Gender$$ with Male
And create to new file Jon_Rama.php
PHP Syntax (Toggle Plain Text)
<table width="100%"> <tr> <td align="center"> <b> <h1 class="title_list">$$FullName$$</h1> </b> <br><br> </td> </tr> <tr> <td>$$FirstName$$ is a $$Gender$$.</td> </tr> </table>
How to do this??
Last edited by Aamit; Sep 25th, 2009 at 5:39 pm.
If you are trying the process the code as data then you will probably want to use file_get_contents and file_put_contents to read and write the php file as if it were data.
You will then probably want a table of fields to check for and then scan the string read from the file and do a search and replace (str_replace) to substitute the new values.
You will then probably want a table of fields to check for and then scan the string read from the file and do a search and replace (str_replace) to substitute the new values.
php Syntax (Toggle Plain Text)
<?php /* this file is called with url parameters ?firstname=Jon&lastname=Rama&gender=male full_name is a concatenation of firstname lastname */ $full_name=$firstname.'_'.$lastname; $file = $full_name.'.php'; if (file_exists($file)) { die("$file already exists"); } $text="<table width='100%'><tr><td align='center'><b><h1 class='title_list'>$firstname $lastname</h1></td></tr><tr><td>$firstname is a $gender.</td></tr></table>"; $fp = fopen($file, "x"); fputs ($fp, $text); fclose($fp);// Close the file. echo $file.' created'; ?>
If the data comes from a form the $_post array can be mined for data
Last edited by almostbob; Sep 26th, 2009 at 1:33 am.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Similar Threads
- Problems with iterating xml node-set containing html (XML, XSLT and XPATH)
- How to Display the whole content with HTML Formating (XML, XSLT and XPATH)
- How to fill the content with Ajax AFTER page fully loaded (JavaScript / DHTML / AJAX)
- BaseHTTPServer, sending binary content such as images (Python)
- News Story: HTML 5 drafted (Web Development Job Offers)
- HTML display but xml content (HTML and CSS)
- Protect Source Code But Maintain Content Functionality (Windows Software)
Other Threads in the PHP Forum
- Previous Thread: Problem usin <?PhP tag
- Next Thread: Attachment file corrupted in Email
| Thread Tools | Search this Thread |
ajax apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion regex remote script search server session sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validator variable video virus votedown web window.onbeforeunload=closeme; xml youtube






