The money is in the eyes

Welcome to TMO

Home
Talk
Rants
Life
Music
Web
Media
Society
Sex
Announce
Games

How do I get a tag ?

Read the FAQ !



email us
TMO Talk Post New Topic  Post A Reply
my profile login | search | faq | forum home

  next oldest topic   next newest topic
» TMO Talk » Web » Can this be done? (php)

   
Author Topic: Can this be done? (php)
sabian

 - posted      Profile for sabian           Edit/Delete Post   Reply With Quote 
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?

--------------------
Evil isn't what you've done, it's feeling bad about it afterwards... Yield to temptation. It may not pass your way again.

Posts: 3793  |  IP: Logged
sabian

 - posted      Profile for sabian           Edit/Delete Post   Reply With Quote 
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

--------------------
Evil isn't what you've done, it's feeling bad about it afterwards... Yield to temptation. It may not pass your way again.

Posts: 3793  |  IP: Logged
sabian

 - posted      Profile for sabian           Edit/Delete Post   Reply With Quote 
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]

--------------------
Evil isn't what you've done, it's feeling bad about it afterwards... Yield to temptation. It may not pass your way again.

Posts: 3793  |  IP: Logged
ralph

 - posted      Profile for ralph           Edit/Delete Post   Reply With Quote 
Sorry. I was busy. [Frown]
Posts: 7436  |  IP: Logged
sabian

 - posted      Profile for sabian           Edit/Delete Post   Reply With Quote 
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.

--------------------
Evil isn't what you've done, it's feeling bad about it afterwards... Yield to temptation. It may not pass your way again.

Posts: 3793  |  IP: Logged
Cherry In Hove
Channel 39
 - posted      Profile for Cherry In Hove           Edit/Delete Post   Reply With Quote 
quote:
Originally posted by ralph:
Sorry. I was busy. [Frown]

Loi

You just didn't know.

Posts: 4934  |  IP: Logged
ralph

 - posted      Profile for ralph           Edit/Delete Post   Reply With Quote 
No. Really. I was busy. Check the threads. First post all day! Smarmy bastard. [Mad]
Posts: 7436  |  IP: Logged
Pink
TMO Member
 - posted      Profile for Pink           Edit/Delete Post   Reply With Quote 
Sabian CYI

--------------------
...and so say we all.

Posts: 193  |  IP: Logged


   
Post New Topic  Post A Reply Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


Contact Us | The Moon Online

copyright TMO y2k+

Powered by Infopop Corporation
UBB.classic™ 6.6.1