views:

161

answers:

2

Oddest bug.

I'm parsing a template and inserting same values pulled from a db. I also have a model set up that logs some statistics each time the parsed page is viewed(all brought together in the same method). Trouble I'm having is that the stat is logged three times in the db. Identical values on three different rows.

I am using some routing and pull an id and parameter2 value from the URL.

This has been bugging me all day and any ideas would be appreciated

A: 

Is it getting called once or three times? Try stepping through the code with an IDE or FireBug...

Peter Loron
I was wondering if the url structure was causing the script to be run multiple times. I'm going to do some more indepth research on URI routing
Tim
A: 

So it seems that the parsing library runs through the template code for each piece of data it needs to replace.

foreach ($data as $key => $val)
        {
            if (is_array($val))
            {
                $template = $this->_parse_pair($key, $val, $template);       
            }
            else
            {
                $template = $this->_parse_single($key, (string)$val, $template);
            }
        }

So I'm now trying to determine the best way to parse the data without a loop.

Tim