Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First batch of module tmpl codestyle #17851

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
11 changes: 6 additions & 5 deletions modules/mod_articles_archive/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
*/

defined('_JEXEC') or die;

?>
<?php if (!empty($list)) : ?>
<ul class="archive-module<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
<li>
<a href="<?php echo $item->link; ?>">
<?php echo $item->text; ?>
</a>
</li>
<li>
<a href="<?php echo $item->link; ?>">
<?php echo $item->text; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
3 changes: 2 additions & 1 deletion modules/mod_articles_categories/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*/

defined('_JEXEC') or die;

?>
<ul class="categories-module<?php echo $moduleclass_sfx; ?>">
<?php require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default') . '_items'); ?>
<?php require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default') . '_items'); ?>
</ul>
30 changes: 15 additions & 15 deletions modules/mod_articles_categories/tmpl/default_items.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@

defined('_JEXEC') or die;

foreach ($list as $item) : ?>
?>
<?php foreach ($list as $item) : ?>
<li <?php if ($_SERVER['REQUEST_URI'] === JRoute::_(ContentHelperRoute::getCategoryRoute($item->id))) echo ' class="active"'; ?>> <?php $levelup = $item->level - $startLevel - 1; ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space after <li .
Move the second <?php next line.

<h<?php echo $params->get('item_heading') + $levelup; ?>>
<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id)); ?>">
<?php echo $item->title; ?>
<?php if ($params->get('numitems')) : ?>
(<?php echo $item->numitems; ?>)
<?php endif; ?>
</a>
</h<?php echo $params->get('item_heading') + $levelup; ?>>

<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id)); ?>">
<?php echo $item->title; ?>
<?php if ($params->get('numitems')) : ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 18-20: Remove tab

(<?php echo $item->numitems; ?>)
<?php endif; ?>
</a>
</h<?php echo $params->get('item_heading') + $levelup; ?>>
<?php if ($params->get('show_description', 0)) : ?>
<?php echo JHtml::_('content.prepare', $item->description, $item->getParams(), 'mod_articles_categories.content'); ?>
<?php endif; ?>
<?php if ($params->get('show_children', 0) && (($params->get('maxlevel', 0) == 0)
|| ($params->get('maxlevel') >= ($item->level - $startLevel)))
&& count($item->getChildren())) : ?>
<?php echo '<ul>'; ?>
<?php $temp = $list; ?>
<?php $list = $item->getChildren(); ?>
<?php require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default') . '_items'); ?>
<?php $list = $temp; ?>
<?php echo '</ul>'; ?>
<ul>
<?php $temp = $list; ?>
<?php $list = $item->getChildren(); ?>
<?php require JModuleHelper::getLayoutPath('mod_articles_categories', $params->get('layout', 'default') . '_items'); ?>
<?php $list = $temp; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
126 changes: 57 additions & 69 deletions modules/mod_articles_category/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,71 +13,65 @@
<ul class="category-module<?php echo $moduleclass_sfx; ?>">
<?php if ($grouped) : ?>
<?php foreach ($list as $group_name => $group) : ?>
<li>
<div class="mod-articles-category-group"><?php echo $group_name; ?></div>
<ul>
<?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->displayCategoryTitle) : ?>
<span class="mod-articles-category-category">
(<?php echo $item->displayCategoryTitle; ?>)
</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">
<li>
<div class="mod-articles-category-group"><?php echo $group_name; ?></div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple lines?

<ul>
<?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 if ($item->params->get('access-view') == false) : ?>
<?php echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE'); ?>
<?php elseif ($readmore = $item->alternative_readmore) : ?>
<?php echo $readmore; ?>
<?php echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
<?php if ($params->get('show_readmore_title', 0) != 0) : ?>
<?php echo JHtml::_('string.truncate', $this->item->title, $params->get('readmore_limit')); ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 66-68: Don't indent?

<?php endif; ?>
<?php elseif ($params->get('show_readmore_title', 0) == 0) : ?>
<?php echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE'); ?>
<?php else : ?>
<?php echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE'); ?>
<?php echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
<?php endif; ?>
<?php echo $item->title; ?>
</a>
</p>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</li>
<?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->displayCategoryTitle) : ?>
<span class="mod-articles-category-category">
(<?php echo $item->displayCategoryTitle; ?>)
</span>
<?php endif; ?>
<?php if ($item->displayDate) : ?>
<span class="mod-articles-category-date"><?php echo $item->displayDate; ?></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple lines.

<?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; ?>">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm can you please doube check that? Looks good to me?

