Добрый день! Прошу мне помочь, добрые люди!!!
В шаблоне вывожу img, и мне необходимо им приписать image style + class - colorbox + rel...
Данная конструкция нужна только лишь на одной странице и всего на 9 фото.
Пытаюсь объеденить эти конструкции, но ничего не выходит:
<?php
print theme('image', array(
'path' => drupal_get_path('theme', 'themename') . '/img/demo.png',
'alt' => 'my alt content',
'attributes' => array(
'id' => 'myId',
'class' => 'myClass',
))
);
?>
<?php
echo theme('image_style', array(
'style_name' => 'thumbnail',
'path' => 'public://logo.jpg',
'alt' => 'Image alt',
'title' => 'Image title',
));
?>
Заранее спасибо всем откликнувшимся!
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
Вот что вышло, рабочее:
<?php
$image = theme(
'image_style',
array(
'path' => 'public://img.jpg',
'style_name' => 'style',
'alt' => 'Alternate Text',
'title' => 'Title Text',
'attributes' => array(
'class' => array('colorbox'),
'rel' => 'colorbox-ph'
)
)
);
print $image;
?>
Итоговый код:
<?php
$image = theme(
'image_style',
array(
'path' => 'public://img.jpg',
'style_name' => 'style',
)
);
print '<a class="colorbox" href="http://site.ru/img.jpg" rel="galery-colorbox" title="Title">';
print $image;
print '</a>';
?>
Комментарии
'image_style' => 'item' => 'uri'
'image_style' => 'item' => 'alt'
...
см. theme_image_formatter
Спасибо!
Правильнее было бы вот так:
'image' => array(
'style_name' => 'thumbnail', // image style for showing image on page
'alt' => 'Alt',
'title' => 'Title',
'path' => $image_uri,
),
'path' => file_create_url($image_uri),
'gid' => 'grouping-gallery',
'title' => 'Title in colorbox',
)),
print $image;
И если это вызывается на админских страницах, то надо еще вручную выполнить
_colorbox_doheader();
Иначе colorbox не подцепит свои файлы на страницу.