GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How to call PHP script from a page?? (https://gfy.com/showthread.php?t=417200)

donnie 01-15-2005 05:37 PM

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

Sly 01-15-2005 05:38 PM

<? include ("file.php"); ?>

Unless something has drastically changed over the past 3 years.

Jace 01-15-2005 05:51 PM

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

Tipsy 01-15-2005 05:54 PM

Quote:

Originally Posted by JaceXXX
you can't call php from an html page

You can with a very small change to apache or sometimes htaccess. It can be very useful sometimes.

Jace 01-15-2005 05:54 PM

Quote:

Originally Posted by Tipsy
You can with a very small change to apache or sometimes htaccess. It can be very useful sometimes.

yeah, but for us normal folks it is just easier to rename the file to php

Azlord 01-15-2005 06:11 PM

yah but the hun won't take php galleries.

Tipsy 01-15-2005 06:14 PM

Quote:

Originally Posted by JaceXXX
yeah, but for us normal folks it is just easier to rename the file to php

Depends on the usage. Sometimes naming the file php can cause problems and it's not a hard thing to do even for 'normal' folks. It'd only be difficult on some virtual accounts where the htaccess is restrictive.

Dalai lama 01-15-2005 06:14 PM

Quote:

Originally Posted by Sly
<? include ("file.php"); ?>

Unless something has drastically changed over the past 3 years.


nothing has changed, good call :thumbsup

MikeXAMO 01-15-2005 06:48 PM

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!

Antonio 01-15-2005 06:54 PM

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