Help with a movie library

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
private-eye
Forum Newbie
Posts: 5
Joined: Mon Jan 24, 2005 4:48 pm

Help with a movie library

Post by private-eye »

Hi there guys!
I am very new to PHP, and i keep trying to follow tutorials, but I either loose interest, or dont understand.

For my site I would like to have my swf files in a folder i.e. mysite.com/files/flash/ and i would like to have videos in a different folder i.e. mysite.com/files/vids/ .

Anyway, I would like a php script that displays the names of those files in alphabetical order, with a discription, that links to a php file with the movie in it.

And on the front page i want it to display the 5 newest submittions.

I have no idea where to start and how to do this, can anyone help or point me in any direction, otherwise ill have to manually update it with html :-(

Thanks very much!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

here's how I've done this sort of thing:
  • modify a directory listing function to direct all of them to a script (either 1 for the whole site, or 1 for each image/video/audio type. Personally, I do one file for everything.)
  • use the same directory listing function to find the 5 or less most recently modified files (using filemtime())

opendir() | glob()
private-eye
Forum Newbie
Posts: 5
Joined: Mon Jan 24, 2005 4:48 pm

Post by private-eye »

THANK YOU SO MUCH!!!!

I think I understand this a bit more now :S

Well anyway, thats a great help, thank you so so much!
private-eye
Forum Newbie
Posts: 5
Joined: Mon Jan 24, 2005 4:48 pm

Post by private-eye »

With the

<?php
foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
?>

Thing, how do I make it link to the file?

Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

play with it.. you should figure it out quick.. ;)
private-eye
Forum Newbie
Posts: 5
Joined: Mon Jan 24, 2005 4:48 pm

Post by private-eye »

erm... maybe you could start me off by telling me what a basic hyperlink code is in php ;) I only know html soz.


:)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

echo "your html here.";
:P
private-eye
Forum Newbie
Posts: 5
Joined: Mon Jan 24, 2005 4:48 pm

Post by private-eye »

<html>
<head>
<title></title>
</head>


<body bgcolor="#FFFFFF">
<?php
foreach (glob("*.txt") as $filename) {
echo "<a href="$filename.txt">$filename </a> size " . filesize($filename) . "\n";
}
?>

</body>


</html>


:S well that didnt work.

what did i do wrong?

it says on the page:

"Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in ----------------/text/index.php on line 10"
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

double quotes require escapement when inside another double quote string.

i.e.

Code: Select all

echo "<a href="$filename.txt">$filename";
Post Reply