nathanmaxsonadil Posted December 20, 2007 Share Posted December 20, 2007 Hi there, I was wondering what am I doing wrong here? when I go to my site the div is completely empty if ( function_exists('register_sidebar') ) register_sidebar(array( 'before_widget' => '<div id="'.cor().'"><ul><li>', 'after_widget' => '</ul></li></ul><br/></div>', 'before_title' => '<div class="submenu"><div class="submenu_line1">', 'after_title' => '</div></div><ul class="list-cat">', )); Link to comment https://forums.phpfreaks.com/topic/82574-a-function-in-a-array/ Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 You're not printing out those strings anywhere, just setting the variables. Show us more of the relevant code, we don't know what register_sidebar does. Link to comment https://forums.phpfreaks.com/topic/82574-a-function-in-a-array/#findComment-419767 Share on other sites More sharing options...
nathanmaxsonadil Posted December 20, 2007 Author Share Posted December 20, 2007 this is in my functions file in wordpress http://automattic.com/code/widgets/themes/ here's the code for my function cor() $num = "category_"; $num1 = "category_"; $num2 = "category"; function cor() { if ($num == $num1){ $num = $num2; }ELSE{ $num = $num1; } echo $num; } Link to comment https://forums.phpfreaks.com/topic/82574-a-function-in-a-array/#findComment-419774 Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 Your reply makes no sense. If you're working in Wordpress this might do better in third-party scripts. if register_sidebar is a wordpress function. Link to comment https://forums.phpfreaks.com/topic/82574-a-function-in-a-array/#findComment-419776 Share on other sites More sharing options...
nathanmaxsonadil Posted December 20, 2007 Author Share Posted December 20, 2007 register sidebar is not the problem the question was how to make cor() appear in the array? Link to comment https://forums.phpfreaks.com/topic/82574-a-function-in-a-array/#findComment-419778 Share on other sites More sharing options...
Jessica Posted December 20, 2007 Share Posted December 20, 2007 cor doesn't return a value, it echos it. Change echo to return. Link to comment https://forums.phpfreaks.com/topic/82574-a-function-in-a-array/#findComment-419780 Share on other sites More sharing options...
trq Posted December 20, 2007 Share Posted December 20, 2007 he question was how to make cor() appear in the array You didn't ask a question. You simply posted some statements. Link to comment https://forums.phpfreaks.com/topic/82574-a-function-in-a-array/#findComment-419849 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.