![]() |
How to call PHP script from a page??
I have this gallery rotator script but I don't know how to call it from my page.
What should I write on my page to get link to a random gallery?? Here is the script: random.php ----------------------------------------------- <? $delim = "\n"; $cryfile = "galleries.txt"; $fp = fopen($cryfile, "r"); $contents = fread($fp, filesize($cryfile)); $cry_arr = explode($delim,$contents); fclose($fp); srand((double)microtime()*1000000); $cry_index = (rand(1, sizeof($cry_arr)) - 1); $herecry = $cry_arr[$cry_index]; echo $herecry; ?> ----------------------------------------------- galleries.txt ----------------------------------------------- <a href="gallery1.url">Gallery 1 Description</a> <a href="gallery2.url">Gallery 2 Description</a> <a href="gallery3.url">Gallery 3 Description</a> etc... ----------------------------------------------- |
<? include ("file.php"); ?>
Unless something has drastically changed over the past 3 years. |
and make sure the page you are calling it from is named something.php
you can't call php from an html page i made that mistake the first time, took me 2 hours to figure out what I was doing wrong |
Quote:
|
Quote:
|
yah but the hun won't take php galleries.
|
Quote:
|
Quote:
nothing has changed, good call :thumbsup |
I always recommend making a simple change to apache to run PHP in .html files. You simply add the line "AddType application/x-httpd-php .html" in your httpd.conf file. If you wanna get real crazy, you can make your php files appear as HTML files (i.e. Don't output the PHP header on PHP processed pages) by setting "expose_php = Off" in your php.ini file. Good thing to do for gallery makers!
|
I use
<!--#include virtual="MyFile.php"--> on a .shtml page |
All times are GMT -7. The time now is 10:21 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123