Adding Hitcounter and Who's Online code

Chris P. Bacon

Joined: 2007-04-21
Posts: 39
Posted: Sat, 2007-11-10 14:53

Hi,

Can i somehow add the Hitcounter and Who's Online code from my main website, in the gallery too, so it count when people are browsing the main site AND the gallery?

The code i got on the main website is these simple stings:

<?php include("usersonline/useronline.php4"); ?>

and

<?php include("hitscounter/count.php"); ?>

Can I add this code to the gallery?


Gallery version = 2.2.1 core 1.2.0.1
PHP version = 5.2.1 apache2handler
Webserver = Apache
Database = mysql 4.0.26-standard, lock.system=flock
Toolkits = ArchiveUpload, Exif, NetPBM, Gd
Acceleration = none, none
Operating system = Linux node4.c24 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686
Default theme = siriux
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; da; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11

 
Chris P. Bacon

Joined: 2007-04-21
Posts: 39
Posted: Mon, 2007-11-12 16:45

Can no one help me with this? :(

 
serbanc

Joined: 2006-05-19
Posts: 314
Posted: Mon, 2007-11-12 19:31

assuming that the main page is a CMS (joomla, wp) probably not directly.
for usersonline, you should check the contrib area, there is a module for gallery that displays the online users.

serbanc - www.e-poze.ro

 
Chris P. Bacon

Joined: 2007-04-21
Posts: 39
Posted: Fri, 2007-11-16 18:52

Thanks for the reply, serbanc.

No, its not a CMS, its a completely normal PHP site made in Dreamweaver.

I wanted to do this, so i dont need to install diffrent counters, but just use the same, so hits on the main page AND in the gallery adds to the total count.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2007-11-18 22:56

Just add the code to the tempalte you want it to show on (album.tpl of the theme you are using.
Use this syntax:
http://smarty.php.net/manual/en/language.function.include.php or http://smarty.php.net/manual/en/language.function.php.php

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Chris P. Bacon

Joined: 2007-04-21
Posts: 39
Posted: Mon, 2007-11-19 17:04
floridave wrote:
Just add the code to the tempalte you want it to show on (album.tpl of the theme you are using.
Use this syntax:
http://smarty.php.net/manual/en/language.function.include.php or http://smarty.php.net/manual/en/language.function.php.php

Thanks alot for the reply, floridave. I tried adding the code, but i get some errors in the gallery:

Warning: include(/usersonline/useronline.php4) [function.include]: failed to open stream: No such file or directory in /mounted-storage/home41b/sub005/sc31606-IXKO/gallery/g2data/smarty/templates_c/%%1126640328/%%25^256^25661EA0%%album.tpl.php on line 86

Warning: include() [function.include]: Failed opening '/usersonline/useronline.php4' for inclusion (include_path='.:/usr/local/lib/php/') in /mounted-storage/home41b/sub005/sc31606-IXKO/gallery/g2data/smarty/templates_c/%%1126640328/%%25^256^25661EA0%%album.tpl.php on line 86

Warning: include(/hitscounter/count.php) [function.include]: failed to open stream: No such file or directory in /mounted-storage/home41b/sub005/sc31606-IXKO/gallery/g2data/smarty/templates_c/%%1126640328/%%25^256^25661EA0%%album.tpl.php on line 88

Warning: include() [function.include]: Failed opening '/hitscounter/count.php' for inclusion (include_path='.:/usr/local/lib/php/') in /mounted-storage/home41b/sub005/sc31606-IXKO/gallery/g2data/smarty/templates_c/%%1126640328/%%25^256^25661EA0%%album.tpl.php on line 88

--------------------

This is the code I have added in the album.tpl (those lines are the last in the bottom of the file:

{* System Links only on the root page *}
{if empty($theme.parents)}
<div class="gbSystemLinks">
{g->block type="core.SystemLinks"
order="core.SiteAdmin core.YourAccount core.Login core.Logout"
othersAt=4}
</div>
{/if}
{php}
include('/usersonline/useronline.php4');
{/php}
{php}
include('/hitscounter/count.php');
{/php}

{* Guest preview mode *}
{g->block type="core.GuestPreview" class="gbBlock"}

{* Our emergency edit link, if the user removes all blocks containing edit links *}
{g->block type="core.EmergencyEditItemLink" class="gbBlock" checkBlocks="album"}

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2007-11-19 21:31
Quote:
include(/usersonline/useronline.php4) [function.include]: failed to open stream: No such file or directory

You might have to change the path(s) to the correct location.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Chris P. Bacon

Joined: 2007-04-21
Posts: 39
Posted: Tue, 2007-11-20 16:53

I thought I had tried every path, but I was wrong. It works perfect now, thanks alot! :)