Betreff: Re: Automatische Generierung von Kategorie-Templates von Gast am 11.03.2004 23:59:33
Hier noch ein kleines Update zur xoops_version.php:
// Templates
$modversion['templates'][1]['file'] = 'news_archive.html';
$modversion['templates'][1]['description'] = '';
$modversion['templates'][2]['file'] = 'news_article.html';
$modversion['templates'][2]['description'] = '';
$modversion['templates'][3]['file'] = 'news_index.html';
$modversion['templates'][3]['description'] = '';
$modversion['templates'][4]['file'] = 'news_item.html';
$modversion['templates'][4]['description'] = '';
$modversion['templates'][5]['file'] = 'news_article1.html';
$modversion['templates'][5]['description'] = 'Kat-ID 1';
global $xoopsDB;
$i = 6;
$result = $xoopsDB->query("SELECT topic_id FROM ".$xoopsDB->prefix("topics")."");
while (list($topic_id) = $xoopsDB->fetchRow($result)) {
$modversion['templates'][$i]['file'] = 'news_article'.$topic_id.'.html';
$modversion['templates'][$i]['description'] = 'Kat-ID '.$topic_id;
$quelle = XOOPS_ROOT_PATH.'/modules/news/templates/news_article.html';
$ziel = XOOPS_ROOT_PATH.'/modules/news/templates/news_article'.$topic_id.'.html';
if ( !file_exists(XOOPS_ROOT_PATH.'/modules/news/templates/news_article'.$topic_id.'.html') ) {
copy($quelle, $ziel);
}
$i++;
}
Leider muss dem templates-Verzeichnis von Hand Schreibrechte gegeben werden.
Der Code für article.php wie im ersten Artikel angegeben ändern.
Nach diesem Beispiel können auch andere Module angepasst werden. Z. B. wfsection, welches nur sehr wenige Templates hat.
|