Code:
--- system/modules/tags_articles/ModuleTaggedArticleList.php.BUILD24 Di 13. Mrz 10:01:14 2012
+++ system/modules/tags_articles/ModuleTaggedArticleList.php Do 29. Mrz 04:07:35 2012
@@ -37,7 +37,7 @@
if (TL_MODE == 'BE')
{
$objTemplate = new BackendTemplate('be_wildcard');
- $objTemplate->wildcard = '### GLOBAL ARTICLE LIST ###';
+ $objTemplate->wildcard = '### TAGGED ARTICLE LIST ###';
return $objTemplate->parse();
}
@@ -71,14 +71,31 @@
// Get published articles
$pids = join($this->arrPages, ",");
+
+ $order_by = 'title ASC';
+ if (isset($GLOBALS['MISC']['tag_articles_id'][$this->id]['ORDER_BY_START'])
+ && in_array($GLOBALS['MISC']['tag_articles_id'][$this->id]['ORDER_BY_START'], array('ASC', 'DESC')))
+ {
+ // Use the 'start' field (Anzeigen ab/Show from) for sorting (interpret it as an article creation/publishing date).
+ // Instead of a backend field in the module, look for the setting in localconfig.php.
+ // If you use this (hidden) feature you probably also might want to add the following 2 lines to dcaconfig.php,
+ // making the start field mandatory (in the DCA, not the DB).
+ // $GLOBALS['TL_DCA']['tl_article']['fields']['start']['eval']['mandatory'] = true;
+ // $GLOBALS['TL_DCA']['tl_article']['fields']['start']['default'] = time();
+ // Note however, after creating a new page, you still have to set the article start date explicitly, because the Contao core
+ // auto inserts an article for you and doesn't check for mandatory fields. As soon as you edit the article settings,
+ // e.g. to add tags :) you'll be forced to also fill in the 'start' field.
+ $order_by = 'start ' . $GLOBALS['MISC']['tag_articles_id'][$this->id]['ORDER_BY_START'] . ', title ASC';
+ }
+
if ($this->show_in_column)
{
- $objArticles = $this->Database->prepare("SELECT id, title, alias, inColumn, cssID FROM tl_article WHERE inColumn = ? AND pid IN (" . $pids . ") " . (!BE_USER_LOGGED_IN ? " AND (start='' OR start<?) AND (stop='' OR stop>?) AND published=1" : "") . " ORDER BY sorting")
+ $objArticles = $this->Database->prepare("SELECT id, pid, title, alias, inColumn, cssID, teaser, start FROM tl_article WHERE inColumn = ? AND pid IN (" . $pids . ") " . (!BE_USER_LOGGED_IN ? " AND (start='' OR start<?) AND (stop='' OR stop>?) AND published=1" : "") . " ORDER BY " . $order_by)
->execute($this->inColumn, $time, $time);
}
else
{
- $objArticles = $this->Database->prepare("SELECT id, title, alias, inColumn, cssID FROM tl_article WHERE pid IN (" . $pids . ") " . (!BE_USER_LOGGED_IN ? " AND (start='' OR start<?) AND (stop='' OR stop>?) AND published=1" : "") . " ORDER BY sorting")
+ $objArticles = $this->Database->prepare("SELECT id, pid, title, alias, inColumn, cssID, teaser, start FROM tl_article WHERE pid IN (" . $pids . ") " . (!BE_USER_LOGGED_IN ? " AND (start='' OR start<?) AND (stop='' OR stop>?) AND published=1" : "") . " ORDER BY " . $order_by)
->execute($time, $time);
}
if ($objArticles->numRows < 1)
@@ -86,18 +103,40 @@
return;
}
+ global $objPage;
+ $format = $objPage->outputFormat;
+ if (!empty($format))
+ {
+ $this->import('String');
+ }
+
while ($objArticles->next())
{
+ /* This code seems to be a useless "left over copy/paste" from an old version of system/modules/frontend/ModuleArticleList.php
// Skip first article
if (++$intCount == 1 && $this->skipFirst)
{
continue;
}
+ */
- $cssID = deserialize($objArticles->cssID, true);
- $alias = strlen($objArticles->alias) ? $objArticles->alias : $objArticles->title;
+ $objArticles->cssID = deserialize($objArticles->cssID, true);
+ // ??? $alias = strlen($objArticles->alias) ? $objArticles->alias : $objArticles->title;
+ $objArticles->startDate = (intval($objArticles->start) > 0) ? $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], intval($objArticles->start)) : '';
+ $objArticles->teaser = $this->replaceInsertTags($objArticles->teaser);
+ if (!empty($format))
+ {
+ if ($format == 'xhtml')
+ {
+ $objArticles->teaser = $this->String->toXhtml($objArticles->teaser);
+ }
+ else
+ {
+ $objArticles->teaser = $this->String->toHtml5($objArticles->teaser);
+ }
+ }
- array_push($this->arrArticles, $objArticles->id);
+ array_push($this->arrArticles, $objArticles->row());
}
}
}
@@ -164,11 +203,11 @@
}
}
- foreach ($this->arrArticles as $objArticleId)
+ foreach ($this->arrArticles as $arrArticle)
{
if (count($tagids) || !$this->hide_on_empty)
{
- if (in_array($objArticleId, $tagids) || (!$this->hide_on_empty && count($tagids) == 0))
+ if (in_array($arrArticle['id'], $tagids) || (!$this->hide_on_empty && count($tagids) == 0))
{
$objTemplate = new FrontendTemplate('taglist');
$objTemplate->showTags = $this->article_showtags;
@@ -192,7 +231,7 @@
}
$pageArr = $objPage->row();
}
- $tags = $this->getTags($objArticleId);
+ $tags = $this->getTags($arrArticle['id']);
foreach ($tags as $id => $tag)
{
$strUrl = ampersand($this->generateFrontendUrl($pageArr, $items . '/tag/' . str_replace(' ', '+', $tag)));
@@ -204,11 +243,11 @@
if ($this->linktoarticles)
{ // link to articles
- $articles[] = array('content' => '{{article::' . $objArticleId . '}}', 'url' => '{{article_url::' . $objArticleId . '}}', 'tags' => $taglist, 'data' => array(), 'html' => '{{insert_article::' . $objArticleId . '}}', 'teaser' => '{{article_teaser::' . $objArticleId . '}}');
+ $articles[] = array('content' => '{{article::' . $arrArticle['id'] . '}}', 'url' => '{{article_url::' . $arrArticle['id'] . '}}', 'tags' => $taglist, 'data' => $arrArticle, 'html' => $this->getArticle($arrArticle['id'], false, true), 'teaser' => $arrArticle['teaser']);
}
else
{ // link to pages
- $articles[] = array('content' => '{{link::' . $objArticleId . '}}', 'url' => '{{link_url::' . $objArticleId . '}}', 'tags' => $taglist, 'data' => array(), 'html' => '{{insert_article::' . $objArticleId . '}}', 'teaser' => '{{article_teaser::' . $objArticleId . '}}');
+ $articles[] = array('content' => '{{link::' . $arrArticle['pid'] . '}}', 'url' => '{{link_url::' . $arrArticle['pid'] . '}}', 'tags' => $taglist, 'data' => $arrArticle, 'html' => $this->getArticle($arrArticle['id'], false, true), 'teaser' => $arrArticle['teaser']);
}
}
}
Änderungen, sortiert nach Wichtigkeit:
Lesezeichen