Hi people,

Again, a problem with "global". Maybe you can shed a light on this one...

Consider this part of a class (with [...] I marks things I left out, which 
aren't important for the problem, FAFAIK):

class FotoView
{
        [...]
        var $fotos;
        var $cats;
        var $start;
        var $limiet;
        [...]

        /**
         * Constructor
         */
        function FotoView($start,$cats=NULL,$admin=FALSE)
        {
                $this->limiet = $this->getLimit();

                [...]

                $this->start = $start;

                [...]

                echo("1:".$this->start." ".$this->limiet);

                $this->fotos = $this->findFotos();
        }

        function getLimit()
        {
                global $WORKDIR;
                include_once($WORKDIR."obj/dbconnection.obj.php");

                $db = new DBConnection();
                $result = $db->query("SELECT lijst_x, lijst_y FROM config");
                $data = mysql_fetch_row($result);
                return ($data[0]*$data[1]);
        }

        [...]

        function findFotos()
        {
                global $start, $cats, $limiet, $urlfotoview, $WORKDIR;

                echo("2:".$this->start." ".$this->limiet);

                echo("3:".$start." ".$limiet);
                [...]

Okay, $WORKDIR is set in the page that calls this class, it works (checked 
it). You can see three echo's in there. The result from those are:
1: 0 20
2: 0 20
3: 0

Can anyone explain to me why in findFotos() the defining of $limiet doesn't 
work correctly? Why isn't a reference made to $this->limiet? I'm really at 
a lost, here... Any help is appreciated!

-- 
Kind regards,
Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to