Jump to content
Updating IPB tonight Read more... ×

Archived

This topic is now archived and is closed to further replies.

Birdman203

just a little script I need.

Recommended Posts

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

Share this post


Link to post
Share on other sites
And are these any particular type of file? .php, .html, .doc, .who_knows

And how is '$title' delineated in these files?

Please be much more specific.

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites
[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.

Share this post


Link to post
Share on other sites
Look into the function fopen, fread and preg_match.

Were not here to think for you.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.