Добрый день. Вопрос такой: При отображении ноды с изображением в кратком содержании все работает правильно, но если перейти в полное содержание (открыть статью) - как не меняй - ихображение всегда 480х480 вместо установленной 300х300 или любой другой. В предпросмотре материала при редактировании все нормально отображается (300х300), но при просмотре после сохранения опять! показывает 480х480.
В чем может быть проблема?
Атрибуты папки (777) в которой сохраняется загруженная картинка, в вьюсе тоже правильно работает отображение. Устанавливал по инструкции. Заранее спасибо за ответ.
P.S. Теперь в любом типе материала при выборе формата изображения и настройки остается при просмотре 480х480, а в настройках стоит 300х300 (какой не ставь, не помогает)
Комментарии
В CSS не задан точный размер для img?
И еще не совсем понятно когда размер становится 480px, при просмотре ноды, или при открытии изображения в colorbox?
CSS должен подхватывать настройки colorbox`a, я так думал. До этого все работало. 480 при просмотре ноды. Могу дать ссылку на страницу, если это поможет
Давайте, с этого стоило начать.
your-baby com ua На главной 1-я новость о бцж - размер правильный, если открыть ноду, то траблы. Спасибо большое
Для вывода изображения на странице используется стиль изображений "large", измените на тот который Вам нужен в настройках дисплея материала "Содержимое полностью" (your-baby.com.ua/admin/structure/types/manage/news/display/full)
И теперь не понятно при чем здесь Colorbox?
Добавил 2 файла. Формат выбираю ColorBox и как на картинке стиль 220х220 к примеру. Даже если выберу Формат "изображение" - не меняет. Возможно с доступом или не пишет в базу? Все сделано для полного отображения
Кеш почистили?
Да, как "больной" клацаю на очистку кеша)
А на сервере вообще есть картинка в папке нужного стиля?
Да, и самое странное то, что при предпросмотре материала размер нормальный
Ок.
Идем сначала, если вопросы будут казаться глупыми - не обижайтесь:
Значит, заходите в редактирование типа содержимого, в настройки дисплея "Содержимое полностью" и для поля изображение ставите форматтер "Colorbox", в его настройках ставите стиль изображения "Medium" нажимаете "Обновить" и нажимаете "Сохранить". Сбрасываете кеш. Все верно?
1. После очистки кеша, на странице настроек дисплея настройки отображаются правильные? как и сохраняли?
2. В настройках стиля изображения "Medium" размеры правильные выставлены? 220х220?
3. Вы не вносили изменения в вывод содержимого в node--news.tpl.php в Вашей теме? Там весь контент выводится через
<?php print render($content); ?>
?Да, все так и делал, изменений не вносил никаких.
А есть вообще node--news.tpl.php в теме?
Покажите его содержимое если есть, или node.tpl.php если нет.
magnific-popup это что? И от куда берется?
Что за тема вообще, в её настройках нет чего то типо "Отображать изображения во всплывающем окне"?
Вот этот код открывает изображения вместо Colorbox'а.
<!--//--><![CDATA[//><!--
jQuery(document).ready(function($) {
$(window).load(function() {
$(".image-popup").magnificPopup({
type:"image",
removalDelay: 300,
mainClass: "mfp-fade",
gallery: {
enabled: true, // set to true to enable gallery
}
});
});
});
//--><!]]>
</script>
Подозреваю что он добавлен либо в page.tpl.php, либо в tamplate.php
Может этот плагин и меняет вывод картинки.
есть только node.tpl.php. Прикрепил
Куда?
не крепится
nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
<?php if ($display_submitted || (module_exists('comment') && ($node->comment == COMMENT_NODE_OPEN || ($node->comment == COMMENT_NODE_CLOSED && $node->comment_count > 0)))): ?>
<?php if ($display_submitted): ?>
<?php $custom_day = format_date($node->created, 'custom', 'd'); ?>
<?php $custom_year = format_date($node->created, 'custom', 'Y'); ?>
<?php endif;?>
<?php if (module_exists('comment') && ($node->comment == COMMENT_NODE_OPEN || ($node->comment == COMMENT_NODE_CLOSED && $node->comment_count > 0))): ?>
<?php endif;?>
<?php endif;?>
<?php if ($display_submitted || (module_exists('comment') && ($node->comment == COMMENT_NODE_OPEN || ($node->comment == COMMENT_NODE_CLOSED && $node->comment_count > 0)))) { ?>
<?php if ($title_prefix || $title_suffix || $display_submitted || !$page): ?>
<?php print render($title_prefix); ?>
<?php if (!$page): ?>
>"><?php print $title; ?>
<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($display_submitted): ?>
<?php endif; ?>
<?php print $user_picture; ?>
<?php endif; ?>
<?php
// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
print render($content);
?>
<?php if ($links = render($content['links'])): ?>
<?php print render($content['links']); ?>
<?php endif; ?>
<?php print render($content['comments']); ?>
Недавно на сайт добавил AdSense модуль и соответственно рекламу гугла, связано ли оно?
Вряд ли.
Попробуйте изменить тему на Bartik, посмотрите, будет ли нормально отображать.
Отображается все нрмально с темой Батрик. Почему?)
Тема переопределяет вывод изображений.
Выше я писал предположение "Почему".
Либо менять тему, либо ковырять эту.
Спасибо большое за внимание, буду ковырять ... интересна причина
Нашел такой файл, называется field--field_image.tpl.php
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div>
<?php endif; ?>
<?php
// Reduce number of images in teaser view mode to single image
if ($element['#view_mode'] == 'teaser') : ?>
<div class="field-item field-type-image even"<?php print $item_attributes[0]; ?>><?php print render($items[0]); ?></div>
<?php return; endif; ?>
<?php $node=$element['#object']; $lang="und"; ?>
<div class="images-container clearfix">
<div class="image-preview">
<a class="image-popup overlayed" href="<?php print file_create_url($node->field_image[$lang][0]['uri']); ?>" title="<?php print $node->field_image[$lang][0]['title']; ?>">
<img src="<?php print image_style_url('large', $node->field_image[$lang][0]['uri']); ?>" alt="<?php print $node->field_image[$lang][0]['alt']; ?>" title="<?php print $node->field_image[$lang][0]['title']; ?>"/>
<span class="overlay large"><i class="fa fa-plus"></i></span>
</a>
<?php if ($node->field_image[$lang][0]['title'] || $node->field_image[$lang][0]['alt']) :?>
<div class="image-caption hidden-xs">
<?php if ($node->field_image[$lang][0]['title']) :?>
<h4><?php print $node->field_image[$lang][0]['title']; ?></h4>
<?php endif; ?>
<?php if ($node->field_image[$lang][0]['alt']) :?>
<p><?php print $node->field_image[$lang][0]['alt']; ?></p>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
<?php $numberOfImages=0; foreach ($node->field_image[$lang] as $key=>$file) { $numberOfImages++; } ?>
<?php if ($numberOfImages>1) { ?>
<div class="image-listing-items">
<?php $i=0; foreach ($node->field_image[$lang] as $key=>$file) {
if ($key==0) { continue; }
$i++; ?>
<div class="image-listing-item">
<a class="image-popup overlayed" href="<?php print file_create_url($node->field_image[$lang][$key]['uri']) ?>" title="<?php print $node->field_image[$lang][$key]['title']; ?>">
<img src="<?php print image_style_url('small', $node->field_image[$lang][$key]['uri']); ?>" alt="<?php print $node->field_image[$lang][$key]['alt']; ?>" title="<?php print $node->field_image[$lang][$key]['title']; ?>"/>
<span class="overlay small"><i class="fa fa-plus"></i></span>
</a>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<?php
drupal_add_js(drupal_get_path('theme', 'startupgrowth_lite') .'/js/magnific-popup/jquery.magnific-popup.js', array('preprocess' => false));
drupal_add_css(drupal_get_path('theme', 'startupgrowth_lite') . '/js/magnific-popup/magnific-popup.css');
drupal_add_js('
jQuery(document).ready(function($) {
$(window).load(function() {
$(".image-popup").magnificPopup({
type:"image",
removalDelay: 300,
mainClass: "mfp-fade",
gallery: {
enabled: true, // set to true to enable gallery
}
});
});
});',array('type' => 'inline', 'scope' => 'footer', 'weight' => 3)
);
?>
Вот и удалите его, или переименуйте.
Не забывайте следить за ним при обновлениях темы.
Drupal-way: создайте субтему и переопределите переопределенный в основной теме шаблон поля. Звучит грозно, но тяжелого ничего нет.
Вот стандартный темплейт для поля:
/**
* @file field.tpl.php
* Default template implementation to display the value of a field.
*
* This file is not used and is here as a starting point for customization only.
* @see theme_field()
*
* Available variables:
* - $items: An array of field values. Use render() to output them.
* - $label: The item label.
* - $label_hidden: Whether the label display is set to 'hidden'.
* - $classes: String of classes that can be used to style contextually through
* CSS. It can be manipulated through the variable $classes_array from
* preprocess functions. The default values can be one or more of the
* following:
* - field: The current template type, i.e., "theming hook".
* - field-name-[field_name]: The current field name. For example, if the
* field name is "field_description" it would result in
* "field-name-field-description".
* - field-type-[field_type]: The current field type. For example, if the
* field type is "text" it would result in "field-type-text".
* - field-label-[label_display]: The current label position. For example, if
* the label position is "above" it would result in "field-label-above".
*
* Other variables:
* - $element['#object']: The entity to which the field is attached.
* - $element['#view_mode']: View mode, e.g. 'full', 'teaser'...
* - $element['#field_name']: The field name.
* - $element['#field_type']: The field type.
* - $element['#field_language']: The field language.
* - $element['#field_translatable']: Whether the field is translatable or not.
* - $element['#label_display']: Position of label display, inline, above, or
* hidden.
* - $field_name_css: The css-compatible field name.
* - $field_type_css: The css-compatible field type.
* - $classes_array: Array of html class attribute values. It is flattened
* into a string within the variable $classes.
*
* @see template_preprocess_field()
* @see theme_field()
*
* @ingroup themeable
*/
?>
<!--
THIS FILE IS NOT USED AND IS HERE AS A STARTING POINT FOR CUSTOMIZATION ONLY.
See http://api.drupal.org/api/function/theme_field/7 for details.
After copying this file to your theme's folder and customizing it, remove this
HTML comment.
-->
<div class="<?php print $classes; ?>"<?php print $attributes; ?>>
<?php if (!$label_hidden): ?>
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div>
<?php endif; ?>
<div class="field-items"<?php print $content_attributes; ?>>
<?php foreach ($items as $delta => $item): ?>
<div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div>
<?php endforeach; ?>
</div>
</div>
Страшновато звучит. Ошибку выдал:
Warning: include(/home/uh204696/domains/your-baby.com.ua/public_html/sites/all/themes/startupgrowth_lite/field--field_image.tpl.php): failed to open stream: No such file or directory в функции theme_render_template() (строка 1525 в файле /home/uh204696/domains/your-baby.com.ua/public_html/includes/theme.inc).
Warning: include(): Failed opening '/home/uh204696/domains/your-baby.com.ua/public_html/sites/all/themes/startupgrowth_lite/field--field_image.tpl.php' for inclusion (include_path='.:/usr/local/lib/php') в функции theme_render_template() (строка 1525 в файле /home/uh204696/domains/your-baby.com.ua/public_html/includes/theme.inc).
Мне создать файл field.tpl.php? и потом переопределить что-то куда-то? ) запутался совсем((
Посмотрите template.php в корне темы.
Там где то должен вызываться пререндер.
не нашел(
Извините за беспокойство, достал наверное. Может напишите что искать, хоть название какое-нибудь.
Есть кнопочка "Вставка кода", выбираете что нужно отображать и вставляете.
<?php /**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return
* A string containing the breadcrumb output.
*/
function startupgrowth_lite_breadcrumb($variables){
if (!empty($breadcrumb)) {
$breadcrumb[] = drupal_get_title();
return '<div>' . implode(' <span class="breadcrumb-separator"></span>', $breadcrumb) . '</div>';
}
} /**
* Add classes to block.
*/
function startupgrowth_lite_preprocess_block(&$variables) {
$variables['classes_array'][]='clearfix';
} /**
* Override or insert variables into the html template.
*/
function startupgrowth_lite_preprocess_html(&$variables) {
if (empty(
$variables['page']['banner'])) {$variables['classes_array'][] = 'no-banner';
}
$color_scheme = theme_get_setting('color_scheme');
if ($color_scheme != 'default') {
drupal_add_css(path_to_theme() . '/style-' .$color_scheme. '.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-1' &&theme_get_setting('slogan_font_family')=='slff-1' ||
theme_get_setting('headings_font_family')=='hff-1' ||
theme_get_setting('paragraph_font_family')=='pff-1') {
drupal_add_css(path_to_theme() . '/fonts/merriweather-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-2' ||
theme_get_setting('slogan_font_family')=='slff-2' ||
theme_get_setting('headings_font_family')=='hff-2' ||
theme_get_setting('paragraph_font_family')=='pff-2') {
drupal_add_css(path_to_theme() . '/fonts/sourcesanspro-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-3' ||theme_get_setting('slogan_font_family')=='slff-3' ||
theme_get_setting('headings_font_family')=='hff-3' ||
theme_get_setting('paragraph_font_family')=='pff-3') {
drupal_add_css(path_to_theme() . '/fonts/ubuntu-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-4' ||
theme_get_setting('slogan_font_family')=='slff-4' ||
theme_get_setting('headings_font_family')=='hff-4' ||
theme_get_setting('paragraph_font_family')=='pff-4') {
drupal_add_css(path_to_theme() . '/fonts/ptsans-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-5' ||theme_get_setting('slogan_font_family')=='slff-5' ||
theme_get_setting('headings_font_family')=='hff-5' ||
theme_get_setting('paragraph_font_family')=='pff-5') {
drupal_add_css(path_to_theme() . '/fonts/roboto-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-6' ||theme_get_setting('slogan_font_family')=='slff-6' ||
theme_get_setting('headings_font_family')=='hff-6' ||
theme_get_setting('paragraph_font_family')=='pff-6') {
drupal_add_css(path_to_theme() . '/fonts/opensans-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-7' ||
theme_get_setting('slogan_font_family')=='slff-7' ||
theme_get_setting('headings_font_family')=='hff-7' ||
theme_get_setting('paragraph_font_family')=='pff-7') {
drupal_add_css(path_to_theme() . '/fonts/lato-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-8' ||
theme_get_setting('slogan_font_family')=='slff-8' ||
theme_get_setting('headings_font_family')=='hff-8' ||
theme_get_setting('paragraph_font_family')=='pff-8') {
drupal_add_css(path_to_theme() . '/fonts/roboto-condensed-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-9' ||
theme_get_setting('slogan_font_family')=='slff-9' ||
theme_get_setting('headings_font_family')=='hff-9' ||
theme_get_setting('paragraph_font_family')=='pff-9') {
drupal_add_css(path_to_theme() . '/fonts/exo-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-10' ||
theme_get_setting('slogan_font_family')=='slff-10' ||
theme_get_setting('headings_font_family')=='hff-10' ||
theme_get_setting('paragraph_font_family')=='pff-10') {
drupal_add_css(path_to_theme() . '/fonts/roboto-slab-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-11' ||
theme_get_setting('slogan_font_family')=='slff-11' ||
theme_get_setting('headings_font_family')=='hff-11' ||
theme_get_setting('paragraph_font_family')=='pff-11') {
drupal_add_css(path_to_theme() . '/fonts/raleway-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-12' ||
theme_get_setting('slogan_font_family')=='slff-12' ||
theme_get_setting('headings_font_family')=='hff-12' ||
theme_get_setting('paragraph_font_family')=='pff-12') {
drupal_add_css(path_to_theme() . '/fonts/josefin-sans-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-14' ||theme_get_setting('slogan_font_family')=='slff-14' ||
theme_get_setting('headings_font_family')=='hff-14' ||
theme_get_setting('paragraph_font_family')=='pff-14') {
drupal_add_css(path_to_theme() . '/fonts/playfair-display-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-15' ||
theme_get_setting('slogan_font_family')=='slff-15' ||
theme_get_setting('headings_font_family')=='hff-15' ||
theme_get_setting('paragraph_font_family')=='pff-15') {
drupal_add_css(path_to_theme() . '/fonts/philosopher-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-16' ||
theme_get_setting('slogan_font_family')=='slff-16' ||
theme_get_setting('headings_font_family')=='hff-16' ||
theme_get_setting('paragraph_font_family')=='pff-16') {
drupal_add_css(path_to_theme() . '/fonts/cinzel-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-17' ||
theme_get_setting('slogan_font_family')=='slff-17' ||
theme_get_setting('headings_font_family')=='hff-17' ||
theme_get_setting('paragraph_font_family')=='pff-17') {
drupal_add_css(path_to_theme() . '/fonts/oswald-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-18' ||theme_get_setting('slogan_font_family')=='slff-18' ||
theme_get_setting('headings_font_family')=='hff-18' ||
theme_get_setting('paragraph_font_family')=='pff-18') {
drupal_add_css(path_to_theme() . '/fonts/playfairdisplaysc-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-19' ||
theme_get_setting('slogan_font_family')=='slff-19' ||
theme_get_setting('headings_font_family')=='hff-19' ||
theme_get_setting('paragraph_font_family')=='pff-19') {
drupal_add_css(path_to_theme() . '/fonts/cabin-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (theme_get_setting('sitename_font_family')=='sff-20' ||
theme_get_setting('slogan_font_family')=='slff-20' ||
theme_get_setting('headings_font_family')=='hff-20' ||
theme_get_setting('paragraph_font_family')=='pff-20') {
drupal_add_css(path_to_theme() . '/fonts/notosans-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-22' ||theme_get_setting('slogan_font_family')=='slff-22' ||
theme_get_setting('headings_font_family')=='hff-22' ||
theme_get_setting('paragraph_font_family')=='pff-22') {
drupal_add_css(path_to_theme() . '/fonts/droidserif-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-23' ||theme_get_setting('slogan_font_family')=='slff-23' ||
theme_get_setting('headings_font_family')=='hff-23' ||
theme_get_setting('paragraph_font_family')=='pff-23') {
drupal_add_css(path_to_theme() . '/fonts/ptserif-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-24' ||theme_get_setting('slogan_font_family')=='slff-24' ||
theme_get_setting('headings_font_family')=='hff-24' ||
theme_get_setting('paragraph_font_family')=='pff-24') {
drupal_add_css(path_to_theme() . '/fonts/vollkorn-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-25' ||theme_get_setting('slogan_font_family')=='slff-25' ||
theme_get_setting('headings_font_family')=='hff-25' ||
theme_get_setting('paragraph_font_family')=='pff-25') {
drupal_add_css(path_to_theme() . '/fonts/alegreya-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-26' ||theme_get_setting('slogan_font_family')=='slff-26' ||
theme_get_setting('headings_font_family')=='hff-26' ||
theme_get_setting('paragraph_font_family')=='pff-26') {
drupal_add_css(path_to_theme() . '/fonts/notoserif-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-27' ||theme_get_setting('slogan_font_family')=='slff-27' ||
theme_get_setting('headings_font_family')=='hff-27' ||
theme_get_setting('paragraph_font_family')=='pff-27') {
drupal_add_css(path_to_theme() . '/fonts/crimsontext-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-28' ||theme_get_setting('slogan_font_family')=='slff-28' ||
theme_get_setting('headings_font_family')=='hff-28' ||
theme_get_setting('paragraph_font_family')=='pff-28') {
drupal_add_css(path_to_theme() . '/fonts/gentiumbookbasic-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-29' ||theme_get_setting('slogan_font_family')=='slff-29' ||
theme_get_setting('headings_font_family')=='hff-29' ||
theme_get_setting('paragraph_font_family')=='pff-29') {
drupal_add_css(path_to_theme() . '/fonts/volkhov-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
if (
theme_get_setting('sitename_font_family')=='sff-31' ||theme_get_setting('slogan_font_family')=='slff-31' ||
theme_get_setting('headings_font_family')=='hff-31' ||
theme_get_setting('paragraph_font_family')=='pff-31') {
drupal_add_css(path_to_theme() . '/fonts/alegreyasc-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
}
drupal_add_css(path_to_theme() . '/fonts/ptserif-blockquote-font.css', array('group' => CSS_THEME, 'type' => 'file' , 'preprocess' => FALSE));
/**
* Add local.css file for CSS overrides.
*/
drupal_add_css(path_to_theme() . '/local.css', array('group' => CSS_THEME, 'type' => 'file'));
* Bootstrap CDN
*/
if (theme_get_setting('bootstrap_css_cdn')) {
$cdn = '//maxcdn.bootstrapcdn.com/bootstrap/' . theme_get_setting('bootstrap_css_cdn') . '/css/bootstrap.min.css';
drupal_add_css($cdn, array('type' => 'external'));
}
if (theme_get_setting('bootstrap_js_cdn')) {
$cdn = '//maxcdn.bootstrapcdn.com/bootstrap/' . theme_get_setting('bootstrap_js_cdn') . '/js/bootstrap.min.js';
drupal_add_js($cdn, array('type' => 'external'));
}
/**
* Add Javascript for enable/disable scrollTop action.
*/
if (theme_get_setting('scrolltop_display')) {
drupal_add_js('jQuery(document).ready(function($) {
$(window).scroll(function() {
if($(this).scrollTop() != 0) {
$("#toTop").addClass("show");
} else {
$("#toTop").removeClass("show");
}
});
$("#toTop").click(function() {
$("body,html").animate({scrollTop:0},800);
});
});',
array('type' => 'inline', 'scope' => 'header'));
}
//EOF:Javascript
/**
* Add Javascript for responsive mobile menu
*/
if (theme_get_setting('responsive_menu_state')) {
if (theme_get_setting('responsive_menu_optgroups')) {
drupal_add_js(path_to_theme() .'/js/jquery.mobilemenu.js');
} else {
drupal_add_js(path_to_theme() .'/js/jquery.mobilemenu-no-optgroups.js');
}
$responsive_menu_nested = theme_get_setting('responsive_menu_nested');
$responsive_menu_switchwidth = (int) theme_get_setting('responsive_menu_switchwidth');
$responsive_menu_topoptiontext=theme_get_setting('responsive_menu_topoptiontext');
drupal_add_js(array('startupgrowth_lite' => array('topoptiontext' => $responsive_menu_topoptiontext)), 'setting');
$responsive_menu_nested = theme_get_setting('responsive_menu_nested');
drupal_add_js('jQuery(document).ready(function($) {
$("#main-navigation ul.main-menu, #main-navigation .content>ul.menu").mobileMenu({
prependTo: "#main-navigation",
combine: false,
nested: '.$responsive_menu_nested.',
switchWidth: '.$responsive_menu_switchwidth.',
topOptionText: Drupal.settings.startupgrowth_lite[\'topoptiontext\']
});
});',
array('type' => 'inline', 'scope' => 'header'));
}
//EOF:Javascript
/**
if (theme_get_setting('google_map_js')) {* Add Javascript for Google Map
*/
var map;
,var myLatlng;
var myZoom;
var marker;
});'
array('type' => 'inline', 'scope' => 'header')
);
drupal_add_js('https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false',array('type' => 'external', 'scope' => 'header', 'group' => 'JS_THEME'));
drupal_add_js(array('startupgrowth_lite' => array('google_map_latitude' => $google_map_latitude)), 'setting');
$google_map_longitude = theme_get_setting('google_map_longitude');
drupal_add_js(array('startupgrowth_lite' => array('google_map_longitude' => $google_map_longitude)), 'setting');
$google_map_zoom = (int) theme_get_setting('google_map_zoom');
$google_map_canvas = theme_get_setting('google_map_canvas');
drupal_add_js(array('startupgrowth_lite' => array('google_map_canvas' => $google_map_canvas)), 'setting');
drupal_add_js('jQuery(document).ready(function($) {
if ($("#'
.$google_map_canvas.'").length) {myLatlng = new google.maps.LatLng(Drupal.settings.startupgrowth[\'google_map_latitude\'], Drupal.settings.startupgrowth[\'google_map_longitude\']);
myZoom = '.$google_map_zoom.';
function initialize() {
var mapOptions = {
zoom: myZoom,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: myLatlng,
scrollwheel: false
};
map = new google.maps.Map(document.getElementById(Drupal.settings.startupgrowth[\'google_map_canvas\']),mapOptions);
marker = new google.maps.Marker({
map:map,
draggable:true,
position: myLatlng,
url: "https://www.google.com/maps/dir//'.$google_map_latitude.','.$google_map_longitude.'/@'.$google_map_latitude.','.$google_map_longitude.'"
});
google.maps.event.addListener(marker, "click", function() {
window.open(this.url, "_blank");
});
google.maps.event.addDomListener(window, "resize", function() {
,map.setCenter(myLatlng);
});
}
google.maps.event.addDomListener(window, "load", initialize);
}
});'
array('type' => 'inline', 'scope' => 'header')
);
}
if ($fixed_header) {
* Add Javascript
*/
drupal_add_js('jQuery(document).ready(function($) {
var headerHeight = $("#header").height();
,$(window).scroll(function() {
if(($(this).scrollTop() > headerHeight) && ($(window).width() > 767)) {
$("body").addClass("onscroll");
$("body").css("paddingTop", (headerHeight)+"px");
if( $(this).scrollTop() > headerHeight+40 ) {
$("body").addClass("show");
}
} else {
$("body").removeClass("onscroll");
$("body").removeClass("show");
$("body").css("paddingTop", (0)+"px");
$("body.logged-in").css("paddingTop", (64)+"px");
}
});
});'
array('type' => 'inline', 'scope' => 'header'));
//EOF:Javascript
}
if (
$responsive_meanmenu) {drupal_add_js(path_to_theme() .'/js/meanmenu/jquery.meanmenu.min.js', array('preprocess' => false));
/**
* Add Javascript
*/
drupal_add_js('jQuery(document).ready(function($) {
$("#main-navigation .sf-menu, #main-navigation .content>ul.menu, #main-navigation ul.main-menu").wrap("<div class=\'meanmenu-wrapper\'></div>");
$("#main-navigation .meanmenu-wrapper").meanmenu({
meanScreenWidth: "767",
meanRemoveAttrs: true,
meanMenuContainer: "#header-inside",
meanMenuClose: ""
});
});'
,array('type' => 'inline', 'scope' => 'header'));
//EOF:Javascript
$parallax_state = theme_get_setting('parallax_state');
if (
$parallax_state) {$variables['classes_array'][] = 'parallax-active';
$parallax_opacity = (int) theme_get_setting('parallax_opacity')/100;
* Add Javascript
*/
drupal_add_js('jQuery(document).ready(function($) {
$(window).load(function() {
.$parallax_opacity.')");$("#highlighted-bottom-transparent-bg").css("backgroundColor", "rgba(255,255,255,'
});
});'
,array('type' => 'inline', 'scope' => 'header'));
//EOF:Javascript
}
/*** Override or insert variables into the html template.
*/
function startupgrowth_lite_process_html(&$vars) {
$classes[] = theme_get_setting('sitename_font_family');
$classes[] = theme_get_setting('slogan_font_family');
$classes[] = theme_get_setting('headings_font_family');
$classes[] = theme_get_setting('paragraph_font_family');
$classes[] = theme_get_setting('form_style');
$classes[] = theme_get_setting('layout_mode');
$vars['classes'] = trim(implode(' ', $classes));
}
/*** Preprocess variables for page template.
*/
function startupgrowth_lite_preprocess_page(&$variables) {
* Insert variables into the page template.
*/
if (isset($variables['node']) && $variables['node']->type != 'page' ) {
if($variables['page']['sidebar_first'] && $variables['page']['sidebar_second']) {
$variables['main_grid_class'] = 'col-md-6';
$variables['sidebar_grid_class'] = 'col-md-3';
} elseif ($variables['page']['sidebar_first'] && !$variables['page']['sidebar_second']) {
$variables['main_grid_class'] = 'col-md-8';
$variables['sidebar_grid_class'] = 'col-md-4 fix-sidebar-first';
} elseif (!$variables['page']['sidebar_first'] && $variables['page']['sidebar_second']) {
$variables['main_grid_class'] = 'col-md-8';
$variables['sidebar_grid_class'] = 'col-md-4 fix-sidebar-second';
} else {
$variables['main_grid_class'] = 'col-md-8 col-md-offset-2';
$variables['sidebar_grid_class'] = '';
}
} else {
$variables['page']['sidebar_first'] && $variables['page']['sidebar_second']) {if(
$variables['main_grid_class'] = 'col-md-6';
$variables['sidebar_grid_class'] = 'col-md-3';
} elseif ($variables['page']['sidebar_first'] && !$variables['page']['sidebar_second']) {
$variables['main_grid_class'] = 'col-md-8';
$variables['sidebar_grid_class'] = 'col-md-4 fix-sidebar-first';
} elseif (!$variables['page']['sidebar_first'] && $variables['page']['sidebar_second']) {
$variables['main_grid_class'] = 'col-md-8';
$variables['sidebar_grid_class'] = 'col-md-4 fix-sidebar-second';
} else {
$variables['main_grid_class'] = 'col-md-12';
$variables['sidebar_grid_class'] = '';
}
}
if(
$variables['page']['highlighted_bottom_right'] && $variables['page']['highlighted_bottom_left']) {$variables['highlighted_bottom_left_grid_class'] = 'col-md-8';
$variables['highlighted_bottom_right_grid_class'] = 'col-md-4';
} elseif ($variables['page']['highlighted_bottom_right'] || $variables['page']['highlighted_bottom_left']) {
$variables['highlighted_bottom_right_grid_class'] = 'col-md-12';
$variables['highlighted_bottom_left_grid_class'] = 'col-md-12';
}
}
/*** Implements hook_preprocess_maintenance_page().
*/
function startupgrowth_lite_preprocess_maintenance_page(&$variables) {
if ($color_scheme != 'default') {
drupal_add_css(path_to_theme() . '/style-' .$color_scheme. '.css', array('group' => CSS_THEME, 'type' => 'file'));
}
}
function
startupgrowth_lite_page_alter($page) {'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'MobileOptimized',
'content' => 'width'
)
);
$handheldfriendly = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'HandheldFriendly',
'content' => 'true'
)
);
$viewport = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1'
)
);
drupal_add_html_head($mobileoptimized, 'MobileOptimized');
drupal_add_html_head($handheldfriendly, 'HandheldFriendly');
drupal_add_html_head($viewport, 'viewport');
}
function
startupgrowth_lite_form_alter(&$form, &$form_state, $form_id) {if ($form_id == 'search_block_form') {
unset($form['search_block_form']['#title']);
$form['search_block_form']['#title_display'] = 'invisible';
$form_default = t('Enter terms then hit Search...');
$form['search_block_form']['#default_value'] = $form_default;
}
}
?>Покажите template.php
Прикрепил файл, но переименовал его и изменил расширение. template.php -> template.txt
А если удалить field--field_image.tpl.php выдает ошибку?
Или Вы просто меняли его содержимое?
Выдает ошибку, описанную выше. Если изменить содержимое, то стандартно будет применяться 1 стиль, указанный в этом файле.
Замените просто содержимое файла на
<?php if (!$label_hidden): ?>
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div>
<?php endif; ?>
<div class="field-items"<?php print $content_attributes; ?>>
<?php foreach ($items as $delta => $item): ?>
<div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div>
<?php endforeach; ?>
</div>
</div>
Сорри, сейчас просто не очень со временем, более детально вникать.
Отлично!!! Спасибо большое за помощь Пока работает так, у самого времени маловато) отвлекает работа.