article template

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
ramone
Posts: 23
Joined: Sun 25. Dec 2005, 20:43

article template

Post by ramone »

hello
article templates are a great feature of phpwcms, but there's something i haven't figured out, how can i define where to place the article content?. i mean there's a tag for the title and the summary, but what if i want to place the rest of the content inside a table or so??

thank you
Pappnase

Post by Pappnase »

ramone
Posts: 23
Joined: Sun 25. Dec 2005, 20:43

Post by ramone »

heloo

i followed that tutorial a few days ago to build my site, now i have a definitive site structure with a template associated to it, but i'm asking for article templates, the one you chose when creating a new article, under the 'display full article' field:

my file: phpwcms_template/inc_cntpart/articlesummary/article/article.tmpl

Code: Select all

<!--
sample custom full article summary template
===========================================

TITLE       = article title
SUB         = article subtitle
SUMMARY     = article summary text
IMAGE       = summary image, also click zoomable
CAPTION     = summary image caption
DATE        = show article date {DATE:FORMAT:LANG} or {DATE:FORMAT}

//-->
{BREADCRUMB}
<h1 id='articulo_titulo'>{TITLE}</h1>
<p id='articulo_info'>{DATE:Y-m-d:EN}</p>
<p id='articulo_previo'>{SUMMARY}</p>
now, as you can see there is no tag for the article content, the content is appended after this template has been processed, i want to do something like this:

Code: Select all

{BREADCRUMB}
<table>
<tr>
<td>
<h1 id='articulo_titulo'>{TITLE}</h1>
<p id='articulo_info'>{DATE:Y-m-d:EN}</p>
<p id='articulo_previo'>{SUMMARY}</p>

<div id='article_content'>

<!--content here!!!-->

</div>

</td>
<td>

<!--a column with more stuff related to this article, like a {RELATED} tag-->

</td>
</tr>
</table>
but as i said the article content is appended to the end of the template

how can i define where to place the article content???
thanks again for your valuable help
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

You are messing with a template for the Article SUMMARY not the Article :wink:

Many of the content types have templating provisions for ~some~ control over presentation before or after the CONTENT:
-articlesummary
-filelist
-forum
-guestbook
-map
-reference
-rssfeed

But if you didn't have the content part... you'd need no control over presentation before and after. These templates allow ~some~ flexibility for melding the content part into the overall flow. Nothing more.

The coding of each type of "content part" is in another location of the script and was purposely created in a predetermined way, in order to make it easy for non-webdesigners to just enter some data and have it presented (one purpose of a CMS). Those built-in "content types" are just a framework.

If you know/want a different or better way to present it, phpWCMS has some means for you to do that, too. This was done on purpose, and is one of it's strengths.
ramone
Posts: 23
Joined: Sun 25. Dec 2005, 20:43

Post by ramone »

ok, could you tell me what php script process the article summary template and what script appends the content parts, please?

thank you
User avatar
DeXXus
Posts: 2168
Joined: Fri 28. Nov 2003, 06:20
Location: USA - Florida

Post by DeXXus »

Different "content parts" are composed in different files, but here's a helpful start on your learning process:

"/include/inc_front/content.article.inc.php"

Code: Select all

// all for creating article
...
...
...
...
"/include/inc_front/front.func..inc.php"

Code: Select all

			// article list based template check
			if(!empty($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', $thumb_img);
					$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, 'EDITOR', $article_list[$key]["article_username"]);
					$tmpl = render_cnt_template($tmpl, 'ARTICLEID', $article_list[$key]["article_id"]);					
					$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 (empty($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"];
					if($article_list[$key]["article_morelink"]) {
						$listing .= '<a href="'.$article_link.'">';
						$listing .= html_specialchars($article_list[$key]["article_title"]);
						$listing .= '</a>';
					} else {
						$listing .= html_specialchars($article_list[$key]["article_title"]);
					}
					$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"];
					if($article_list[$key]["article_morelink"]) {
						$listing .= '<a href="'.$article_link.'">';
						$listing .= html_specialchars($article_list[$key]["article_subtitle"]);
						$listing .= '</a>';
					} else {
						$listing .= html_specialchars($article_list[$key]["article_subtitle"]);
					}
					$listing .= $template_default["top_subheadline_after"];
					$listing .= $template_default["top_subheadline_space"];
				}
				if($article_list[$key]["article_summary"] || !empty($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(!empty($thumb_img)) {
						$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;">';
						$listing .= "\n<tr><td";
						if($template_default["article"]["image_class"]) {
							$listing .= ' class="'.$template_default["article"]["image_class"].'"';
						}
						$listing .= '>';
						if($article_list[$key]["article_morelink"]) {
							$listing .= '<a href="'.$article_link.'">'.$thumb_img."</a>";
						} else {
							$listing .= $thumb_img;
						}
						$listing .= "</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"];
					if($article_list[$key]["article_morelink"]) {
						$listing .= $template_default["top_readmore_before"];
						$listing .= '<a href="'.$article_link.'">';
						$listing .= $template_default["top_readmore_link"];
						$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);
}
ramone
Posts: 23
Joined: Sun 25. Dec 2005, 20:43

Post by ramone »

well it could be good to set this as a feature request, because i'ts a common parctice (i think) to have a right column displaying info related to each article, like other articles or images or whatever, so it would be good to create a template, and the hability to set articles to use that template or other ones

thanks for your help :D
Post Reply