Irish SEO,  Marketing & Webmaster Discussion
 
Chitika Malls
 

Go Back   Irish SEO, Marketing & Webmaster Discussion > Webmaster Help > Coding Help


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 16-02-2008, 04:28 PM
babyboy808's Avatar
Wannabe Geek
Recent Blog: teh-C peng
 
Join Date: Jan 2007
Location: Laois
Posts: 257
babyboy808 will become famous soon enough
Send a message via Skype™ to babyboy808
Default Question How do I insert data into a file?

Hi,

I have run into another small problem transferring data into an open file.

Basically it's like this:
  1. I have a string of text I would like to insert into another php file at a desired part.
  2. I open the requested file.
  3. I can use fwrite to insert the data, but this overwrites the whole template. (All I want is to add my little string of text into a certain part of the template.)
Example of where I want the string to be inserted:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <link rel="stylesheet" type="text/css" href="../../elements/css/main.css">
      <title>Template</title>
</head>

<body>   

<div id="wrapper">

      <h1>Heading</h1>      
      
      <?php echo $myString; ?>    <---- HERE
      
</div>

</body>
</html>
Thanks as always,
Keith
Reply With Quote
  #2 (permalink)  
Old 16-02-2008, 06:40 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 1,923
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

you need to create a mark and using str_replace should do the job.

mark on the page
<!--text_here--><!--end_text-->
then look for it and replace it with the content from the text file.
__________________
:. Web Design & Development Web Design Ireland
:. Search Engines Optimization Search Engines Optimization
:. Directory Submission Directory Submission
:. News & Press Release Ireland GiveItSocks.com
:. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories
:. I Have 2 Find It Directory SEF Directory
Reply With Quote
  #3 (permalink)  
Old 16-02-2008, 06:44 PM
babyboy808's Avatar
Wannabe Geek
Recent Blog: teh-C peng
 
Join Date: Jan 2007
Location: Laois
Posts: 257
babyboy808 will become famous soon enough
Send a message via Skype™ to babyboy808
Default

Quote:
Originally Posted by louie View Post
you need to create a mark and using str_replace should do the job.

mark on the page
<!--text_here--><!--end_text-->
then look for it and replace it with the content from the text file.
Perfect! - thanks a million Louie
Reply With Quote
  #4 (permalink)  
Old 16-02-2008, 06:45 PM
louie's Avatar
Senior Member
 
Join Date: Jan 2006
Location: Dublin, Ireland
Posts: 1,923
louie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud oflouie has much to be proud of
Send a message via Yahoo to louie Send a message via Skype™ to louie
Default

no problem. U more than welcome.
__________________
:. Web Design & Development Web Design Ireland
:. Search Engines Optimization Search Engines Optimization
:. Directory Submission Directory Submission
:. News & Press Release Ireland GiveItSocks.com
:. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories
:. I Have 2 Find It Directory SEF Directory
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
File Storage & API recommendations Cormac Webmaster Discussion 4 15-02-2008 11:44 AM
General Blog questions & BLOG URL SEO question. Help Please? :-) Gman290 Search Engine Optimisation 4 07-12-2007 10:24 AM
Wordpress .htaccess file for no-www and mod-rewrite() Cormac Blogs & Blogging 9 20-03-2007 08:31 AM


All times are GMT +1. The time now is 04:46 AM.


Powered by: vBulletin Version 3.7.2, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.

Search Engine Friendly URLs by vBSEO 3.2.0

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 50 51 52 53 54 55 56