[support] statistics not working on some node types

pyg pyg at framasoft.net
Thu Oct 18 14:29:32 UTC 2007


You've got it !!! :D

my mistake was to use this type of code on top of my page.tpl.php

========  8< ==============
<?php
if ($node->type == 'page') {/* modif de pyg le 21/08 : on verifie le
content-type de la page, et s'il s'agit d'une "page" */
    include 'page-page.tpl.php'; /* alors on charge le template
page-page.tpl.php */
    exit;
} elseif ($node->type == 'fiche_plume') {/* modif de pyg le 21/08 : on
verifie le content-type de la page, et s'il s'agit d'une "fiche_plume"
*/
    include 'page-fiche_plume.tpl.php'; /* alors on charge le template
page-fiche_plume.tpl.php */
    exit;
}
<html>
(... standard page.tpl.php html code...)
========  8< ==============

I replaced it by
========  8< ==============
<?php
if ($node->type == 'page') {/* modif de pyg le 21/08 : on verifie le
content-type de la page, et s'il s'agit d'une "page" */
    include 'page-page.tpl.php'; /* alors on charge le template
page-page.tpl.php */
} elseif ($node->type == 'fiche_plume') {/* modif de pyg le 21/08 : on
verifie le content-type de la page, et s'il s'agit d'une "fiche_plume"
*/
    include 'page-fiche_plume.tpl.php'; /* alors on charge le template
page-fiche_plume.tpl.php */
}
?>
========  8< ==============
and created a page-all.tpl.php contaning the standard code.

Everything seems to work fine by now :)

A really big thx to you, Jeremy.

I know that I did something wrong somewhere, but there was no sign of
what (watchdog didn't trace anything)

Now, I'll know that using exit() is a very bad idea :P

Thanks a lot again for putting me on the way.

pierre-yves - http://www.projet-plume.org



2007/10/18, Jeremy Andrews <lists at kerneltrap.org>:
> Hello Pierre-Yves,
>
> On Thu, 18 Oct 2007 10:51:14 +0200
> pyg <pyg at framasoft.net> wrote:
>
> What version of Drupal are you using?  I'm going to assume
> 5.x.
>
> > Do you know if the core statistics module allow some node
> > content types to be excluded from being logged ?
>
> No, it does not.  It uses the following logic to determine if
> a given page view is a node view:
>
> if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '')
>
> So long as your node is viewed the standard Drupal way via
> "node/#" this should work fine.  (URL aliasing doesn't
> matter, as arg(0) and arg(1) will still be set correctly to
> "node" and "#".)
>
> > Since a few days, one of my CCK node type doesn't seem to
> > execute statistics_exit() anymore, and I just can't figure
> > out why !
>
> So it used to work, then it stopped?
>
> What did you change around the time it stopped working?
>
> Typically I've only seen calls to statistics_exit() stop
> working when there was a bug in your code somewhere causing a
> PHP error before _exit() can be called.  Check your Watchdog
> log as well as your Apache error_log (or the equivalent).
>
> > I use a custom theme using a node-mycck_theme_name.tpl.php
> > file, and everything works fine except that stats are not
> > recorded anymore.
>
> If you recently changed your template, it's possible you've
> introduced an error there...
>
> Cheers,
>  -Jeremy
>
> --
> http://kerneltrap.org/
> Jeremy Andrews - Owner
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>


More information about the support mailing list