Variables variables and the Object Factory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello php-windows mailing group, this is my first post! :P I hope I
get it right.
I have a problem with a web app I'm developing. It is an ajax web app
that is built on PHP and JQuery. It works fine on my windows computer
running Apache, however, when I move into production on an IIS server,
it breaks (Yes, I know, developing and production environments need to
be the same. I wish that it was the case here, but it is not, I'm a
student working and I don't have the political leverage to get XP Pro
and IIS).
I've worked through most of the problems and fixed them, however there
is one that I can't for the life of my figure out how to fix it. I
know what's causing it, but I don't know why, and therefore I can't
fix it.

I have this function that creates an object based on the string that
is passed to it. The string that is passed to it is the name of the
class that is being created. It uses a niffty php feature and I can
create a object by doing $object = new $var(); And that works fine as
long as I've included the object, on Apache. On IIS that little code
fails, silently. If I pass it a class name that doesn't exist it
happily throws an error, but other than that it fails silently. What I
mean by failing silently is that when the ajax request comes for the
object, Firebug (firebug's nice isn't it) highlights it in red and the
request fails to return anything, not even a 404. Firebug's view
stat's the AJAX request response being 'Loading...', I.E., it's
waiting on the server.

Does anyone know how to fix this? I haven't the faintest clue what's
causing it or why. The code is below:

       /**
        *      This method creates the pane and finds it based on the classpath
and the class name.
        *
        *      CAUTION: Uses an Object Factory!
        *
        *      @param $div - the id for the pane
        */
       public function createPane($div){
               require_once(INTRA_PANES_AB."/".$div.".inc.php");
               $classname = explode("_",$div);
               $classes = array();
               foreach($classname as $class){
                       $classes[] = ucfirst($class);
               }
               $classname = (implode($classes, "_"));

               $object = new $classname();
               $tmp = $object->getTitle();     //empty cannot read
return values :(
               $title = $tmp;
               if($object->getTitle() == ""){
                       $title = $object->getId();
               }
               if($tmp == '-1')
                       $title = "";
               $pane = "\n<div class='pane'><dl class='sort'>";
               $pane .= $object->getBar();
               $pane .= "\t<dd><div class='$div'>";
               $pane .= $object->output();
               $pane .= "\n\t</div></dd>\n</dl></div>";

               return $pane;
       }



-- 
An optimist believes we live in the best of all possible worlds,
A pessimist fears this is true.

Note: If you don't send this letter to 8 billion people within the
next 3 minutes Richard Speck will come out of his grave and kill you
during the next full moon. I know this because he did it to a friend
of mine!

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux