Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- PHP4 - $class_name::method_name
- Justin Koivisto
August 26, 2004, 11:48 pm
rate this thread
$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:
[$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 - email@example.com
- Janwillem Borleffs
August 27, 2004, 2:36 am
Re: PHP4 - $class_name::method_name