This is topic Can this be done? (php) in forum Web at TMO Talk.


To visit this topic, use this URL:
http://www.themoononline.com/cgi-bin/Forum/ultimatebb.cgi?ubb=get_topic;f=4;t=001672

Posted by sabian (Member # 6) on :
 
Right, I've worked with several scripts in the past where the URL parse in the page automatically and always assumed that it was a php/apache thing but I'll be damned if I can find it.

To make myself sound less like an idiot, I'll provide examples! [Razz]

Right, one script I use automatically generates a digg link like this:
code:
http://digg.com/submit?phase=2&url=http://www.domain.com/page4.html

And if I were to click on "next page", the link automatically updates to:
code:
http://digg.com/submit?phase=2&url=http://www.domain.com/page5.html

Now, is this "auto append" (for lack of better term) of the URL a function that can be called via php/apache or is it some sort of variable within the script itself? I've dissected 2 different scripts that do this but I'll be damned if I can find a common thread so that's why I'm here.

Is there away I can set up a link on ANY page that basically does:
code:
http://digg.com/submit?phase=2&url={AUTOMATICALLY UPDATE URL WHERE BUTTON APPEARS}

Or is this something that has to be hard coded?
 
Posted by sabian (Member # 6) on :
 
I've tried:
code:
http://digg.com/submit?phase=2&url=$_SERVER['PHP_SELF']

but it doesn't seem to work...

I'm assuming I have to define some sort of variable like:

$pageloc = $_SERVER['PHP_SELF']

Then the link would be:
http://digg.com/submit?phase=2&url=$pageloc


Can't figure out how to do it though, back to the drawing board/Google
 
Posted by sabian (Member # 6) on :
 
Sorted

code:
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
<html>
<head>
</head>
<body>
<?php
echo '<div align="right"><a href="http://digg.com/submit?phase=2&url='.curPageURL().'" target="_blank">Digg this page</a> </div><hr>';
?>
</body>
</html>

Thanks for your help! [Roll Eyes] [Smile]
 
Posted by ralph (Member # 773) on :
 
Sorry. I was busy. [Frown]
 
Posted by sabian (Member # 6) on :
 
Tis ok... I knew I could figure it out... I just needed a 'sounding board' and need to read the damned php book I have.
 
Posted by Cherry In Hove (Member # 49) on :
 
quote:
Originally posted by ralph:
Sorry. I was busy. [Frown]

Loi

You just didn't know.
 
Posted by ralph (Member # 773) on :
 
No. Really. I was busy. Check the threads. First post all day! Smarmy bastard. [Mad]
 
Posted by Pink (Member # 459) on :
 
Sabian CYI
 


copyright TMO y2k+

Powered by Infopop Corporation
UBB.classic™ 6.6.1