Reply
Select certain part of code
Old 05-26-2008, 06:44 PM Select certain part of code
Gilligan's Avatar
Dead Like Me

Posts: 1,608
Name: Stefan
Location: London, UK
Going to start using fopen(), fwrite() etc. to help people edit their files on their sites.

Its going to show different areas of the file in textboxes, so the user can change them, and click 'save'

How do I select a certain portion of the file (code) to display in these textboxes?
Gilligan is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 05-26-2008, 07:50 PM Re: Select certain part of code
rogem002's Avatar
Webmaster Talker

Posts: 576
Name: Mike
Location: United Kingdom
Preg_Match would be the best way.
http://uk.php.net/manual/en/function.preg-match.php
PHP Code:
<?php
$subject 
"abcdef"// this would be the file contents
$pattern '/^somethingthatmakesyoucodestandout/';
preg_match($pattern$subject$matchesPREG_OFFSET_CAPTURE);
print_r($matches);
?>
Hope this helps

Also, take a look at file_put_contents ( http://uk.php.net/manual/en/function...t-contents.php ) it saves a bit of coding time.
__________________
Website Services
PHP Code:
if(Added_Talkupation($post) == TRUE){iHug($you);} 
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 05-27-2008, 06:28 AM Re: Select certain part of code
Gilligan's Avatar
Dead Like Me

Posts: 1,608
Name: Stefan
Location: London, UK
Thanks, but what if its not always the same thing inside the div. As this part will be always changing
Gilligan is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Select certain part of code
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12150 seconds with 13 queries