473,386 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

PHP4 - $class_name::method_name

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

$rslt=$class_name::get_nodes($branch,$db,$pg_title );

$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 - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #1
3 2798
Justin Koivisto wrote:
Time for me to ask a question for you all... This is what I want to
do:

$rslt=$class_name::get_nodes($branch,$db,$pg_title );

$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?


See: http://nl.php.net/manual/en/function.call-user-func.php
JW

Jul 17 '05 #2
Janwillem Borleffs wrote:
Justin Koivisto wrote:
Time for me to ask a question for you all... This is what I want to
do:

$rslt=$class_name::get_nodes($branch,$db,$pg_tit le);

$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?


See: http://nl.php.net/manual/en/function.call-user-func.php


forgot about that one... thanks!

--
Justin Koivisto - sp**@koivi.com
http://www.koivi.com
Jul 17 '05 #3
"Justin Koivisto" <sp**@koivi.com> wrote in message news:_f*****************@news7.onvoy.net...
Time for me to ask a question for you all... This is what I want to do:

$rslt=$class_name::get_nodes($branch,$db,$pg_title );

$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?


Use eval() function.
eval("\$rslt=$class_name::get_nodes(\$branch,\$db, \$pg_title);");
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: zimba | last post by:
Hello ! If somebody is interested, here is a small hack I've done today. There are still some curious effects, but I'm pretty satisfied by the results, since PHP is not very flexible. Let...
2
by: Janick | last post by:
During developement and testing it often happens that some java-procedure loops which leads to a infitly running java-interpreter consuming 99.9% of cpu. Now I wondered if there are some...
7
by: Rhino | last post by:
I was reading the DB2 for Linux/Unix/Windows (V7.2) manuals just now to get some background information about UDFs when I came across this: "Note that valuable debugging tools such as printf() do...
8
by: Rhino | last post by:
I'm trying to use the JDBC Universal driver to get a Type 4 connection in a Java client program running under DB2 V8.2.1 but I keep getting a "connection refused: connect" message. I'm running...
2
by: Michael | last post by:
Running DB2 v7 UDB ("DB2 v7.1.0.93", "n031208" and "WR21333") on Windows XP, I am unable to find out why the "Build for Debug" option within Stored Procedure Builder is not enabled on Java stored...
2
by: technocrat | last post by:
HOW CAN THIS BE DONE IN JAVA??? THIS IS POSITIONED UPDATE EXEC SQL DECLARE C1 CURSOR FOR SELECT * FROM EMPLOYEE FOR UPDATE OF JOB; EXEC SQL OPEN C1;
4
by: Stefan | last post by:
Hi, is there a way to get informations from tabelspaces of a db2 (datafiles) via java (jdbc)? Thanx... Stefan
4
by: Paul Jansen | last post by:
Don't go away yet... this is a bit more complicated than 'how do I take a method address'! I have a class foo, and method foo::bar. I also have a tree of foo objects, which I process...
1
by: pandabijay | last post by:
Hi All I am new to GDB in C++.I want to debug C++ files.Just Like I have a project called FDFL in which I am having several files(FDFLConsole.h,FDFLConsole.cpp,FDFLDB.h,FDFLDB.cpp an so on..) and I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.