Birdman203 Posted June 26, 2006 Share Posted June 26, 2006 I need a script and do not know how to make it, but it:1. Searches through a folder and looks for files starting with [b]admin.[/b]2. After that it reads the file and looks for $title and puts it in an array.The array should look like so:[code]array ( 1 ( file -> "name of file", title -> "$title from the file" ) 2 ( file -> "name of file", title -> "$title from the file" ))[/code]I hope you understand this Quote Link to comment https://forums.phpfreaks.com/topic/12934-just-a-little-script-i-need/ Share on other sites More sharing options...
AndyB Posted June 26, 2006 Share Posted June 26, 2006 And are these any particular type of file? .php, .html, .doc, .who_knowsAnd how is '$title' delineated in these files?Please be much more specific. Quote Link to comment https://forums.phpfreaks.com/topic/12934-just-a-little-script-i-need/#findComment-49662 Share on other sites More sharing options...
Birdman203 Posted June 26, 2006 Author Share Posted June 26, 2006 These are .php files and $title is a var.$title = "Title of the page"; Quote Link to comment https://forums.phpfreaks.com/topic/12934-just-a-little-script-i-need/#findComment-49668 Share on other sites More sharing options...
Birdman203 Posted June 26, 2006 Author Share Posted June 26, 2006 is anyone looking into this? Quote Link to comment https://forums.phpfreaks.com/topic/12934-just-a-little-script-i-need/#findComment-49803 Share on other sites More sharing options...
AndyB Posted June 26, 2006 Share Posted June 26, 2006 [!--quoteo(post=388208:date=Jun 26 2006, 04:42 PM:name=Birdman203)--][div class=\'quotetop\']QUOTE(Birdman203 @ Jun 26 2006, 04:42 PM) [snapback]388208[/snapback][/div][div class=\'quotemain\'][!--quotec--]is anyone looking into this?[/quote]Aren't you?The glob() function - with selector - will give you the .php file names. Throw away all those that don't start with admin and put the rest in an array. That'll get you started. Quote Link to comment https://forums.phpfreaks.com/topic/12934-just-a-little-script-i-need/#findComment-49832 Share on other sites More sharing options...
Birdman203 Posted June 26, 2006 Author Share Posted June 26, 2006 [code]<?php$d = 0;foreach (glob("admin_*.php") as $filename) { $arr = array( 'file' => $filename, 'title' => "title" ); $array[$d++] = $arr;}?>[/code]Tested it and it works. Now how do I do the title. Quote Link to comment https://forums.phpfreaks.com/topic/12934-just-a-little-script-i-need/#findComment-49845 Share on other sites More sharing options...
trq Posted June 26, 2006 Share Posted June 26, 2006 Look into the function fopen, fread and preg_match.Were not here to think for you. Quote Link to comment https://forums.phpfreaks.com/topic/12934-just-a-little-script-i-need/#findComment-49868 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.