I have a category which has (currently) 3 articles. The first article I have acts as an introduction to the remaining trailing articles.
The category under which these articles reside has a Top Article Count set to one.
This has the effect of display the first article in full and the remaining articles sub titles one after the other.
What I want to do now is modify how this list is displayed.
There doesn't seem to be a template for doing this, so I imagine I have to go in and hack some code. Just a simple change to the SQL and HTML output should suffice.
Can anyone tell me where I would find the code which is used to generate a list of articles?
Thanks
Article listing template question
"front.func.inc.php"
Code: Select all
function list_articles_summary ($article_list, $template_default, $cat_id=0) {
// returns an article listing only with headline and summary text
// and with an listing of all other available articles of this category
$listing = $template_default["space_top"]; //start with space at top
$tmpllist = array(); //temporary array for storing templates to minimize load
$temp_topcount = $GLOBALS['content']['struct'][ $GLOBALS['content']['cat_id'] ]['acat_topcount'];
$temp_counter = 0;
foreach($article_list as $key => $value) {
//$article_link = $link_to."?id=".$cat_id.",".$article_list[$key]["article_id"].",0,0,1,0";
$article_link = "index.php?id=".$article_list[$key]["article_cid"].",".$article_list[$key]["article_id"].",0,0,1,0";
//if($temp_counter < $template_default["top_count"]) {
if($temp_counter < $temp_topcount) {
// as long as the counter is lower than the default "top_count" value
// show the complete article summary listing
//build image/image link
$article_list[$key]["article_image"]["poplink"] = '';
if($article_list[$key]["article_image"]["cname"]) {
$article_list[$key]["article_image"]["cname"] = $GLOBALS['phpwcms']["content_path"].$GLOBALS['phpwcms']["cimage_path"].$article_list[$key]["article_image"]["cname"];
$article_list[$key]["article_image"]["cname"] = '<img src="'.$article_list[$key]["article_image"]["cname"].'" border="0" alt="">';
if($article_list[$key]["article_image"]["zoom"]) {
$article_list[$key]["article_image"]["poplink"] = 'image_zoom.php?show='.base64_encode($article_list[$key]["article_image"]['prev']);
$article_list[$key]["article_image"]["poplink"] = '<a href="'.$article_list[$key]["article_image"]["poplink"].'" '.
'onClick="window.open(\''.$article_list[$key]["article_image"]["poplink"].
"','previewpic','width=".$article_list[$key]["article_image"]['prev_info'][0].
",height=".$article_list[$key]["article_image"]['prev_info'][1].
"');return false;\">".$article_list[$key]["article_image"]["cname"].'</a>';
}
}
// article list based template check
if($article_list[$key]["article_image"]['tmpllist'] && $article_list[$key]["article_image"]['tmpllist']!='default') {
// try to read the template files
// 1. try to check if template was read
if(!isset($tmpllist[ $article_list[$key]["article_image"]['tmpllist'] ])) {
$tmpllist[ $article_list[$key]["article_image"]['tmpllist'] ] = include_ext_php(PHPWCMS_ROOT.$GLOBALS['phpwcms']['templates'].'inc_cntpart/articlesummary/list/'.$article_list[$key]["article_image"]['tmpllist'], 1);
}
if($tmpllist[ $article_list[$key]["article_image"]['tmpllist'] ]) {
//rendering
$tmpl = $tmpllist[ $article_list[$key]["article_image"]['tmpllist'] ];
$tmpl = render_cnt_template($tmpl, 'TITLE', html_specialchars($article_list[$key]["article_title"]));
$tmpl = render_cnt_template($tmpl, 'SUB', html_specialchars($article_list[$key]["article_subtitle"]));
$tmpl = render_cnt_template($tmpl, 'SUMMARY', $article_list[$key]["article_summary"]);
$tmpl = render_cnt_template($tmpl, 'IMAGE', $article_list[$key]["article_image"]["cname"]);
$tmpl = render_cnt_template($tmpl, 'ZOOMIMAGE', $article_list[$key]["article_image"]["poplink"]);
$tmpl = render_cnt_template($tmpl, 'CAPTION', nl2br(html_specialchars($article_list[$key]["article_image"]["caption"])));
$tmpl = render_cnt_template($tmpl, 'ARTICLELINK', $article_link);
$tmpl = render_cnt_template($tmpl, 'MORE', $template_default["top_readmore_link"]);
$tmpl = render_cnt_template($tmpl, 'BEFORE', '<!--before//-->');
$tmpl = render_cnt_template($tmpl, 'AFTER', '<!--after//-->');
$tmpl = render_cnt_date($tmpl, $article_list[$key]["article_date"]);
if($temp_counter) {
$tmpl = render_cnt_template($tmpl, 'SPACE', '<!--space//-->');
} else {
$tmpl = render_cnt_template($tmpl, 'SPACE', '');
}
$listing .= $tmpl;
$article_list[$key]["article_image"]['tmpllist'] = 1;
} else {
$article_list[$key]["article_image"]['tmpllist'] = 0;
}
}
if (!$article_list[$key]["article_image"]['tmpllist'] || $article_list[$key]["article_image"]['tmpllist'] == 'default') {
$listing .= $template_default["top_listentry_before"];
// space between summary listings
if($temp_counter) {
$listing .= $template_default["space_between_sum"];
}
if($article_list[$key]["article_title"] && !$article_list[$key]["article_notitle"]) {
//$listing .= get_html_part($article_list[$key]["article_title"], $template_default["top_headline_class"], $article_link);
$listing .= $template_default["top_headline_before"];
$listing .= '<a href="'.$article_link.'">';
$listing .= html_specialchars($article_list[$key]["article_title"]);
$listing .= '</a>';
$listing .= $template_default["top_headline_after"];
$listing .= $template_default["top_headline_space"];
}
if($article_list[$key]["article_subtitle"]) {
//$listing .= get_html_part($article_list[$key]["article_subtitle"], $template_default["top_subheadline_class"], $article_link);
$listing .= $template_default["top_subheadline_before"];
$listing .= '<a href="'.$article_link.'">';
$listing .= html_specialchars($article_list[$key]["article_subtitle"]);
$listing .= '</a>';
$listing .= $template_default["top_subheadline_after"];
$listing .= $template_default["top_subheadline_space"];
}
if($article_list[$key]["article_summary"] || $article_list[$key]["article_image"]['cname']) {
//$listing .= "<span class=\"".$template_default["top_text_class"]."\">";
$listing .= $template_default["top_text_before"];
//build image table when image available
if($article_list[$key]["article_image"]["cname"]) {
$listing .= '<table width="1%" cellspacing="0" border="0" cellpadding="0" align="left" ';
if($template_default["article"]["image_table_bgcolor"]) {
$listing .= 'bgcolor="'.$template_default["article"]["image_table_bgcolor"].'" ';
}
$listing .= 'style="float:left;margin:2px 5px 3px 0;">';
if($article_list[$key]["article_image"]["cname"]) {
$listing .= "\n<tr><td>".'<a href="'.$article_link.'">';
$listing .= $article_list[$key]["article_image"]["cname"]."</a></td></tr>\n";
}
if($article_list[$key]["article_image"]["caption"]) {
$listing .= '<tr><td><img src="img/leer.gif" alt="" width="1" height="3"></td></tr>';
$listing .= "\n<tr><td";
if($template_default["article"]["image_caption_class"]) {
$listing .= ' class="'.$template_default["article"]["image_caption_class"].'"';
}
if($template_default["article"]["image_caption_bgcolor"]) {
$listing .= ' bgcolor="'.$template_default["article"]["image_caption_bgcolor"].'"';
}
if($template_default["article"]["image_caption_valign"]) {
$listing .= ' valign="'.$template_default["article"]["image_caption_valign"].'"';
}
if($template_default["article"]["image_caption_align"]) {
$listing .= ' align="'.$template_default["article"]["image_caption_align"].'"';
}
$listing .= '>';
$listing .= $template_default["article"]["image_caption_before"];
$listing .= nl2br(html_specialchars($article_list[$key]["article_image"]["caption"]));
$listing .= $template_default["article"]["image_caption_after"];
$listing .= "</td></tr>\n";
}
$listing .= '</table>';
}
$listing .= $article_list[$key]["article_summary"];
$listing .= $template_default["top_readmore_before"];
$listing .= '<a href="'.$article_link.'">';
$listing .= $template_default["top_readmore_link"];
//$listing .= "</a>".$template_default["top_readmore_after"]."</span>";
$listing .= '</a>'.$template_default["top_readmore_after"];
$listing .= $template_default["top_text_after"];
}
$listing .= $template_default["top_listentry_after"];
}
} else {
// if "top_count" value is equal or larger
// show only the article headline listing
//if($temp_counter && $temp_counter == $template_default["top_count"]) {
if($temp_counter && $temp_counter == $temp_topcount) {
$listing .= $template_default["space_aftertop_text"];
} elseif ($temp_counter) {
$listing .= $template_default["space_between_list"];
}
$listing .= $template_default["list_headline_before"];
$listing .= '<a href="'.$article_link.'">';
$listing .= $template_default["list_startimage"];
//$listing .= get_html_part($article_list[$key]["article_title"], $template_default["list_headline_class"]);
$listing .= html_specialchars($article_list[$key]["article_title"]);
$listing .= '</a>'.$template_default["list_headline_after"];
}
$temp_counter++;
}
$listing .= $template_default["space_bottom"]; //ends with space at bottom
return str_replace("<br /><br />", "<br />", $listing);
}
Hallo Karla!
I had a similar problem as Hockey asked about, regarding listing of articles. The site I´m building has a number of categories under "Home"
Each category has articles which uses Plauderer´s { TEASER:alias} rep-tag. This tag is placed within Main in the pemplates for each aliased category and is "styled up" with it´s own css-class. The categorys top article count is set to -1 . This solution gives an navigation menu for the articles within it´s category. Now, It´s working as I wish besides the extra style I'm looking for. When an article is selected I want the menuitem beeing affected as f.e. the { NAV_ROW}-tag does if it´s edited in"conf.template_default.inc.php", //row based navigation: $template_default["nav_row"]["link_before_active" = '<span class="nav_main_act">';.
I have little or hardly no knowledge in php-scripting, but looking in the "front.func.inc"-file there is something about $GLOBALS['template_default']........ or am I wrong?
regards Tomoh
I had a similar problem as Hockey asked about, regarding listing of articles. The site I´m building has a number of categories under "Home"
Each category has articles which uses Plauderer´s { TEASER:alias} rep-tag. This tag is placed within Main in the pemplates for each aliased category and is "styled up" with it´s own css-class. The categorys top article count is set to -1 . This solution gives an navigation menu for the articles within it´s category. Now, It´s working as I wish besides the extra style I'm looking for. When an article is selected I want the menuitem beeing affected as f.e. the { NAV_ROW}-tag does if it´s edited in"conf.template_default.inc.php", //row based navigation: $template_default["nav_row"]["link_before_active" = '<span class="nav_main_act">';.
I have little or hardly no knowledge in php-scripting, but looking in the "front.func.inc"-file there is something about $GLOBALS['template_default']........ or am I wrong?
regards Tomoh