Results 1 to 5 of 5

Thread: A script that gets?

  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default A script that gets?

    I'm not too sure where to begin, I have very limited knowledge of web design, and virtually no experience with php... I have an intranet set up in my house for me and my five room mates, and I have ripped our combined DVD collections to avi. I also have a LAMP set up, and so I am building a simple web site that my room mates and I can access that will stream our movies and tv shows from a central server. This makes storage a lot easier, but the web page that I have built is tedious to manage.

    On my page I have links to the various videos, and they load new html pages with the videos as embeds which play through Divx Web Player; which streams our avi's perfectly. The problem is that every new video I add (which is a lot) has to have its own html page set up. This can be a pain, especially with just over six hundred individual videos.

    Is there a way to make this more automated? My code for the embedded videos looks like this, for example:

    Code:
    <embed type="video/divx" src="http://empire/Cannibal/Movies/The Age of Stupid/The Age of Stupid.avi" custommode="none" width="400" height="260"></embed>
    I've already have everything named just the way I want it. The videos are all in a folder with an identical title as the video itself. So, all I need to do is make it so that the link forwards the information to the embed code. Where the only thing that will change is the last portion of the path. "Moulin Rouge," for example, has the path of 'http://empire/Cannibal/Movies/Moulin Rouge/Moulin Rouge.avi'--and the movie "Crank" has the path 'http://empire/Cannibal/Movies/Crank/Crank.avi'... and so on and so on.

    I would think this is fairly easy to do, but I don't even know what I'm looking for... Not even sure that it needs to be PHP. So if you could just point me in the right direction (though I'd appreciate a short walkthrough, I have no problems doing my own leg-work), I'd be very grateful

    Thanks so much!

  2. #2
    Join Date
    Feb 2009
    Posts
    303
    Thanks
    18
    Thanked 36 Times in 36 Posts

    Default

    You can use PHP... It would look something like this:
    PHP Code:
    <?php
    $url 
    $_GET['vid'];
    echo 
    '<embed type="video/divx" src="http://empire/Cannibal/Movies/' $url '/' $url '.avi" custommode="none" width="400" height="260"></embed>';
    ?>
    Then, the url would be like this: index.php?vid=Movie Name Here. It would then take the value of vid and insert it into where it says $url. Here's an example:

    If the movie was called My Awesome Movie, the URL would be:
    Code:
    http://empire/Cannibal/Movies/index.php?vid=My Awesome Movie
    and then PHP would take that and insert it so the code would look like:
    Code:
    <embed type="video/divx" src="http://empire/Cannibal/Movies/My Awesome Movie/My Awesome Movie.avi" custommode="none" width="400" height="260"></embed>
    You did say you have LAMP, right? because you'll need PHP installed...

    If you run into any problems, don't hesitate to ask!

    // X96 \\
    Alex Blackie, X96 Design
    My Website
    I specialize in: HTML5, CSS3, PHP, Ruby on Rails, MySQL, MongoDB, Linux Server Administration

  3. The Following User Says Thank You to X96 Web Design For This Useful Post:

    spyrule (01-01-2010)

  4. #3
    Join Date
    Jan 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default You rock!

    Took me ten seconds to implement... saved me hours. Thank you so much!

  5. #4
    Join Date
    Feb 2009
    Posts
    303
    Thanks
    18
    Thanked 36 Times in 36 Posts

    Default

    No problem! Glad to be of assistance...

    // X96 \\
    Alex Blackie, X96 Design
    My Website
    I specialize in: HTML5, CSS3, PHP, Ruby on Rails, MySQL, MongoDB, Linux Server Administration

  6. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    In general, just some advice for starting off with PHP, remember that the entire point of PHP is to automate the generation of html. So any things that could be made as repeated tasks in writing html will be good to use PHP for. PHP is not all powerful though-- basically all it does is creating html (after doing more behind the scenes things like working with databases, processing variables, etc.).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •