Jump to content

Cant spot parse error


Lassie

Recommended Posts

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');
?>


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.