deansatch Posted July 15, 2009 Share Posted July 15, 2009 I have a set of functions which contain different elements of a page. I want to be able to reorder how they appear on a page by pulling the order from the db. e.g. - want to be able to reorder the calling of these functions. display_news(); display_memberlist(); display_features(); Would I have to assign the ordering to the div id and rely on absolute positioning in css, or can I get php to dynamically call each funtion in any order? Quote Link to comment https://forums.phpfreaks.com/topic/166043-solved-dynamically-change-order-of-functions/ Share on other sites More sharing options...
ignace Posted July 15, 2009 Share Posted July 15, 2009 SELECT callback_name, callback_parameters FROM callbacks ORDER BY callback_order $result = mysql_query($query, $db); while (list($callback, $parameters) = mysql_fetch_array($result, MYSQL_NUM)) { call_user_func_array($callback, explode(',', $parameters)); } Quote Link to comment https://forums.phpfreaks.com/topic/166043-solved-dynamically-change-order-of-functions/#findComment-875671 Share on other sites More sharing options...
deansatch Posted July 15, 2009 Author Share Posted July 15, 2009 Thanks for that. call_user_func_array() is a new one for me. Quote Link to comment https://forums.phpfreaks.com/topic/166043-solved-dynamically-change-order-of-functions/#findComment-875680 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.