image linking to me code php automatically

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chikooo
Forum Newbie
Posts: 12
Joined: Sun Feb 01, 2009 8:25 pm

image linking to me code php automatically

Post by chikooo »

ok this is the page. espan-glish.com/comments/
i want to display this code <center><a href="http://www.espan-glish.com/comments/index.php"><img src="http://mintywhite.com/images/techtips/0 ... a></center>
below the image that is on that site. but i will have a lot of images on different pages. so i just want a php or java script that will generate the web page url and the image address(url) automatically, so i wont hava to be typing the name of each page for each linking code.

like on this page myhotcomments.com/graphics/53696
that the code is there. and if it would be possible to add the webpage title

so how do i generate show an image address using php.
i already know how to put a web page self url using php.
i put this code in the head section

<?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;
}
?>


the i add this code whereever i want the url to appear

<?php echo curPageURL(); ?>


but now how do i get an the image url

i would really appreaciate any good help
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

Re: image linking to me code php automatically

Post by Citizen »

Please use the php code tags.
Post Reply