PDA

View Full Version : php include counter


euscera
03-29-2007, 01:06 AM
Hey!
I need to include a counter:
include("/home/grushca/public_html/cnstats/cnt.php");

when i include it into html template file -- template looks fine, but it doesn't get stats using php include.

if i put it into index.php it breaks up my template (sugar - pepper or one of those)

how can i include it so both would be working? thanks!

jaywilliams
03-29-2007, 01:09 AM
The best way would be to build an addon for the counter.
Then you could include the counter tag in your template.

You can find out how to make your own addon here:
http://wiki.pixelpost.org/index.php?title=How_could_I_write_my_own_addon_for _Pixelpost%3F

euscera
03-29-2007, 01:28 AM
<?php $addon_name = "CnStats Counter";
$addon_description = "Original counter link replacement";
$addon_version = "1.0";
$cncount = include("/home/grushca/public_html/cnstats/cnt.php");
$tpl = ereg_replace("<CURRENT_DATE_TIME>",$cncount,$tpl); ?>

did i get it right, that in $cncount in this php code has to include cnt.php? as a link? could it be include("/home/grushca/public_html/cnstats/cnt.php");
If so i dont get how do i get a <CN_COUNT> link?
i dont understand why $tpl is presented, and than its used as a replacement too.



The cnt.php that includes: http://grush.ca/cnt.php.txt

euscera
03-29-2007, 02:18 AM
here's what I got $addon_name = "CnStats Counter";
$addon_description = "CNStats cne.php replacer.";
$addon_version = "0.1";
$cn_count = include("/home/grushca/public_html/cnstats/cnt.php");
$tpl = str_replace("<CN_COUNT>",$cn_count,$tpl );

as soon as its turned on in the control panel it starts couting -- so it includes even if i dont have <CN_COUNT> embedded into the template page and the design falls apart. What should I do?
Thanks

jaywilliams
03-29-2007, 02:29 AM
I think you may need to get the code from cnt.php and get it to run inside the addon php code.

An easier alternative, would be to use a free third-party counter, such as Google Analytics. (http://www.google.com/analytics/)