Join 3,418 readers in helping fund MetaFilter (Hide)

Help computer
May 2, 2012 8:19 AM   Subscribe

I have a website that I would like to display a random youtube video upon load. I've seen some examples with PHP, but I cannot seem to properly implement them.

Here is the page I am trying to implement the code on, ... I've attempted to change how the videos.txt file is linked. [/home/joshvanh/public_html/qr/videos.txt, /qr/videos.txt, /public_html/videos.txt, videos.txt, etc.] and none seem to work. Perhaps my host, Vlexofree, does not allow php to work, but I don't think that's the case.

If anyone has any ideas that would be so helpful. I've basically informed you of all my woes, I have to run for a bit, but I will respond later. Thank you!
posted by cloeburner to Technology (5 answers total)
Oops, I meant /public_html/qr/videos.txt not /public_html/videos.txt
posted by cloeburner at 8:22 AM on May 2, 2012

BTW, the code can be viewed in the source of
posted by cloeburner at 8:26 AM on May 2, 2012

try $_SERVER['DOCUMENT__ROOT'].'/qr/videos.txt' or dirname(__FILE__).'/videos.txt';
posted by missmagenta at 8:31 AM on May 2, 2012

If you haven't checked what $_SERVER['DOCUMENT_ROOT'] and you were just using the example of /home/account/public_html its most likely that your host uses a different document path for websites, you really can't guess.
posted by missmagenta at 8:34 AM on May 2, 2012

I used a different code altogether (changed it so it was linked within the php document as opposed to a separate text file). Now it works, thanks for the help missmagenta.
posted by cloeburner at 9:10 AM on May 2, 2012

« Older MLB GamedayAudioFilter: I sub...   |  What are the ways we could exp... Newer »
This thread is closed to new comments.