How to embed page inside custom page?

I'm trying to add new page to elgg 2.0, and I follow the tutorial on "", but it's not working.

it's just shown the form above the navigation bar not in the body area.

this is my plugin directory:











start.php code:


elgg_register_event_handler('init', 'system', 'custompage_init');

function custompage_init() {
    // Register a pagehandler
    elgg_register_page_handler('custompage', 'custompage_page_handler');
    // Extend the main CSS
    elgg_extend_view('css/elgg', 'css/elgg/custompage.css');
    // Add a menu item to the main site menu
    elgg_register_menu_item('site', ElggMenuItem::factory(array(
        'name' => 'custompage',
        'href' => '/custompage',
        'text' => elgg_echo('custompage:custompage'),

function custompage_page_handler($page, $handler) {
    if (!isset($page[0])) {
        $page[0] = 'index';
    $plugin_path = elgg_get_plugins_path();
    $pages = $plugin_path . 'custompage/pages/custompage';
    switch ($page[0]) {
        case 'index':
            include "$pages/index.php";
            return false;
    return true;


index.php code:


// Get the user
$user = elgg_get_logged_in_user_entity();
$icon = elgg_view_entity_icon($user, 'large', array('use_hover' => false));
$body = elgg_view_layout(include 'forms.php');
echo elgg_view_page("", $body);


forms.php code:

<form name="main" method="POST">
    <input type="text" name="name" value="" />
    <input type="submit" value="submit" name="submit" />


Please help me solve this problem...