I'm working on a website with Joomla 3.2.1 and the Protostar template.
I want the article image to be shown before the article info. The order I want is the following one:
article title
intro image
article info
article intro
I tried doing it changing the code on template.css, but it also moves the article info of articles with no intro image, so it isn't a good option for me.
I tried changing the .php files. For example, the default_item.php of the featured articles view. I copied the intro image's code, and pasted it over the article info's code, but the article info is still being shown over the intro image.
What can I do to put the intro image over the article info?
Here is the code for the article items file (default_item.php) in the featured articles page.
<?php
/**
* #package Joomla.Site
* #subpackage com_content
*
* #copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE.txt
*/
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');
$info = $this->item->params->get('info_block_position', 0);
?>
<?php if ($this->item->state == 0) : ?>
<div class="system-unpublished">
<?php endif; ?>
<?php if ($params->get('show_title')) : ?>
<h2 class="item-title">
<?php if ($params->get('link_titles') && $params->get('access-view')) : ?>
<?php echo $this->escape($this->item->title); ?>
<?php else : ?>
<?php echo $this->escape($this->item->title); ?>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if ($this->item->state == 0) : ?>
<span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span>
<?php endif; ?>
<?php if ($params->get('show_print_icon') || $params->get('show_email_icon') || $canEdit) : ?>
<div class="btn-group pull-right"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#" role="button"> <span class="icon-cog"></span> <span class="caret"></span> </a>
<ul class="dropdown-menu">
<?php if ($params->get('show_print_icon')) : ?>
<li class="print-icon"> <?php echo JHtml::_('icon.print_popup', $this->item, $params); ?> </li>
<?php endif; ?>
<?php if ($params->get('show_email_icon')) : ?>
<li class="email-icon"> <?php echo JHtml::_('icon.email', $this->item, $params); ?> </li>
<?php endif; ?>
<?php if ($canEdit) : ?>
<li class="edit-icon"> <?php echo JHtml::_('icon.edit', $this->item, $params); ?> </li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<?php // Todo Not that elegant would be nice to group the params ?>
<?php $useDefList = ($params->get('show_modify_date') || $params->get('show_publish_date') || $params->get('show_create_date')
|| $params->get('show_hits') || $params->get('show_category') || $params->get('show_parent_category') || $params->get('show_author') ); ?>
<?php if ($useDefList && ($info == 0 || $info == 2)) : ?>
<dl class="article-info muted">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?>
</dt>
<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
<dd class="createdby">
<?php $author = $this->item->author; ?>
<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author); ?>
<?php if (!empty($this->item->contactid ) && $params->get('link_author') == true) : ?>
<?php
echo JText::sprintf('COM_CONTENT_WRITTEN_BY',
JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)
); ?>
<?php else :?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_parent_category') && !empty($this->item->parent_slug)) : ?>
<dd class="parent-category-name">
<?php $title = $this->escape($this->item->parent_title);
$url = ''.$title.'';?>
<?php if ($params->get('link_parent_category') && !empty($this->item->parent_slug)) : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd class="category-name">
<?php $title = $this->escape($this->item->category_title);
$url = ''.$title.'';?>
<?php if ($params->get('link_category') && $this->item->catslug) : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd class="published">
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($info == 0) : ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd class="modified">
<span class="icon-calendar"></span>
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd class="create">
<span class="icon-calendar"></span>
<?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd class="hits">
<span class="icon-eye-open"></span>
<?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits); ?>
</dd>
<?php endif; ?>
<?php endif; ?>
</dl>
<?php endif; ?>
<?php if (isset($images->image_intro) && !empty($images->image_intro)) : ?>
<?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> <img
<?php if ($images->image_intro_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/> </div>
<?php endif; ?>
<?php if (!$params->get('show_intro')) : ?>
<?php echo $this->item->event->afterDisplayTitle; ?>
<?php endif; ?>
<?php echo $this->item->event->beforeDisplayContent; ?> <?php echo $this->item->introtext; ?>
<?php if ($useDefList && ($info == 1 || $info == 2)) : ?>
<dl class="article-info muted">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?>
</dt>
<?php if ($info == 1) : ?>
<?php if ($params->get('show_author') && !empty($this->item->author )) : ?>
<dd class="createdby">
<?php $author = $this->item->author; ?>
<?php $author = ($this->item->created_by_alias ? $this->item->created_by_alias : $author); ?>
<?php if (!empty($this->item->contactid ) && $params->get('link_author') == true) : ?>
<?php
echo JText::sprintf('COM_CONTENT_WRITTEN_BY',
JHtml::_('link', JRoute::_('index.php?option=com_contact&view=contact&id='.$this->item->contactid), $author)
); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_parent_category') && !empty($this->item->parent_slug)) : ?>
<dd class="parent-category-name">
<?php $title = $this->escape($this->item->parent_title);
$url = ''.$title.'';?>
<?php if ($params->get('link_parent_category') && $this->item->parent_slug) : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_PARENT', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_category')) : ?>
<dd class="category-name">
<?php $title = $this->escape($this->item->category_title);
$url = ''.$title.'';?>
<?php if ($params->get('link_category') && $this->item->catslug) : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $url); ?>
<?php else : ?>
<?php echo JText::sprintf('COM_CONTENT_CATEGORY', $title); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_publish_date')) : ?>
<dd class="published">
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_PUBLISHED_DATE_ON', JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_create_date')) : ?>
<dd class="create">
<span class="icon-calendar"></span> <?php echo JText::sprintf('COM_CONTENT_CREATED_DATE_ON', JHtml::_('date', $this->item->created, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_modify_date')) : ?>
<dd class="modified">
<span class="icon-calendar"></span>
<?php echo JText::sprintf('COM_CONTENT_LAST_UPDATED', JHtml::_('date', $this->item->modified, JText::_('DATE_FORMAT_LC3'))); ?>
</dd>
<?php endif; ?>
<?php if ($params->get('show_hits')) : ?>
<dd class="hits">
<span class="icon-eye-open"></span> <?php echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits); ?>
</dd>
<?php endif; ?>
</dl>
<?php if ($this->params->get('show_tags', 1)) : ?>
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
<?php endif; ?>
<?php endif; ?>
<?php if ($params->get('show_readmore') && $this->item->readmore) :
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));
endif; ?>
<p class="readmore"><a class="btn" href="<?php echo $link; ?>"> <span class="icon-chevron-right"></span>
<?php if (!$params->get('access-view')) :
echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
elseif ($readmore = $this->item->alternative_readmore) :
echo $readmore;
if ($params->get('show_readmore_title', 0) != 0) :
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif;
elseif ($params->get('show_readmore_title', 0) == 0) :
echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');
else :
echo JText::_('COM_CONTENT_READ_MORE');
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif; ?>
</a></p>
<?php endif; ?>
<?php if ($this->item->state == 0) : ?>
</div>
<?php endif; ?>
<?php echo $this->item->event->afterDisplayContent; ?>
Have you tried to override the template?
Please read the documentation on the link above. They also give examples of the template you just mentioned, for example editing the html/com_content/article/default.php.
Related
This is the selector script I believe below so what should happen is as you select a product then you select if its your an individual or couple or family then you click show me and it takes you to the correct link
<div class="finder__selector">
<?php /* Set first option as the default option */ ?>
<?php $count = 1; while ( have_rows('links') ) : the_row(); ?>
<?php $link_url = get_sub_field('link_url'); ?>
<?php if($product_name): ?>
<?php //echo $product_name; ?>
<?php //echo $link_url; ?>
<?php if(strpos($link_url, $product_name) !== false): ?>
<?php the_sub_field('link_title'); ?><i class="down-arrow"></i>
<?php endif; ?>
<?php else: ?>
<?php if($count == 1) : ?>
<?php the_sub_field('link_title'); ?><i class="down-arrow"></i>
<?php endif; ?>
<?php endif; ?>
<?php $count++; ?>
<?php endwhile; ?>
<div class="finder__options">
<?php $count = 1; ?>
<?php while ( have_rows('links') ) : the_row(); ?>
<?php $link_url_select = get_sub_field('link_url'); ?>
<?php $link_title_select = get_sub_field('link_title'); ?>
<?php if($product_name): ?>
<?php if(strpos($link_url_select, $product_name) !== false): ?>
<?php echo $link_title_select; ?><i class="down-arrow"></i>
<?php else: ?>
<?php echo $link_title_select; ?><i class="down-arrow"></i>
<?php endif; ?>
<?php else: ?>
<?php echo $link_title_select; ?><i class="down-arrow"></i>
<?php endif; ?>
<?php $count++; ?>
<?php endwhile; ?>
</div>
So the above works but whats its actually showing on view source and what creaming frog is 404 is
href="&audience=couples" class=finder__option>
my partner and I <i
class=down-arrow></i>
</a>
<a
href="&audience=families" class=finder__option>
my family <i
class=down-arrow></i>
I'd love to have the option to have my posts displayed in multiple columns/rows (so that I could have several thumbnails/posts horizontally laid out next to each other, instead of only being posted below one another).
I tried changing the layout but sadly nothing happened
can you suggest something?
Thank you guys :D
<?php
/**
* Legacy template for compatibility with versions prior to 2.0.0
*
* #version 2.0.0
*/
?>
<?php if ($instance['before_posts']) : ?>
<div class="upw-before">
<?php echo wpautop($instance['before_posts']); ?>
</div>
<?php endif; ?>
<?php if ($upw_query->have_posts()) : ?>
<table class="table table-bordered">
<?php while ($upw_query->have_posts()) : $upw_query->the_post(); ?>
<tr>
<?php $current_post = ($post->ID == $current_post_id && is_single()) ? 'current-post-item' : ''; ?>
<li class="<?php echo ($post->ID == $current_post_id && is_single())?'current-post-item':'' ?>">
<?php if (current_theme_supports('post-thumbnails') && $instance['show_thumbnail'] && has_post_thumbnail()) : ?>
<td>
<div class="upw-content">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail($instance['thumb_size']); ?>
</a>
<?php endif; ?>
<?php if (get_the_title() && $instance['show_title']) : ?>
<p class="post-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</p>
<?php endif; ?>
</td>
</tr>
<?php if ($instance['show_date']) : ?>
<p class="post-date">
<?php the_time($instance['date_format']); ?>
</p>
<?php endif; ?>
<?php if ($instance['show_author']) : ?>
<p class="post-author">
<span class="post-author-label"><?php _e('By', 'upw'); ?>:</span>
<?php the_author_posts_link(); ?>
</p>
<?php endif; ?>
<?php if ($instance['show_comments']) : ?>
<p class="post-comments">
<?php comments_number(__('No responses', 'upw'), __('One response', 'upw'), __('% responses', 'upw')); ?>
</p>
<?php endif; ?>
<?php if ($instance['show_excerpt']) : ?>
<?php
$linkmore = '';
if ($instance['show_readmore']) {
$linkmore = ' '.$excerpt_readmore.'';
}
?>
<p class="post-excerpt"><?php echo get_the_excerpt() . $linkmore; ?></p>
<?php endif; ?>
<?php if ($instance['show_content']) : ?>
<p class="post-content"><?php the_content() ?></p>
<?php endif; ?>
<?php
$categories = get_the_term_list($post->ID, 'category', '', ', ');
if ($instance['show_cats'] && $categories) :
?>
<p class="post-cats">
<span class="post-cats-label"><?php _e('Categories', 'upw'); ?>:</span>
<span class="post-cats-list"><?php echo $categories; ?></span>
</p>
<?php endif; ?>
<?php
$tags = get_the_term_list($post->ID, 'post_tag', '', ', ');
if ($instance['show_tags'] && $tags) :
?>
<p class="post-tags">
<span class="post-tags-label"><?php _e('Tags', 'upw'); ?>:</span>
<span class="post-tags-list"><?php echo $tags; ?></span>
</p>
<?php endif; ?>
<?php if ($custom_fields) {
$custom_field_name = explode(',', $custom_fields);
foreach ($custom_field_name as $name) {
$name = trim($name);
$custom_field_values = get_post_meta($post->ID, $name, true);
if ($custom_field_values) {
echo '<p class="post-meta post-meta-'.$name.'">';
if (!is_array($custom_field_values)) {
echo $custom_field_values;
} else {
$last_value = end($custom_field_values);
foreach ($custom_field_values as $value) {
echo $value;
if ($value != $last_value) echo ', ';
}
}
echo '</p>';
}
}
} ?>
</div>
</td>
</tr>
<tr>
<td>
<?php endwhile; ?>
</td></tr>
</table>
<?php else : ?>
<p><?php _e('No posts found.', 'upw'); ?></p>
<?php endif; ?>
<?php if ($instance['after_posts']) : ?>
<div class="upw-after">
<?php echo wpautop($instance['after_posts']); ?>
</div>
<?php endif; ?>
I'm trying to create a mod_articles_category layout override for a Joomla 3.2.1 site.
I have 1 parent article category and about 10 child categories under it.
The default is to display the category title in parentheses beneath each article title, which looks crowded and repetitive.
What I'd like to do is display each category title subheading once above each child group of article titles.
So far, I've got it to display the category title (see comment below) but for some strange reason, it is displaying underneath the group of articles it relates to, instead of above it. How can I get it to move above each child group of article titles?
Thanks in advance for any tips.
======================
<ul class="category-module<?php echo $moduleclass_sfx; ?>">
<?php if ($grouped) : ?>
<?php foreach ($list as $group_name => $group) : ?>
<li>
<ul>
<!-- THIS IS THE CATEGORY TITLE SUBHEADING -->
<?php if ($item->displayCategoryTitle) :?>
<h3><?php echo $item->displayCategoryTitle; ?>
</h3>
<?php endif; ?>
<?php foreach ($group as $item) : ?>
<li>
<?php if ($params->get('link_titles') == 1) : ?>
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
<?php echo $item->title; ?>
</a>
<?php else : ?>
<?php echo $item->title; ?>
<?php endif; ?>
<?php if ($item->displayHits) : ?>
<span class="mod-articles-category-hits">
(<?php echo $item->displayHits; ?>)
</span>
<?php endif; ?>
<?php if ($params->get('show_author')) :?>
<span class="mod-articles-category-writtenby">
<?php echo $item->displayAuthorName; ?>
</span>
<?php endif;?>
<?php if ($item->displayDate) : ?>
<span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
<?php endif; ?>
<?php if ($params->get('show_introtext')) :?>
<p class="mod-articles-category-introtext">
<?php echo $item->displayIntrotext; ?>
</p>
<?php endif; ?>
<?php if ($params->get('show_readmore')) :?>
<p class="mod-articles-category-readmore">
<a class="mod-articles-category-title <?php echo $item->active; ?>" href="<?php echo $item->link; ?>">
<?php if ($item->params->get('access-view') == false) :
echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE');
elseif ($readmore = $item->alternative_readmore) :
echo $readmore;
echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit'));
if ($params->get('show_readmore_title', 0) != 0) :
echo JHtml::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
endif;
elseif ($params->get('show_readmore_title', 0) == 0) :
echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE');
else :
echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE');
echo JHtml::_('string.truncate', ($item->title), $params->get('readmore_limit'));
endif; ?>
</a>
</p>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php endforeach; ?>
Change
<?php if ($item->displayCategoryTitle) :?>
<h3><?php echo $item->displayCategoryTitle; ?>
</h3>
<?php endif; ?>
to
<h3><?php echo $group_name; ?></h3>
I am getting the below error:
Parse error: syntax error,
unexpected $end in /var/www/html/joomla/components/com_jtagmembersdirectory/views/memberdetails/tmpl/default.php
on line 147
What could be the possible solution, I searched a number of posts, I do use <?php ?>
No opening and closing bracket issues and no quote issues.
Is there anything else which could cause this problem?
My code is like below,
<?php
defined('_JEXEC') or die('Restricted access');
$user =& JFactory::getUser();
$this->user_id = $user->id;
?>
<div class="Jtag_Members_Directory_details">
<h2 class="page-title"><?php echo JText:: _('JTAG_MEMBER_DETAIL');?></h2>
<div id="jtag-member-list">
<img width="225" src="components/com_jtagmembersdirectory/assets/profile_pictures/small/<?php echo $this->profile->profile_picture ? $this->profile->profile_picture : 'profile2.jpg' ?>" alt="" />
<div class="info details">
<?php if ($this->profile->user_id == $this->user_id && $this->profile->allow_edit):?>
<h2><?php echo $this->profile->name ?></h2>
<?php else:?>
<h2><?php echo $this->profile->name ?></h2>
<?php endif; ?>
<h4><?php echo JText:: _('JTAG_MEMBER_DETAIL_ABOUT_ME');?></h4>
<div><?php echo nl2br($this->profile->member_profile) ?></div>
<ul class="member-details">
<?php if($this->user_id !=0):?>
<?php if($this->profile->hasGallery==1 && $this->profile->display_gallery == 1):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_GALLERY');?></strong></li>
<?php endif;?>
<?php endif;?>
<?php if($this->user_id==0):?>
<?php if($this->profile->display_nr_country==1 && $this->profile->country):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_COUNTRY');?></strong> <?php echo $this->countries[$this->profile->country]; ?></li>
<?php endif;?>
<?php else:?>
<?php if( $this->profile->country):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_COUNTRY');?></strong> <?php echo $this->countries[$this->profile->country]; ?></li>
<?php endif;?>
<?php endif;?>
<?php if($this->user_id==0):?>
<?php if($this->profile->display_nr_city==1 && $this->profile->city):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_CITY');?></strong> <?php echo $this->profile->city; ?></li>
<?php endif;?>
<?php else:?>
<?php if( $this->profile->city && $this->profile->display_city):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_CITY');?></strong> <?php echo $this->profile->city; ?></li>
<?php endif;?>
<?php endif;?>
<?php if($this->user_id==0):?>
<?php if($this->profile->display_nr_state==1 && $this->profile->state):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_STATE');?></strong> <?php echo $this->profile->state; ?></li>
<?php endif;?>
<?php else:?>
<?php if( $this->profile->state ):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_STATE');?></strong> <?php echo $this->profile->state; ?></li>
<?php endif;?>
<?php endif;?>
<?php if($this->user_id==0):?>
<?php if($this->profile->display_nr_phone_no==1 && $this->profile->phone_no):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_PHONE_NO');?></strong> <?php echo $this->profile->phone_no ?></li>
<?php endif;?>
<?php else:?>
<?php if( $this->profile->phone_no && $this->profile->display_phone_no):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_PHONE_NO');?></strong> <?php echo $this->profile->phone_no ?></li>
<?php endif;?>
<?php endif;?>
<?php if($this->user_id==0):?>
<?php if($this->profile->display_nr_email==1 && $this->profile->Email):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_EMAIL');?></strong> <?php echo $this->profile->Email; ?></li>
<?php endif;?>
<?php else:?>
<?php if( $this->profile->Email):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_EMAIL');?></strong> <?php echo $this->profile->Email; ?></li>
<?php endif;?>
<?php endif;?>
<?php if($this->user_id==0):?>
<?php if($this->profile->display_nr_facebook==1 && $this->profile->facebook_page):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_FACEBOOK_PAGE');?></strong> <?php echo $this->profile->facebook_page ?></li>
<?php endif;?>
<?php else:?>
<?php if( $this->profile->facebook_page && $this->profile->display_facebook_page):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_FACEBOOK_PAGE');?></strong> <?php echo $this->profile->facebook_page ?></li>
<?php endif;?>
<?php endif;?>
<?php if($this->user_id==0):?>
<?php if($this->profile->display_nr_twitter==1 && $this->profile->twitter_page):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_TWITTER_PAGE');?></strong> <?php echo $this->profile->twitter_page ?></li>
<?php endif;?>
<?php else:?>
<?php if( $this->profile->twitter_page && $this->profile->display_twitter_page):?>
<li><strong><?php echo JText:: _('JTAG_MEMBER_DETAIL_TWITTER_PAGE');?></strong> <?php echo $this->profile->twitter_page ?></li>
<?php endif;?>
<?php endif;?>
<?php if($this->user_id):?>
<?php foreach ($this->profile->custom_fields as $field): ?>
<?php if ($field->field_label && $field->field_value): ?>
<li><strong><?php echo $field->field_label; ?>:</strong> <?php echo $field->field_value ?></li>
<?php endif; ?>
<?php endforeach; ?>
<?php else: ?>
<?php foreach ($this->profile->custom_fields as $field): ?>
<?php if ($field->field_label && $field->field_value && $field->display_nr_cf): ?>
<li><strong><?php echo $field->field_label; ?>:</strong> <?php echo $field->field_value ?></li>
<?php endif; ?>
<?php endforeach; ?>
<? endif;?>
</ul>
<?php echo JText:: _('BACK_TO_THE_LIST');?>
</div>
</div>
</div>
Unless you have short tags enabled, this line (#131) -
<? endif;?>
will not parse, ending your if
But you have also only posted 137 lines of code, and your code said it is on line #147, so there might be another issue.
I have the following code inside mytemplate/html/com_content/featured/default.php
<?php if (!empty($this->lead_items)) : ?>
<div class="<?php echo $this->pageclass_sfx;?>">
<div class="block-head">
<h2><?php echo $this->escape($this->params->get('page_heading')); ?></h2>
all news
</div><!-- .block-head -->
<?php foreach ($this->lead_items as &$item) : ?>
<dl>
<dt>
<?php
$params = JComponentHelper::getParams( 'com_content' );
$this->item = &$item;
$images = json_decode($item->images);
?>
<?php if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
<?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>" class="img-intro-<?php echo htmlspecialchars($imgfloat); ?>">
<img <?php if ($images->image_intro_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
</a>
<?php endif; ?>
</dt>
<dd>
<var class="date"><?php echo JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC')); ?></var>
<h3><?php echo $this->item->title; ?></h3>
<?php echo $this->item->introtext; ?>
<div class="news-link clearfix">
<?php echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE'); ?>
<div class="line"></div>
</div>
</dd>
<?php
$leadingcount++;
?>
</dl>
<?php endforeach; ?>
All works fine, except the link to category news. Here it is:
all news
How to make it work?
Thank you.
Thank you Lodder for your help. I used your code, just added break to it
<div class="block-head">
<h2><?php echo $this->escape($this->params->get('page_heading')); ?></h2>
<?php foreach ($this->lead_items as &$item) :
$this->item = &$item;
$title = $this->escape($this->item->category_title);
echo 'all '.$title.'';
break;
endforeach; ?>
</div><!-- .block-head -->
The only was I was able to do it was like this:
<div class="block-head">
<h2><?php echo $this->escape($this->params->get('page_heading')); ?></h2>
<?php foreach ($this->lead_items as &$item) :
$this->item = &$item;
echo 'all news';
endforeach; ?>
</div><!-- .block-head -->
It has to be includes inside the foreach statement and contain $this->item = &$item; before it.
Complete Solution
<div class="block-head">
<h2><?php echo $this->escape($this->params->get('page_heading')); ?></h2>
<?php foreach ($this->lead_items as &$item) :
$this->item = &$item;
$title = $this->escape($this->item->category_title);
echo 'all '.$title.'';
break;
endforeach; ?>
</div>
<?php foreach ($this->lead_items as &$item) : ?>
<dl>
<dt>
<?php
$params = JComponentHelper::getParams( 'com_content' );
$this->item = &$item;
$images = json_decode($item->images);
?>
<?php if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
<?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>" class="img-intro-<?php echo htmlspecialchars($imgfloat); ?>">
<img <?php if ($images->image_intro_caption):
echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
endif; ?>
src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
</a>
<?php endif; ?>
</dt>
<dd>
<var class="date"><?php echo JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC')); ?></var>
<h3><?php echo $this->item->title; ?></h3>
<?php echo $this->item->introtext; ?>
<div class="news-link clearfix">
<?php echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE'); ?>
<div class="line"></div>
</div>
</dd>
<?php
$leadingcount++;
?>
</dl>
<?php endforeach; ?>