[ create a new paste ] login | about

Link: http://codepad.org/oQIFUFmf    [ raw code | output | fork ]

PHP, pasted on Dec 20:
{
	function show_top_menu($option) {
		global $viewpoint;
		echo '<ul>';
		if(isset($viewpoint['pages_topmenu']) && $viewpoint['pages_topmenu'] != '' )
			$pages = get_pages( array('include' => $viewpoint['pages_topmenu'], 'sort_column' => 'menu_order', 'sort_order' => 'ASC') );
		else
			$pages = get_pages('number=4');
		if(isset($viewpoint['blog_page']) && $viewpoint['blog_page'] != '')
			$pages[] = $viewpoint['blog_page'];
		$count = count($pages);
		for($i = 0; $i < $count / 2; $i++)
		{
			echo '<li><a href="' . get_home_url() . '/#' . $pages[$i]->post_name . '">' . $pages[$i]->post_title . '</a></li>' . PHP_EOL;
		}
		if($option == 1) echo '<li style="border: 0"><span class="logo"><span class="logotext">' . $viewpoint['logo_text'] . '</span></span></li>' . PHP_EOL;
		for($i = round($count / 2); $i < $count; $i++)
		{
			if($i == $count-1 && isset($viewpoint['blog_page']) && $viewpoint['blog_page'] != '')
				echo '<li><a href="' . get_permalink($viewpoint['blog_page'][0]) . '">Blog</a></li>';
			else
			{
				echo '<li><a href="' . get_home_url() . '/#' . $pages[$i]->post_name . '">' . $pages[$i]->post_title . '</a></li>' . PHP_EOL;
			}
		}
		echo '<li><a href="' . get_home_url() . '/#contact">Contact</a></li>' . PHP_EOL;
		echo '</ul>';
	}
}


Output:
{
	function show_top_menu($option) {
		global $viewpoint;
		echo '<ul>';
		if(isset($viewpoint['pages_topmenu']) && $viewpoint['pages_topmenu'] != '' )
			$pages = get_pages( array('include' => $viewpoint['pages_topmenu'], 'sort_column' => 'menu_order', 'sort_order' => 'ASC') );
		else
			$pages = get_pages('number=4');
		if(isset($viewpoint['blog_page']) && $viewpoint['blog_page'] != '')
			$pages[] = $viewpoint['blog_page'];
		$count = count($pages);
		for($i = 0; $i < $count / 2; $i++)
		{
			echo '<li><a href="' . get_home_url() . '/#' . $pages[$i]->post_name . '">' . $pages[$i]->post_title . '</a></li>' . PHP_EOL;
		}
		if($option == 1) echo '<li style="border: 0"><span class="logo"><span class="logotext">' . $viewpoint['logo_text'] . '</span></span></li>' . PHP_EOL;
		for($i = round($count / 2); $i < $count; $i++)
		{
			if($i == $count-1 && isset($viewpoint['blog_page']) && $viewpoint['blog_page'] != '')
				echo '<li><a href="' . get_permalink($viewpoint['blog_page'][0]) . '">Blog</a></li>';
			else
			{
				echo '<li><a href="' . get_home_url() . '/#' . $pages[$i]->post_name . '">' . $pages[$i]->post_title . '</a></li>' . PHP_EOL;
			}
		}
		echo '<li><a href="' . get_home_url() . '/#contact">Contact</a></li>' . PHP_EOL;
		echo '</ul>';
	}
}


Create a new paste based on this one


Comments: