PDA

View Full Version : How to add php code?


wyszukaj
06-09-2006, 11:24 AM
Hello!

I need help for php code how can i add code for some page? like link-vault code or my special statistics code.

I need add this code for main page, category page and link-dispay page:


<?
include("robots_counter.php");
echo "
<div style='background-color:#ffffff;color:#000000;padding: 5px 5px 5px 5px;margin: 0px 0px

0px 3px;font-size:9px;font-weight:bold;'>Wizyty robotów na tej podstronie:</div>
<img src=google.jpg border=0 alt=Robot GoogleBot /> <b>$PageInfo[googlebot]</b><br />
<img src=msn.ico border=0 alt=Robot MSNbot /> <b>$PageInfo[msnbot]</b><br />
<img src=yahoo.jpg border=0 alt=Robot Yahoo! /> <b>$PageInfo[yahoo]</b><br />
";
?>


This is example screen for statistics efect:
http://www.skarpety.org/cat/Clip.jpg

And this is script files:
http://myth.org.ua/robots_counter.zip

Please help me!!!

BR
Tomek

Nick Collins
06-15-2006, 05:14 AM
As I don't know exactly how this script works, the only thing I can advice that you should implement this code to esc php files, without "<?" and "?>" lines. You also should upload "robots_counter.php" file to the esc root directory.

wyszukaj
06-19-2006, 06:25 PM
Hello Nick!

Thank you for your answer, i try to implement this in my site http://www.wyszukaj.com

I add this part of code [include("robots_counter.php");] in my index.php file and the robots is count. but i don't know were i must include next part of code to display robot count.

You can look on the site http://www.wyszukaj.com

Vincent Wright
06-20-2006, 04:15 AM
Greetings wyszukaj,

I think you have to complete two simple steps to make robot counters display in your directory.

1. Passing info to Smarty template engine

Open header.php file. At the bottom of the file (right before closing ?>) add this line:


$gDirSmarty->assign_by_ref('PageInfo', $PageInfo);


Save changes and close the file

2. Displaying statistics

Now open the file where you inserted the code you mentioned above (I suppose it is footer.tpl) and replace these entries


...
$PageInfo[googlebot]
...
$PageInfo[msnbot]
...
$PageInfo[yahoo]
...


with these


...
{$PageInfo.googlebot}
...
{$PageInfo.msnbot}
...
{$PageInfo.yahoo}
...


This is the correct syntax for displaying array elements in Smarty.

Save changes and close the file.

Visit your site and check if it works. Should you have any troubles with that feel free to ask.

Vincent Wright
06-20-2006, 04:21 AM
Please make sure the robots_counter.php is installed correctly.

It has installation instructions at the top. Though it is in poland I was able to understand :cool: that you have to create robot.db file and chmod it to 666 or 777 (write permissions). Also you have to require_once('robots_counter.php') in index.php