Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion administrator/language/en-GB/joomla.ini
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ JGLOBAL_BATCH_MOVE_ROW_NOT_FOUND="Can't find the destination row for this move."
JGLOBAL_BATCH_PROCESS="Process"
JGLOBAL_BATCH_WORKFLOW_STATE_ROW_NOT_FOUND="Can't find the destination row for this state change."
JGLOBAL_BLOG="Blog"
JGLOBAL_BLOG_CLASS="Blog Class"
JGLOBAL_BLOG_CLASS_INTRO="Blog Class (Intro Articles)"
JGLOBAL_BLOG_CLASS_LEADING="Blog Class (Leading Articles)"
JGLOBAL_BLOG_COLUMNS="Number of Columns"
JGLOBAL_BLOG_LAYOUT_OPTIONS="Blog Layout"
JGLOBAL_BLOG_ORDER="Ordering direction down"
JGLOBAL_CATEGORIES_OPTIONS="Categories"
JGLOBAL_CATEGORY_LAYOUT_DESC="Layout"
JGLOBAL_CATEGORY_LAYOUT_LABEL="Choose a Layout"
Expand Down
63 changes: 46 additions & 17 deletions components/com_content/tmpl/category/blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @package Joomla.Site
* @subpackage com_content
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

Expand All @@ -29,6 +29,15 @@
$results = $app->triggerEvent('onContentAfterDisplay', array($this->category->extension . '.categories', &$this->category, &$this->params, 0));
$afterDisplayContent = trim(implode("\n", $results));

$blogClassLeading = $this->params->get('blog_class_leading', '');
$blogClassIntro = $this->params->get('blog_class_intro', '');
$numCols = (int) $this->params->get('num_columns', 1);

if ($this->params->get('multi_column_order', 0) && !empty($this->intro_items))
{
// Order articles in columns top down
$blogClassIntro = '';
}
?>
<div class="com-content-category-blog blog" itemscope itemtype="https://schema.org/Blog">
<?php if ($this->params->get('show_page_heading')) : ?>
Expand Down Expand Up @@ -73,7 +82,7 @@

<?php $leadingcount = 0; ?>
<?php if (!empty($this->lead_items)) : ?>
<div class="com-content-category-blog__items blog-items items-leading <?php echo $this->params->get('blog_class_leading'); ?>">
<div class="com-content-category-blog__items blog-items items-leading <?php echo $blogClassLeading; ?>">
<?php foreach ($this->lead_items as &$item) : ?>
<div class="com-content-category-blog__item blog-item"
itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
Expand All @@ -87,22 +96,42 @@
</div>
<?php endif; ?>

<?php
$introcount = count($this->intro_items);
$counter = 0;
?>

<?php if (!empty($this->intro_items)) : ?>
<div class="com-content-category-blog__items blog-items <?php echo $this->params->get('blog_class'); ?>">
<?php foreach ($this->intro_items as $key => &$item) : ?>
<div class="com-content-category-blog__item blog-item"
itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<?php
$this->item = & $item;
echo $this->loadTemplate('item');
?>
</div>
<?php endforeach; ?>
<div class="com-content-category-blog__items blog-items <?php echo $blogClassIntro; ?> ">
<?php $count = count($this->intro_items); ?>
<?php if ($numCols == 1 || $count < $numCols || !$this->params->get('multi_column_order', 0)) :?>
<?php foreach ($this->intro_items as $key => &$item) : ?>
<article class="com-content-category-blog__item blog-item <?php echo !empty($item->orderingClass) ? $item->orderingClass : ''; ?>"
itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<?php
$this->item = & $item;
echo $this->loadTemplate('item');
?>
</article>
<?php endforeach; ?>
<?php else: ?>
<?php $maxRows = ceil($count / $numCols); ?>
<?php $counter = 0; ?>
<div class="d-flex flex-wrap">
<?php for ($c = 0; $c < $numCols; $c++) : ?>
<div class="col">
<?php
for($i = 0; $i < $maxRows && $counter < $count; $i++) :
$item = $this->intro_items[$counter];
$counter++; ?>
<article class="com-content-category-blog__item blog-item"
itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<?php
$this->item = & $item;
echo $this->loadTemplate('item');
?>
</article>
<?php endfor; ?>
</div>
<?php endfor; ?>
</div>
<?php endif; ?>

</div>
<?php endif; ?>

Expand Down
55 changes: 40 additions & 15 deletions components/com_content/tmpl/category/blog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,38 +179,63 @@
<fieldset name="advanced" label="JGLOBAL_BLOG_LAYOUT_OPTIONS" description="JGLOBAL_SUBSLIDER_BLOG_LAYOUT_LABEL">

<field
name="blog_class_leading"
name="num_leading_articles"
type="text"
label="JGLOBAL_BLOG_CLASS_LEADING"
label="JGLOBAL_NUM_LEADING_ARTICLES_LABEL"
useglobal="true"
size="3"
validate="CssIdentifier"
/>

<field
name="blog_class"
name="blog_class_leading"
type="text"
label="JGLOBAL_BLOG_CLASS"
useglobal="true"
size="3"
label="JGLOBAL_BLOG_CLASS_LEADING"
validate="CssIdentifier"
/>

<field
name="num_leading_articles"
name="num_intro_articles"
type="text"
label="JGLOBAL_NUM_LEADING_ARTICLES_LABEL"
label="JGLOBAL_NUM_INTRO_ARTICLES_LABEL"
useglobal="true"
size="3"
/>

<field
name="num_intro_articles"
name="blog_class_intro"
type="text"
label="JGLOBAL_NUM_INTRO_ARTICLES_LABEL"
useglobal="true"
size="3"
label="JGLOBAL_BLOG_CLASS_INTRO"
validate="CssIdentifier"
/>
<field
name="multi_column_order"
type="list"
label="JGLOBAL_BLOG_ORDER"
layout="joomla.form.field.radio.switcher"
validate="options"
default="0"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field
name="num_columns"
type="integer"
label="JGLOBAL_BLOG_COLUMNS"
first="1"
last="6"
step="1"
showon="multi_column_order:1"
/>

<field
name="link_intro_image"
type="list"
label="JGLOBAL_LINKED_INTRO_IMAGE_LABEL"
useglobal="true"
validate="options"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

<field
name="num_links"
Expand Down