Log in

View Full Version : Dynamic Page Content



Moglizorz
03-30-2007, 06:14 PM
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)
http://img46.imageshack.us/img46/5980/phpky5.jpg (http://img46.imageshack.us/img46/5980/phpky5.jpg)
(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...

boogyman
03-30-2007, 07:07 PM
pass the movie you want to the browser via a form or your link



<a href="webpage.php?movie=__MOVIE_1__">MOVIE 1</a>


then use a script like



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


placed inside "webpage.php" where you want the movie to appear

Moglizorz
04-02-2007, 06:05 PM
Thanks for that, *attempts it...*

Moglizorz
04-02-2007, 06:17 PM
I made a crappy page, and put that script into it, and saved it as 'webpage.php':

<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.

mburt
04-02-2007, 06:20 PM
<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:

<html><body>

<?php
<embed src="<?php echo $_GET["movie"]; ?>.swf" width="500" height="500" loop="false" autostart="true"></embed>
?>

</body></html>

Moglizorz
04-02-2007, 06:25 PM
Now the page only shows:

.swf" width="500" height="500" loop="false" autostart="true"> ?>
This is confusing stuff for me :p

boxxertrumps
04-02-2007, 06:26 PM
<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...

Moglizorz
04-02-2007, 06:30 PM
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?

mburt
04-02-2007, 06:33 PM
Well yes, if the server is trying to parse PHP as HTML, your server doesn't have it.

Moglizorz
04-02-2007, 06:36 PM
Called my hosting, php is now enabled, and it works. Thanks alot guys, you helped tons! No more masses of files for me! :D