http://community.conpresso.de/viewtopic ... 2485#22485
hier nun eine Version für eine zufällige Anordnung (um die Seiten abwechslungsreicher zu gestalten - Google liebt das):
in _include/common.inc.php
Code: Alles auswählen
// some defaults for common options (these need translations)
$articleSortMethodsDefault = 'idx, pub_datum desc';
$articleSortMethods = array(
__('by index, date (newest on top)') => 'idx, pub_datum desc',
__('by index, date (oldest on top)') => 'idx, pub_datum asc',
__('manual') => 'sort_id desc'
);
Code: Alles auswählen
// some defaults for common options (these need translations)
$articleSortMethodsDefault = 'idx, pub_datum desc';
$articleSortMethods = array(
__('by index, date (newest on top)') => 'idx, pub_datum desc',
__('by index, date (oldest on top)') => 'idx, pub_datum asc',
__('zufällig') => 'titel, idx asc',
__('manual') => 'sort_id desc'
);
Code: Alles auswählen
$GLOBALS['lastUpdated'] = 0;
$articleSeparator = '';
while($db->next_record()) {
echo $articleSeparator;
$db_template = $db->v('templates_id');
$db_nr = $db->v('nr');
$db_idx = $db->v('idx');
$db_email = $db->v('email');
$db_autor = $db->v('autor');
$db_changer = $db->v('changer');
$db_pub_datum = $db->v('pub_datum');
$db_verfallsdatum = $db->v('verfallsdatum');
$db_commentary = $db->v('commentary');
$db_titel = $db->v('titel');
$db_initial = $db->v('initial');
$db_freigabe = $db->v('freigabe');
$db_rubric_id = $db->v('rubric_id');
$db_last_modify = $db->v('last_modify');
if ($GLOBALS['lastUpdated']<strtotime($db_last_modify)) {
$GLOBALS['lastUpdated'] = strtotime($db_last_modify);
}
require(CPO_BASEDIR.'_include/select_template.php');
$articleSeparator = $cpoRubricSettings['articleSeparator'];
}
Code: Alles auswählen
$GLOBALS['lastUpdated'] = 0;
$articleSeparator = '';
if ($cpoRubricSettings['sorting'] != 'titel, idx asc') { // keine Zufallswiedergabe
while($db->next_record()) {
echo $articleSeparator;
$db_template = $db->v('templates_id');
$db_nr = $db->v('nr');
$db_idx = $db->v('idx');
$db_email = $db->v('email');
$db_autor = $db->v('autor');
$db_changer = $db->v('changer');
$db_pub_datum = $db->v('pub_datum');
$db_verfallsdatum = $db->v('verfallsdatum');
$db_commentary = $db->v('commentary');
$db_titel = $db->v('titel');
$db_initial = $db->v('initial');
$db_freigabe = $db->v('freigabe');
$db_rubric_id = $db->v('rubric_id');
$db_last_modify = $db->v('last_modify');
if ($GLOBALS['lastUpdated']<strtotime($db_last_modify)) {
$GLOBALS['lastUpdated'] = strtotime($db_last_modify);
}
require(CPO_BASEDIR.'_include/select_template.php');
$articleSeparator = $cpoRubricSettings['articleSeparator'];
}
} elseif ($cpoRubricSettings['sorting'] == 'titel, idx asc') { // Zufallswiedergabe
$randArticles = array();
$ordNr = 0;
while($db->next_record()) {
$randArticles[$ordNr]['db_template'] = $db->v('templates_id');
$randArticles[$ordNr]['db_nr'] = $db->v('nr');
$randArticles[$ordNr]['db_idx'] = $db->v('idx');
$randArticles[$ordNr]['db_email'] = $db->v('email');
$randArticles[$ordNr]['db_autor'] = $db->v('autor');
$randArticles[$ordNr]['db_changer'] = $db->v('changer');
$randArticles[$ordNr]['db_pub_datum'] = $db->v('pub_datum');
$randArticles[$ordNr]['db_verfallsdatum'] = $db->v('verfallsdatum');
$randArticles[$ordNr]['db_commentary'] = $db->v('commentary');
$randArticles[$ordNr]['db_titel'] = $db->v('titel');
$randArticles[$ordNr]['db_initial'] = $db->v('initial');
$randArticles[$ordNr]['db_freigabe'] = $db->v('freigabe');
$randArticles[$ordNr]['db_rubric_id'] = $db->v('rubric_id');
$randArticles[$ordNr]['db_last_modify'] = $db->v('last_modify');
$ordNr++;
}
shuffle($randArticles);
foreach ($randArticles AS $outputArticle) {
echo $articleSeparator;
$db_template = $outputArticle['db_template'];
$db_nr = $outputArticle['db_nr'];
$db_idx = $outputArticle['db_idx'];
$db_email = $outputArticle['db_email'];
$db_autor = $outputArticle['db_autor'];
$db_changer = $outputArticle['db_changer'];
$db_pub_datum = $outputArticle['db_pub_datum'];
$db_verfallsdatum = $outputArticle['db_verfallsdatum'];
$db_commentary = $outputArticle['db_commentary'];
$db_titel = $outputArticle['db_titel'];
$db_initial = $outputArticle['db_initial'];
$db_freigabe = $outputArticle['db_freigabe'];
$db_rubric_id = $outputArticle['db_rubric_id'];
$db_last_modify = $outputArticle['db_last_modify'];
if ($GLOBALS['lastUpdated']<strtotime($db_last_modify)) {
$GLOBALS['lastUpdated'] = strtotime($db_last_modify);
}
require(CPO_BASEDIR.'_include/select_template.php');
$articleSeparator = $cpoRubricSettings['articleSeparator'];
}
}