I
I
idin2017-10-11 00:15:47
PHP
idin, 2017-10-11 00:15:47

I am creating a module with a page in drupal7, why is the page not being created?

I create a module and include it:

function ant_page_reviews_jam_menu()
{
    $items = array();
    $items['reviewss'] = array(
        'page callback' => 'ant_page_reviews_jam_callback',
        'menu_name' => 'main-menu',
        'page arguments' => array(1, 'result'),
        'title' => 'Отзывы', //заголовок страницы
        'access callback' => TRUE, //доступ к странице
        'type' => MENU_NORMAL_ITEM //тип страницы
    );

    return $items;
}




function ant_page_reviews_jam_callback()
{
//    $result = db_query("SELECT * FROM `reviews_vk` ORDER BY `once_id` ");
//    $result->fetchAssoc();
//
    $result=123;
    return $result;
}

The menu item appears, I turn, and there is a white page.
There are no errors in the logs or in the log.
In what a problem I can not understand. It's always been like this before.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav QQ, 2017-10-11
@Izy

Try like this.

function ant_page_reviews_jam_theme() {
  return [
      'page_theme' => [
          'arguments' => array('result' => NULL),
          'template' => 'page-theme-template',
      ],
  ];
}

function ant_page_reviews_jam_callback() {
  $someData = [];
  return theme('page_theme', ['someVar' => $someData]);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question