Drupal 6: how to get data from a user module into a template file

im using a custom module to create the contents of my homepage on example.com/frontpage.

in the module, I run a query that receives the data I need in the array. when I return the theme ('page', $ my_array), I get a “home page on the main page”, that is, the default logo and username for drupal is displayed a second time in the main content area.

What is the best way to do this, create a specific tpl.php file whose contents should be ...?

I understand it is a very general question, but after 2 hours I tried to get something and read the tutorials not very far ...

thanks

+3
source share
3

, , , , theme_page. theme_page , .

, , theme_page. , .

<?php

function mymodule_menu() {
  $items = array();

  $items['option1'] = array(
    'title' => 'Front page option #1',
    'access arguments' => array('access content'),
    'page callback' => 'mymodule_option1',
    'type' => MENU_CALLBACK,
  );

  $items['option2'] = array(
    'title' => 'Front page option #2',
    'access arguments' => array('access content'),
    'page callback' => 'mymodule_option2',
    'type' => MENU_CALLBACK,
  );

  return $items;
}

function mymodule_option1() {
  // build HTML content here
  return $content;
}

function mymodule_option2() {
  // build HTML content here
  print theme('page', $content);
  return null;
}
+2

, "", , , , .

( ), page-front.tpl.php( )

0

? , , , .. page.tpl.php $content ( )?

:

print $head;
print $logo, $search, $navbar, $messages;
print $content;
print $footer, $closure;

theme('page', $my_array) $content, $content $logo , .

The first step that I will take in this case is to implement hook_preprocess_page()in the theme template.php file and add some calls dsm()(if you have the devel module installed), or print_r()to see exactly what it does on the page template.
NTN

0
source

Source: https://habr.com/ru/post/1714975/


All Articles