Jump to content


Photo

just a little script I need.


  • Please log in to reply
6 replies to this topic

#1 Birdman203

Birdman203
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 26 June 2006 - 12:55 PM

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 admin.
2. After that it reads the file and looks for $title and puts it in an array.

The array should look like so:
array (
  1 (
    file -> "name of file",
    title -> "$title from the file"
  )
  2 (
    file -> "name of file",
    title -> "$title from the file"
  )
)

I hope you understand this

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 26 June 2006 - 01:25 PM

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.
Legend has it that reading the manual never killed anyone.
My site

#3 Birdman203

Birdman203
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 26 June 2006 - 02:06 PM

These are .php files and $title is a var.
$title = "Title of the page";

#4 Birdman203

Birdman203
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 26 June 2006 - 08:42 PM

is anyone looking into this?

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 26 June 2006 - 10:19 PM

[!--quoteo(post=388208:date=Jun 26 2006, 04:42 PM:name=Birdman203)--][div class=\'quotetop\']QUOTE(Birdman203 @ Jun 26 2006, 04:42 PM) View Post[/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.
Legend has it that reading the manual never killed anyone.
My site

#6 Birdman203

Birdman203
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 26 June 2006 - 10:56 PM

<?php
$d = 0;
foreach (glob("admin_*.php") as $filename) {
    $arr = array(
        'file' => $filename,
        'title' => "title"
    );
    $array[$d++] = $arr;
}
?>

Tested it and it works. Now how do I do the title.

#7 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 26 June 2006 - 11:53 PM

Look into the function fopen, fread and preg_match.

Were not here to think for you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users