TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 06-20-2008, 06:55 PM   #1 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default Variable class names

I'm building a module system into something I'm coding right now, and in determining the best way to build a menu based off what modules/plugins are available I came across something I'm not sure if I can do or not.

Right now I have a very simple stopgap in that uses GET information to determine what module to load and the module takes care of the view and controller. The problem is I have the sidebar navigation menu hardcoded, and I want to make this dynamic. My first idea was to build a database of what modules were available (simply by running a check to see what files were in the module directory and running checks against them to determine that they fit the program), then after running through this list I would have a static displayMenu() method in each of these modules that could be called to build the menu.

The problem I ran into is calling these methods dynamically, assuming that the super class has no idea what their names are. I wrote a quick three second test to see if I could assign their names to a variable and call them via that;

PHP Code:
class static_var_test
{

    public static function 
displayMenu () {
        echo 
"worked";
    }
}

$var 'static_var_test';

$var::displayMenu(); 
...very basic, just to see if I could do something like this, but apparently not. Suggestions?
-m
delayedinsanity is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 03:46 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design