<?php if ($item->params->get('access-view') == false) : ?>
<?php echo JText::_('MOD_ARTICLES_CATEGORY_REGISTER_TO_READ_MORE'); ?>
<?php elseif ($readmore = $item->alternative_readmore) : ?>
<?php echo $readmore; ?>
<?php echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
<?php if ($params->get('show_readmore_title', 0) != 0) : ?>
<?php echo JHtml::_('string.truncate', $this->item->title, $params->get('readmore_limit')); ?>
<?php endif; ?>
<?php elseif ($params->get('show_readmore_title', 0) == 0) : ?>
<?php echo JText::sprintf('MOD_ARTICLES_CATEGORY_READ_MORE_TITLE'); ?>
<?php else : ?>
<?php echo JText::_('MOD_ARTICLES_CATEGORY_READ_MORE'); ?>
<?php echo JHtml::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
<?php endif; ?>
</a>
</p>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php endforeach; ?>
<?php else : ?>
<?php foreach ($list as $item) : ?>
Expand All @@ -87,37 +81,31 @@
<?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->displayCategoryTitle) : ?>
<span class="mod-articles-category-category">
(<?php echo $item->displayCategoryTitle; ?>)
</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; ?>">
Expand Down
18 changes: 9 additions & 9 deletions modules/mod_articles_latest/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
defined('_JEXEC') or die;
?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add blank line above.

Is it possible to add lines when editing a file using Github web interface?

<ul class="latestnews<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
<li itemscope itemtype="https://schema.org/Article">
<a href="<?php echo $item->link; ?>" itemprop="url">
<span itemprop="name">
<?php echo $item->title; ?>
</span>
</a>
</li>
<?php endforeach; ?>
<?php foreach ($list as $item) : ?>
<li itemscope itemtype="https://schema.org/Article">
<a href="<?php echo $item->link; ?>" itemprop="url">
<span itemprop="name">
<?php echo $item->title; ?>
</span>
</a>
</li>
<?php endforeach; ?>
</ul>
12 changes: 4 additions & 8 deletions modules/mod_articles_news/tmpl/_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
defined('_JEXEC') or die;

$item_heading = $params->get('item_heading', 'h4');

?>
<?php if ($params->get('item_title')) : ?>

<<?php echo $item_heading; ?> class="newsflash-title<?php echo $params->get('moduleclass_sfx'); ?>">
<?php if ($item->link !== '' && $params->get('link_titles')) : ?>
<a href="<?php echo $item->link; ?>">
Expand All @@ -22,21 +22,17 @@
<?php echo $item->title; ?>
<?php endif; ?>
</<?php echo $item_heading; ?>>

<?php endif; ?>

<?php if (!$params->get('intro_only')) : ?>
<?php echo $item->afterDisplayTitle; ?>
<?php endif; ?>

<?php echo $item->beforeDisplayContent; ?>

<?php if ($params->get('show_introtext', '1')) : ?>
<?php echo $item->introtext; ?>
<?php endif; ?>

<?php echo $item->afterDisplayContent; ?>

<?php if (isset($item->link) && $item->readmore != 0 && $params->get('readmore')) : ?>
<?php echo '<a class="readmore" href="' . $item->link . '">' . $item->linkText . '</a>'; ?>
<a class="readmore" href="<?php echo $item->link; ?>">
<?php echo $item->linkText; ?>
</a>
<?php endif; ?>
1 change: 1 addition & 0 deletions modules/mod_articles_news/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

defined('_JEXEC') or die;

?>
<div class="newsflash<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
Expand Down
2 changes: 1 addition & 1 deletion modules/mod_articles_news/tmpl/horizontal.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*/

defined('_JEXEC') or die;

?>
<ul class="newsflash-horiz<?php echo $params->get('moduleclass_sfx'); ?>">
<?php for ($i = 0, $n = count($list); $i < $n; $i ++) : ?>
<?php $item = $list[$i]; ?>
<li>
<?php require JModuleHelper::getLayoutPath('mod_articles_news', '_item'); ?>

<?php if ($n > 1 && (($i < $n - 1) || $params->get('showLastSeparator'))) : ?>
<span class="article-separator">&#160;</span>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion modules/mod_articles_news/tmpl/vertical.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*/

defined('_JEXEC') or die;

?>
<ul class="newsflash-vert<?php echo $params->get('moduleclass_sfx'); ?>">
<?php for ($i = 0, $n = count($list); $i < $n; $i ++) : ?>
<?php $item = $list[$i]; ?>
<li class="newsflash-item">
<?php require JModuleHelper::getLayoutPath('mod_articles_news', '_item'); ?>

<?php if ($n > 1 && (($i < $n - 1) || $params->get('showLastSeparator'))) : ?>
<span class="article-separator">&#160;</span>
<?php endif; ?>
Expand Down
19 changes: 10 additions & 9 deletions modules/mod_articles_popular/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
*/

defined('_JEXEC') or die;

?>
<ul class="mostread<?php echo $moduleclass_sfx; ?>">
<?php foreach ($list as $item) : ?>
<li itemscope itemtype="https://schema.org/Article">
<a href="<?php echo $item->link; ?>" itemprop="url">
<span itemprop="name">
<?php echo $item->title; ?>
</span>
</a>
</li>
<?php endforeach; ?>
<?php foreach ($list as $item) : ?>
<li itemscope itemtype="https://schema.org/Article">
<a href="<?php echo $item->link; ?>" itemprop="url">
<span itemprop="name">
<?php echo $item->title; ?>
</span>
</a>
</li>
<?php endforeach; ?>
</ul>
Loading