GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Tuesday, February 22, 2011

Drupal - Theming The List

Below is the code on how to use theme for list

<?php

/**
 * Implements hook_menu()
 */

function luna_menu(){

    $items = array();
   
    $items['luna/main'] = array(
        'title' => 'Main Menu',
        'page callback' => 'intro',
        'access callback' => TRUE,
        'expanded' => TRUE,
    );
   
    $items['luna/main/list'] = array(
        'title' => 'List',
        'page callback' => 'get_list',
        'access callback' => TRUE,
    );
   
    return $items;

}

function intro(){
    return t('This menu demos to you on how to handle with the theme hook menu');
}

function get_list(){

    $list = array();

    $list[] = t('Passing The University');
    $list[] = t('Getting The Job');
    $list[] = t('Moving To Americas');
    $list[] = t('Building The Business');
   
    $render_array['get_list'] = array(
        '#theme' => 'item_list',       // calling item list
        '#title' => t('Title Demos'),
        '#items' => $list,
        '#type' => 'ol',               // or "ul"
    );
   
    return $render_array;
}


Share/Bookmark

No comments:

Post a Comment