![]() |
A little html/php help
So I have a random image archive thing, here.
You just click the image and it loads another, by refreshing the page. Here's how I have everything working currently: My index.html is this: Code:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> PHP Code:
My php knowledge is basically non-existant. If not making it work like I described in the above paragraph is possible, maybe I could use the same script to also display a text link underneath or something to the image. Though that would result in multiple calls to the script, which would end up with the image shown not matching with the URL :( Sorry if I'm not making any sense ;_; |
Any particular reason you're trying to keep the random image script and the display page seperate?
This would be a bit easier if they were merged (for example, you could <a href...> the image to the PHP script itself, which would allow right-clicks, and display a link below. Want me to show you what I mean? I can't really figure any good way with your present setup. |
That'd be great =D
And this is just my own stupid way I ended up with something that at least sort of works. I'm pretty much average at html, but a complete newbie at php. |
This is really quickly written, so it's not the best code, but here's an example of how to make it work all in one file. You can name this whatever, it just needs to be parsed as a PHP file. index.php might be good so it'll load by default if you try to get to the images directory (if it does in fact sit in said directory). Heavily commented to try and make it easier for you. If something needs clarification, by all means.
PHP Code:
As a note, you see the { } braces wrapping $_SERVER['PHP_SELF'] in the last bit? Those make it so PHP won't error out on the print, since it doesn't like quoted array indices in prints for some reason. Wrapping the variable is the same as concatenating it outside of the quote, essentially. Hopefully that is of help for you. |
Ahh, got everything working fine thanks to your help =D. Much appreciated.
|
All times are GMT -5. The time now is 07:47 PM. |
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2025, vBulletin Solutions, Inc.