Lassie Posted December 15, 2009 Share Posted December 15, 2009 I have a piece of code trying to display a menu with a horintal tabs. I have a parse error at the end of the code at funtion subMenu-3() but I cant see whats wrong with it. Any help appreciated <?php global $wpdb, $wp_version; define('Authors-1',basename(__FILE__)); // create a top-level menu with submenu pages for wordpress admin function author_menus() { // userlevel=8 restrict users to "Administrators" only add_menu_page('Authors-1', 'Authors', 8, Authors-1, 'demo_content'); add_submenu_page(Authors-1, 'SubMenu-1 Title', 'SubMenu-1', 8, '__FILE__', 'author_content'); add_submenu_page(Authors-1, 'SubMenu-2 Title', 'SubMenu-2', 8, '__FILE__', 'author_content'); add_submenu_page(Authors-1, 'SubMenu-3 Title', 'SubMenu-3', 8, '__FILE__', 'subMenu-3'); } //output style and other code for document <head> function author_head() { global $wp_version; if (version_compare($wp_version, '2.7', '>=')) { ?> <style type="text/css"> #demo-menu { display: inline; position: relative; } #demo-menu a, #demo-menu a.link { text-decoration: none; z-index: 1; margin: 0 auto; padding: 0 6px 0 6px; height: 22px; line-height: 22px; font-size: 10px; background-repeat: no-repeat; background-position: right bottom; } .demo-menu-link { float: right; background: transparent url(images/screen-options-left.gif ) no-repeat 0 0; font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif; height: 22px; padding: 0; margin: 0 6px 0 0; text-decoration: none; text-align:center; } </style> <?php } } // output content for document <body> function author_content() { global $wpdb, $wp_version; if (version_compare($wp_version, '2.7', '>=')) { ?> <ul id="demo-menu"> <li class="demo-menu-link"><a href="?page=Authors-1.php">SubMenu-3</a></li> <li class="demo-menu-link"><a href="?page=demo-page2">SubMenu-2</a></li> <li class="demo-menu-link"><a href="?page=<?php echo DEMOFILE; ?>">SubMenu-1</a></li> </ul> <div style="clear:right;"></div> <?php } ?> <div class="wrap"> <div id="icon-plugins" class="icon32"></div> <h2>Authors Additional Information</h2> <h4>These pages allow you to add additional information to support your book idea or synopsis.<br /> Got to your options page if you want publishers to view this additonal information</h4> <hr/> <?php //output page content for each plugin submenu page if ($_GET['page'] == "Authors-1.php") { } elseif ($_GET['page'] == "demo-page2" ) { print '<p>Demo page 2 content</p>'; } else { //page 1 is default print '<p>Demo page 1 / default content</p>'; echo DEMOFILE; } ?> <hr/> </div> <?php } //end demo_content //function for subMenu-3 function subMenu-3() { echo "submenu-3"; } //incorporate the menu and style into Wordpress admin system add_action('admin_menu', 'author_menus'); //this also adds demo_content add_action('admin_head', 'author_head'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/185207-cant-spot-parse-error/ Share on other sites More sharing options...
Adam Posted December 15, 2009 Share Posted December 15, 2009 Function names cannot contain a hyphen: http://www.php.net/manual/en/functions.user-defined.php Quote Link to comment https://forums.phpfreaks.com/topic/185207-cant-spot-parse-error/#findComment-977712 Share on other sites More sharing options...
Lassie Posted December 15, 2009 Author Share Posted December 15, 2009 Thanks gone blind Quote Link to comment https://forums.phpfreaks.com/topic/185207-cant-spot-parse-error/#findComment-977714 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.