Results 1 to 10 of 10

Thread: Dynamic Page Content

  1. #1
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Dynamic Page Content

    Currently I have hundreds of pages on my site, each with a new video. But every time I want to add a new video, I have to add a new page. I was wondering if I could do:
    Say the page was "webpage.php" and the file was "flash.swf" if I could do:
    http://www.....com/webpage.php?embed=flash.swf
    or something. Also, I would like to include height and width variables into that.
    Here's how I would kind of like it to work (the flash file should be an embed)

    (I wouldn't want the height and width sizes showing, it's just an example to show what I mean.)

    I am not sure how easy/possibly this is. I am a complete php newb :P
    Is there any chance someone could create this as a .php file and post it? I would like to learn more about this method of creating dynamic pages...
    Last edited by Moglizorz; 04-02-2007 at 06:31 PM.

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    pass the movie you want to the browser via a form or your link

    Code:
    <a href="webpage.php?movie=__MOVIE_1__">MOVIE 1</a>
    then use a script like

    Code:
    <?php 
       <embed src="{$movie}.swf" width="___" height="___" loop="false" autostart="true"></embed>
    ?>
    placed inside "webpage.php" where you want the movie to appear

  3. #3
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks for that, *attempts it...*

  4. #4
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I made a crappy page, and put that script into it, and saved it as 'webpage.php':
    HTML Code:
    <html><body>
    
    <?php 
       <embed src="{$movie}.swf" width="500" height="500" loop="false" autostart="true"></embed>
    ?>
    
    </body></html>
    I used the '?movie=pie' tag, when there is a file called 'pie.swf' in the same folder. But... The page only shows:
    ?>
    Any idea what I am doing wrong? Can you possibly type a simple page where it does work? I am a confused php newbie.

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    <html><body>

    <?php
    <embed src="{$movie}.swf" width="500" height="500" loop="false" autostart="true"></embed>
    ?>

    </body></html>
    I assume your using php, but the curly braces seem to be out of the orderinary:
    Code:
    <html><body>
    
    <?php 
       <embed src="<?php echo $_GET["movie"]; ?>.swf" width="500" height="500" loop="false" autostart="true"></embed>
    ?>
    
    </body></html>
    - Mike

  6. #6
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Now the page only shows:
    .swf" width="500" height="500" loop="false" autostart="true"> ?>
    This is confusing stuff for me

  7. #7
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    PHP Code:
    <html><body>
    <embed src="<?php echo $_GET["movie"]; ?>.swf" width="500" height="500" loop="false" autostart="true"></embed>
    </body></html>
    This is what should work...
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  8. #8
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Same thing happens as previous, but without the "?>" bit at the end. Is this something I am doing wrong, would this mean my hosting does not have php enabled, or, erm, help?

  9. #9
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Well yes, if the server is trying to parse PHP as HTML, your server doesn't have it.
    - Mike

  10. #10
    Join Date
    Mar 2007
    Posts
    68
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Called my hosting, php is now enabled, and it works. Thanks alot guys, you helped tons! No more masses of files for me!

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
  •