Posted by manhhainet on January 8, 2011 at 7:13am
Mình muốn customize giao diện trang node/add bằng file tpl.php nhưng vẫn chưa làm được.
Tại bài viết này: http://drupal.org/node/1006404#comment-3866658
có 1 hướng dẫn là thêm file theo dạng này:
page--node--add--blog.tpl.php (for blog)
page--node--add--story.tpl.php (for story)
nhưng mình thêm mà vẫn không được.
Bạn nào biết chia sẻ cách làm cho mình với :)
Comments
Có thêm cái hook
Có thêm cái hook hook_preprocess_page này vô trang template.php chưa
<?php
/**
* Implementation of hook_preprocess_page().
*/
function mytheme_preprocess_page(&$vars) {
// Node template suggestions like page--node--blog.tpl.php
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__node__' . str_replace('_', '--', $vars['node']->type);
}
}
?>
Mình đã implement
Mình đã implement hook_preprocess_page():
function mybartik_preprocess_page(&$variables) {// Node template suggestions like page--node--blog.tpl.php
if (isset($variables['node'])) {
$vars['theme_hook_suggestions'][] = 'page__node__' . str_replace('_', '--', $vars['node']->type);
}
}
Và tạo 1 file mới: page--node--add--article.tpl.php từ file page.tpl.php
Và edit page--node--add--article.tpl.php 1 vài dòng để thấy sự ảnh hưởng. Nhưng kết quả là vẫn vậy.