PHP4 - $class_name::method_name

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Time for me to ask a question for you all... This is what I want to do:


$class_name has the name of the class I want to call the method from.

Here is the expected error:
parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM in file.php on line 52

Now, is there a way I can accomplish this? Will I get stuck doing a
switch($class_name) for it?

Maybe a twist of the login a bit?

Here's the full thing...

Generating a list of the pages, sub-pages, sub-sub-pages, etc. dynamicly
in a CMS...

1 get an array of the pages at a certain node
   Array is like:
    Array (
     [$PATH/site-map/] => 9
     [$PATH/request/] => 6
     [$PATH/news/] => 1

   Each integer represents a "page type." Each type has it's own class.
   Some of the classes create links to sub-pages that aren't defined in
   a nav menu somewhere else. (Like news releases where you may have a
   few links like: $PATH/news/?id=55

2 check each node entry's page type and decide if it creates it's own
   sub-pages or not. There are database records for each page type that
   holds its id, class_name (used when the object is created), an
   "installed" Y/N field and a "recurse" Y/N flag.

3 if "recurse" is set to 'Y', then call that page's class method called
   "get_nodes" - there are no objects of that type specified, so we just
   want to make a static call to the method.

   Then take this node and do a recursive call back to step 1.

Can anyone think of a more elegant or "better" way to do this?

Justin Koivisto -

Re: PHP4 - $class_name::method_name

Quoted text here. Click to load it

Use eval() function.

Re: PHP4 - $class_name::method_name

Justin Koivisto wrote:
Quoted text here. Click to load it



Re: PHP4 - $class_name::method_name

Janwillem Borleffs wrote:

Quoted text here. Click to load it

forgot about that one... thanks!

Justin Koivisto -

Site Timeline