1
tzvook
include a php file in the template + a ver
  • 2008/1/26 0:39

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


Hi all
I has a little problem regarding passing php vars to the smarty templates (adding google pagerank to webkinks module):

I need to include a php file in the template and pass him a ver, so I tried the folowing:
le="color: #000000"><?php <{php}> include "pagerank1.php" uri="<{$link.url}>" <{/php}>

in the template file, but it's giving a blank page ....
so it's definatly not the way to pass the $uri

le="color: #000000"><?php <{php}> include "pagerank1.php?uri=<{$link.url}>" <{/php}>

is not working either ....

I now use the folowing code instead ..... (calling the php file via iframe which works well - but is a louzy way to do it when you think of the end code))

this one on the template file
le="color: #000000"><?php <iframe frameborder="0" hspace="0" vspace="0" height="16" scrolling="No" style="vertical-align: top; vertical-align: baseline;margin:0px;padding:0px;border:0px;height:16px; width:66px;" src="pagerank1.php?uri=<{$link.url}>&uri=<{$link.url}>"></iframe>


and this one in the php file
le="color: #000000"><?php if (isset($_REQUEST['uri'])) $url=trim($_REQUEST['uri']); else $uri="http://www.domain.com"; echo "<font style="line-height: 10px;font-weight: bold; font-size: 13px;">page rank: ".get_page_rank($url). "</font>";


Help is definately needed here ...

2
kaotik
Re: include a php file in the template + a ver
  • 2008/1/26 13:14

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


le="color: #000000"><?php <{php}> include 'pagerank1.php?uri='.$link["url"]; <{/php}>


You only use <{}> when inside a smarty template, since you called <{php}> all code inside should be php.

You could also do this without calling php:
le="color: #000000"><?php <{include file='pagerank1.php?uri='$link.url}>

3
tzvook
Re: include a php file in the template + var
  • 2008/1/26 20:12

  • tzvook

  • Just can't stay away

  • Posts: 875

  • Since: 2003/2/1 2


10X Kaotik
the code doesn't work ... i simply tryed to "echo" the var like this :
le="color: #000000"><?php <{php}> echo '$link["url"]'; <{/php}>


tried also

le="color: #000000"><?php <{php}> echo "$link[url]"; echo $link["url"]; <{/php}>


none worked ....

4
kaotik
Re: include a php file in the template + a ver
  • 2008/1/27 15:24

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


try this:
le="color: #000000"><?php <{php}> global $link; print_r ($link); //include 'pagerank1.php?uri='.$link["url"]; <{/php}>

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits