оформление шаблона

Главные вкладки

Аватар пользователя Cw Cw 29 декабря 2013 в 0:50

Необходима помощь знатоков. Доброй ночи, заканчиваю оформление блога и хотела бы изменить оформление даты публикации статьи, на примере шаблона, там дата 26 июня в таком красном "кружечке" http://demo.themebrain.com/tb_blog/. Я использовала другой шаблон, но этот момент хотела бы вставить.
или подскажите как это дело называется, задаю в гугле всякое, а он не понимает.
Заранее благодарю

Комментарии

Аватар пользователя Cw Cw 29 декабря 2013 в 14:54

Наконец-то нашла, подскажите пожалуйста куда вставить код вот ссылка http://parshinpn.pro/content/%D0%B8%D0%B7%D0%BC%D0%B5%D0%BD%D0%B5%D0%BD%...

Изменение переменной submitted в шаблоне node.tpl.php

В файле template.php своей темы добавьте функцию со следующим кодом:

function MYTHEME_preprocess_node(&$variables){
$variables['date'] = format_date($variables['node']->created, 'custom', 'd.m.y - G:i');
$variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));
}

MYTHEME нужно заменить на название Вашей темы.

В данной функции дата создания ноды задаётся с помощью format_date.

мой template.php выглядит так:
<?php
/**
* Implements hook_html_head_alter().
* This will overwrite the default meta character type tag with HTML5 version.
*/
function business_html_head_alter(&$head_elements) {
$head_elements['system_meta_content_type']['#attributes'] = array(
'charset' => 'utf-8'
);
}
/**
* Insert themed breadcrumb page navigation at top of the node content.
*/
function business_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
if (!empty($breadcrumb)) {
// Use CSS to hide titile .element-invisible.
$output = '

' . t('You are here') . '

';
// comment below line to hide current page to breadcrumb
$breadcrumb[] = drupal_get_title();
$output .= '' . implode(' » ', $breadcrumb) . '';
return $output;
}
}

/**
* Override or insert variables into the html template.
*/
function business_process_html(&$vars) {
// Hook into color.module
if (module_exists('color')) {
_color_html_alter($vars);
}
}

/**
* Override or insert variables into the page template.
*/
function business_process_page(&$variables) {
// Hook into color.module.
if (module_exists('color')) {
_color_page_alter($variables);
}

}

/**
* Override or insert variables into the page template.
*/
function business_preprocess_page(&$vars) {
if (isset($vars['main_menu'])) {
$vars['main_menu'] = theme('links__system_main_menu', array(
'links' => $vars['main_menu'],
'attributes' => array(
'class' => array('links', 'main-menu', 'clearfix'),
),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
)
));
}
else {
$vars['main_menu'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_menu'] = theme('links__system_secondary_menu', array(
'links' => $vars['secondary_menu'],
'attributes' => array(
'class' => array('links', 'secondary-menu', 'clearfix'),
),
'heading' => array(
'text' => t('Secondary menu'),
'level' => 'h2',
'class' => array('element-invisible'),
)
));
}
else {
$vars['secondary_menu'] = FALSE;
}
}

/**
* Duplicate of theme_menu_local_tasks() but adds clearfix to tabs.
*/
function business_menu_local_tasks(&$variables) {
$output = '';

if (!empty($variables['primary'])) {
$variables['primary']['#prefix'] = '

' . t('Primary tabs') . '

';
$variables['primary']['#prefix'] .= '

    ';
    $variables['primary']['#suffix'] = '

';
$output .= drupal_render($variables['primary']);
}
if (!empty($variables['secondary'])) {
$variables['secondary']['#prefix'] = '

' . t('Secondary tabs') . '

';
$variables['secondary']['#prefix'] .= '

    ';
    $variables['secondary']['#suffix'] = '

';
$output .= drupal_render($variables['secondary']);
}
return $output;
}

/**
* Override or insert variables into the node template.
*/
function business_preprocess_node(&$variables) {
$node = $variables['node'];
if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
$variables['classes_array'][] = 'node-full';
}
}

/**
* Add javascript files for front-page jquery slideshow.
*/
if (drupal_is_front_page()) {
drupal_add_js(drupal_get_path('theme', 'business') . '/js/sliding_effect.js');
}

Аватар пользователя Cw Cw 29 декабря 2013 в 15:34

Извините за эти тупые вопросы, я уже увидела, что это бред. Так что еще раз спасибо за помощь, опускаю руки.