lonelytylenol Posted July 17, 2007 Share Posted July 17, 2007 I'm wondering whether something like this is possible: 1. I want to store an id# / function-name pair in a database - e.g. 0001 / functionA(), 0002 / functionB(), 0003 / functionC(), etc. 2. Based on some query, some number of these id / function name pairs are returned. 3. The returned function names are called in a script. More background on my question: I'm building an intranet for my company. There are various departments within my company, each of whom will have their own section of the intranet. I've built various online tools that may be of use to some number of these departments. I want the departments to be able to decide which tools they want to appear on their "home page" within the intranet. In my imagination, each time I create a new tool, I register it in a db table. Each department uses an online form to flag the tools they want to appear on their page. The form they edit updates a db table, linking their department with the id number of the requested tool. The script that creates their home page queries the table, determines the tools they've asked to view on their home page, and calls the appropriate functions that will display these tools. I hope that all makes sense. Thanks! Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 17, 2007 Share Posted July 17, 2007 that is possible or why use the db if your function is not that big you can have them in an array Quote Link to comment Share on other sites More sharing options...
lonelytylenol Posted July 17, 2007 Author Share Posted July 17, 2007 that is possible Ok, so I wasn't clear about what I don't understand: How do I go from the value of an array to a call? In other words, if $myrow[function[0]] = functionA() How do I call functionA()? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 17, 2007 Share Posted July 17, 2007 $array = array ('function1','function2','function2'); $array[0](); //this is now the function1 if you have that or $function1=$array[0]; $function1();//this is now the function1 if you have that ;D is that what you mean? Quote Link to comment Share on other sites More sharing options...
lonelytylenol Posted July 18, 2007 Author Share Posted July 18, 2007 Yep, that's what I meant. Thanks for the help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.