Posted By
level09 on 04/27/09
Tagged
page drupal theming tpl hookmenu
Versions (? )
04/27/09 02:37am 04/27/09 02:26am 04/27/09 02:12am
Advertising
Website Promotion DIRECTORY is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.
Who likes this? 1 person has marked this snippet as a favorite
ReeceMarsland
Drupal Hook_Menu redirect to a themable tpl page
Published in: PHP
Copy this code and paste it in your HTML
<?php
function mymodule_menu( ) {
$items [ 'my-special-page' ] = array ( 'title' => 'This is my custom page' ,
'page callback' => 'my_special_page' ,
'access arguments' => array ( 'access content' ) , 'type' => MENU_CALLBACK,
) ;
return $items ;
}
function my_special_page( ) {
return theme( 'my_special_page' ) ;
}
function mymodule_theme( $existing , $type , $theme , $path ) {
'my_special_page' => array ( 'arguments' => array ( 'options' => NULL ) , 'template' => 'page-my-special-page' ,
) ,
) ;
}
//
//replace the whole page
function mymodule_theme_registry_alter( & $theme_registry ) {
$theme_hook = 'page' ; // my hook name
// Get the path to this module
$modulepath = drupal_get_path( 'module' , 'mymodule' ) ;
// Add the module path on top in the array of paths
array_unshift ( $theme_registry [ $theme_hook ] [ 'theme paths' ] , $modulepath ) ;
}
?>
Report this snippet