This is the code. I can see output for a site's alexa like GOOGLE.
But not for variable $linkdetail.URL but when I use $linkdetail.URL it gives me the link.
OUTFILE HERE - http://www.warez-core.com/details/link-1
Any help in correcting this part in the code ?
<td><strong>Alexa Rank of {$linkdetail.TITLE} </strong></td>
<td> {php}echo alexaRank($linkdetail.URL);{/php}</td>
But not for variable $linkdetail.URL but when I use $linkdetail.URL it gives me the link.
OUTFILE HERE - http://www.warez-core.com/details/link-1
Any help in correcting this part in the code ?
<td><strong>Alexa Rank of {$linkdetail.TITLE} </strong></td>
<td> {php}echo alexaRank($linkdetail.URL);{/php}</td>
PHP:
{* Calculate title from path *}
{capture name="title"}
{/capture}
{strip}
{include file="header.tpl"}
{include file="top_bar.tpl"}
<div id="main">
{foreach from=$linkdetail item=linkdetail}
{php}
$domain = $linkdetail.URL;
function alexaRank($domain){
$remote_url = 'http://data.alexa.com/data?cli=10&dat=snbamz&url='.trim($domain);
$search_for = '<POPULARITY URL';
if ($handle = @fopen($remote_url, "r")) {
while (!feof($handle)) {
$part .= fread($handle, 100);
$pos = strpos($part, $search_for);
if ($pos === false)
continue;
else
break;
}
$part .= fread($handle, 100);
fclose($handle);
}
$str = explode($search_for, $part);
$str = array_shift(explode('"/>', $str[1]));
$str = explode('TEXT="', $str);
return $str[1];
}
echo alexaRank($domain);
{/php}
<table border="0">
<tr><td colspan="2"><h2>{$linkdetail.TITLE}</h2></td></tr>
<tr>
<td rowspan="4">
<img src="http://msnsearch.srv.girafa.com/srv/i?s=MSNSEARCH&r={$linkdetail.URL}" align="absmiddle" border="1" width="160" alt="{$linkdetail.TITLE}" />
</td>
<td><strong>Title: </strong></td>
<td><a href={$linkdetail.URL}>{$linkdetail.TITLE}</a></td>
</tr>
<tr>
<td><strong>URL: </strong></td>
<td>{$linkdetail.URL}</td>
</tr>
<tr>
<td><strong>Description: </strong></td>
<td>{$linkdetail.DESCRIPTION}</td>
</tr>
<tr>
<td><strong>Page Rank: </strong></td>
<td>{$linkdetail.PAGERANK}</td>
</tr>
<tr>
<td><strong>Google's Alexa Rank: </strong></td>
<td> {php}echo alexaRank("google.com");{/php}</td>
</tr>
<tr>
<td><strong>Alexa Rank of {$linkdetail.TITLE} </strong></td>
<td> {php}echo alexaRank($linkdetail.URL);{/php}</td>
</tr>
</table>
{/foreach}
</div>
{include file="footer.tpl"}
{/strip}