I have button with different id's in which i have put them into array so that i can used to anywhere in my project.Just i am not finding way to call them in my project. So i want to use this button separately depending on my requirement. Here is my code:
$page['button'] = array(
1 => array( 'Save','pfeil2r','',"'#'",'','','saveId'),
2 => array( 'Cancel','pfeil2r','',"'#'",'','','CancelId'),
3 => array( 'Remove Widget','pfeil2r','',"'#'",'','','removewidgetId'),
And i want to know how can i call them in this:
'.CreateButton($page['button']).'
I think you don't realy get the way PHP is handling objects and arrays. As kingkero said, the proper way to access your buttons by "id" is
$page['button']['Your id']
As so, you will have to change function that you use to create the actual button. You could create an object that is callable the way you want, but it will be pretty hacky and unlogic. Keep things simple, just pass the proper array entry to the creation method.
KISS.
PHP gives you ability to declare associative array, which comes really handy. So you can create your button array like
$page['button'] = array(
'saveId' => array( 'Save','pfeil2r','',"'#'",'','','saveId'),
'CancelId' => array( 'Cancel','pfeil2r','',"'#'",'','','CancelId'),
'removewidgetId' => array( 'Remove Widget','pfeil2r','',"'#'",'','','removewidgetId'),
and then call it like
'.CreateButton($page['button']['saveId']).'