|
Posted by Geoff Berrow on 03/02/07 12:32
Message-ID: <1172835354.325474.22650@s48g2000cws.googlegroups.com> from
affiliateian@gmail.com contained the following:
>Unfortunately, I think because we are running the php in an include
>file, the echo link is not working. Viewing the php file directly
>works but when this piece of code is placed in a php file inside
>a .shtml file, it no longer echos the url or title.
>
>Any ideas of how we can get around this?
Try this
<?php
$url=$_SERVER['SCRIPT_URI'];
$file=explode("/",$url);
$filename=$file[(count($file)-1)];
$content = implode('', file($filename));
preg_match("/<title>(.*)<\/title>/i", $content, $match);
$title = $match[1];
$link='http://www.stumbleupon.com/submit?url='.$url.'&title='.urlencode($title);
?>
<a href='<?php echo $link;?>'> Link to stumbleupon</a>
Bear in mind that if your <title></title> is in an include this probably
won't work.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Navigation:
[Reply to this message]
|