您在這裡

首頁自定新聞區塊

Drupaler's 的頭像
Drupaler (未驗證) 在 2009-02-06 (週五) 11:43 發表

我用page-front.tpl
目前我試用幾個用都失敗
一、用view theme wizard ,將程式碼copy至page-front.tpl裡,無法顯示
二、後來找到這個
http://drupalchina.org/node/4311
可是看不懂mysql語法

請問還有其他方法嗎?

我只是想要view 裡面news
來顯示在首頁

thomasfan's 的頭像

News是一個區塊還是頁面呢?
News是用views模組選取出來的嗎?

如果您使用views模組選取出News然後以區塊的方式呈現,這樣您就可以在區塊的管理頁面(/admin/build/block)中設定您所產生出來的news block, 讓他只顯示在首頁。
***************************************
Drupal 水隆投
牛股們(NewGoodMan)

你好
我用你方式,找到相關的文章
http://drupal.org/node/29139
可是試一下
好像找不到regions

我的template.php
<?php
// $Id: template.php,v 1.1.2.9 2008/03/09 18:39:08 derjochenmeyer Exp $

/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($sidebar_left, $sidebar_right) {
if ($sidebar_left != '' && $sidebar_right != '') {
$class = 'sidebars';
}
else {
if ($sidebar_left != '') {
$class = 'sidebar-left';
}
if ($sidebar_right != '') {
$class = 'sidebar-right';
}
}

if (isset($class)) {
print ' class="'. $class .'"';
}
}

function fourseasons_adminwidget($scripts) {

if (empty($scripts)) {
print '
';
}

print '

縮放大小:
60%
70%
80%
100%

';

if (arg(0) == 'admin' && arg(1) == 'build' && arg(2) == 'themes') {
print '';
}

}

/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '

';
}
}

/**
* Allow themable wrapping of all comments.
*/
function phptemplate_comment_wrapper($content, $type = null) {
return '

'. $content . '

';
}

/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {

if ($secondary = menu_secondary_local_tasks()) {
$output = '';
$output .= "

    \n". $secondary ."

\n";
$vars['tabs2'] = $output;
}

return $vars;
}
return array();
}

/**
* Returns the rendered local tasks. The default implementation renders
* them as tabs.
*
* @ingroup themeable
*/
function phptemplate_menu_local_tasks() {
$output = '';

if ($primary = menu_primary_local_tasks()) {
$output .= "

    \n". $primary ."

\n";
}

return $output;
}

/*
* theme_table($header, $rows, $attributes = array(), $caption = NULL)
* includes/theme.inc, line 757
* we modify this to give each table a class and to wrap it into a div
* thus we can add "overflow: auto" to show scrollbars
*/
function phptemplate_table($header, $rows, $attributes = array(), $caption = NULL) {

$output = '

';
$output .= '\n";

if (isset($caption)) {
$output .= ''. $caption ."\n";
}

// Format the table header:
if (count($header)) {
$ts = tablesort_init($header);
$output .= ' ';
foreach ($header as $cell) {
$cell = tablesort_header($cell, $header, $ts);
$output .= _theme_table_cell($cell, TRUE);
}
$output .= " \n";
}

// Format the table rows:
$output .= "\n";
if (count($rows)) {
$flip = array('even' => 'odd', 'odd' => 'even');
$class = 'even';
foreach ($rows as $number => $row) {
$attributes = array();

// Check if we're dealing with a simple or complex row
if (isset($row['data'])) {
foreach ($row as $key => $value) {
if ($key == 'data') {
$cells = $value;
}
else {
$attributes[$key] = $value;
}
}
}
else {
$cells = $row;
}

// Add odd/even class
$class = $flip[$class];
if (isset($attributes['class'])) {
$attributes['class'] .= ' '. $class;
}
else {
$attributes['class'] = $class;
}

// Build row
$output .= ' ';
$i = 0;
foreach ($cells as $cell) {
$cell = tablesort_cell($cell, $header, $ts, $i++);
$output .= _theme_table_cell($cell);
}
$output .= " \n";
}
}

$output .= "\n";
$output .= "

\n";
return $output;
}