Так смотрим, что сейчас есть:
1. Добавил в blog_item.php код который для intro текста и второй readmore
2. Добавил в default.php после заголовка.
Notice: Trying to get property of non-object in БЛАБЛА_ПУТЬ_К_МОЕМУ_ШАБЛОНУ\warp\systems\joomla\layouts\com_content\category\blog_item.php on line 89
В принципе то это не ошибка, а просто предупреждение, что в строке 57 (в моём случае) пытаются получить свойство несуществующего объекта.
Эта строка if ($imgsrc = $img->image_intro)
Выходит объект это картинка которая уменьшится, но она есть.
blog_item.php:
<?php
/**
* @package Warp Theme Framework
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license http://www.gnu.org/licenses/gpl.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die;
// Create a shortcut for params.
$params = &$this->item->params;
$images = json_decode($this->item->images);
$canEdit = $this->item->params->get('access-edit');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.tooltip');
JHtml::core();
?>
<article class="item" data-permalink="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid), true, -1); ?>">
<?php if ($params->get('show_title')) : ?>
<header>
<?php if ($params->get('show_email_icon')) : ?>
<div class="icon email"><?php echo JHtml::_('icon.email', $this->item, $params); ?></div>
<?php endif; ?>
<?php if ($params->get('show_print_icon')) : ?>
<div class="icon print"><?php echo JHtml::_('icon.print_popup', $this->item, $params); ?></div>
<?php endif; ?>
<h1 class="title">
<?php if ($params->get('link_titles') && $params->get('access-view')) : ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>" title="<?php echo $this->escape($this->item->title); ?>"><?php echo $this->escape($this->item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
</h1>
<?php if ($params->get('show_create_date') || ($params->get('show_author') && !empty($this->item->author)) || $params->get('show_category')) : ?>
<p class="meta">
<?php
if ($params->get('show_author') && !empty($this->item->author )) {
$author = $this->item->author;
$author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author);
if (!empty($this->item->contactid ) && $params->get('link_author') == true) {
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid),$author));
} else {
echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author);
}
}
if ($params->get('show_create_date')) {
echo ' '.JText::_('TPL_WARP_ON').' <time datetime="'.substr($this->item->created, 0,10).'" pubdate>'.JHtml::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3')).'</time>';
}
if (($params->get('show_author') && !empty($this->item->author )) || $params->get('show_create_date')) {
echo '. ';
}
if ($params->get('show_category')) {
echo JText::_('TPL_WARP_POSTED_IN').' ';
$title = $this->escape($this->item->category_title);
$url = '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catid)).'">'.$title.'</a>';
if ($params->get('link_category')) {
echo $url;
} else {
echo $title;
}
}
?>
</p>
<?php endif; ?>
</header>
<?php //Вставляем в файл blog_item.php. Не забываем переопределять на уровне своего шаблона
$img = json_decode($this->item->images);
if ($imgsrc = $img->image_intro)
{
echo '<div class="img-blog">';
$h = 100; //Новая высота изображения
$w = 150; //Новая ширина изображения
$path_parts = pathinfo($imgsrc);
$file_thumb = $path_parts['dirname'].'/'.$path_parts['filename'].'_'.$h.'_'.$w.'.'.$path_parts['extension'];
if (!file_exists($file_thumb) || filemtime($file_thumb) <= filemtime($imgsrc))
{
$image = new JImage($imgsrc);
$new_image = $image->resize($w, $h, true, JImage::SCALE_INSIDE );
$properties = $image->getImageFileProperties($imgsrc);
switch ($properties->mime)
{
case 'image/jpeg':
$type = IMAGETYPE_JPEG;
break;
case 'image/png':
$type = IMAGETYPE_PNG;
break;
case 'image/gif':
$type = IMAGETYPE_GIF;
break;
}
$new_image->toFile($file_thumb, $type);
}
$attr = getimagesize(JURI::base().$file_thumb);
echo JHTML::_('image', $file_thumb, htmlspecialchars($img->image_intro_alt), $attr[3]).'</div>';
}
?>
<?php endif; ?>
<?php
if (!$params->get('show_intro')) {
echo $this->item->event->afterDisplayTitle;
}
echo $this->item->event->beforeDisplayContent;
?>
<div class="content clearfix">
<?php
if (isset($images->image_intro) and !empty($images->image_intro)) {
$imgfloat = (empty($images->float_intro))? $params->get('float_intro') : $images->float_intro;
$class = (htmlspecialchars($imgfloat)!= 'none')? ' class="size-auto align-'.htmlspecialchars($imgfloat).'"' : ' class="size-auto"';
$title = ($images->image_intro_caption)? ' title="'.htmlspecialchars($images->image_intro_caption).'"' : '';
echo '<img'.$class.$title.' src="'.htmlspecialchars($images->image_intro).'" alt="'.htmlspecialchars($images->image_intro_alt).'" />';
}
echo $this->item->introtext;
?>
</div>
<?php if ($params->get('show_readmore') && $this->item->readmore) : ?>
<p class="links">
<?php
if ($params->get('access-view')) {
$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
} else {
$menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$itemId = $active->id;
$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
$link = new JURI($link1);
$link->setVar('return', base64_encode($returnURL));
}
?>
<a href="<?php echo $link; ?>" title="<?php echo $this->escape($this->item->title); ?>">
<?php //Вставляем в файл blog_item.php. Не забываем переопределять на уровне своего шаблона
$img = json_decode($this->item->images);
if ($imgsrc = $img->image_fulltext)
{
echo '<div class="img-blog">';
$h = 100; //Новая высота изображения
$w = 150; //Новая ширина изображения
$path_parts = pathinfo($imgsrc);
$file_thumb = $path_parts['dirname'].'/'.$path_parts['filename'].'_'.$h.'_'.$w.'.'.$path_parts['extension'];
if (!file_exists($file_thumb) || filemtime($file_thumb) <= filemtime($imgsrc))
{
$image = new JImage($imgsrc);
$new_image = $image->resize($w, $h, true, JImage::SCALE_INSIDE );
$properties = $image->getImageFileProperties($imgsrc);
switch ($properties->mime)
{
case 'image/jpeg':
$type = IMAGETYPE_JPEG;
break;
case 'image/png':
$type = IMAGETYPE_PNG;
break;
case 'image/gif':
$type = IMAGETYPE_GIF;
break;
}
$new_image->toFile($file_thumb, $type);
}
$attr = getimagesize(JURI::base().$file_thumb);
echo JHTML::_('image', $file_thumb, htmlspecialchars($img->image_fulltext_alt), $attr[3]);
echo '</div>';
}
?>
<?php
if (!$params->get('access-view')) {
echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
} elseif ($readmore = $this->item->alternative_readmore) {
echo $readmore;
} else {
echo JText::_('TPL_WARP_CONTINUE_READING');
}
?>
</a>
</p>
<?php endif; ?>
<?php if ($canEdit) : ?>
<p class="edit"><?php echo JHtml::_('icon.edit', $this->item, $params); ?> <?php echo JText::_('TPL_WARP_EDIT_ARTICLE'); ?></p>
<?php endif; ?>
<?php echo $this->item->event->afterDisplayContent; ?>
</article>