how modify content type: article menu?

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
numlock
Posts: 16
Joined: Wed 30. Apr 2008, 09:14

how modify content type: article menu?

Post by numlock »

Hi, friends. one problem. how modify - "content type: article menu" that not show all articles, but show only first article.

what modify in this code? please help me

Code: Select all

if (!defined('PHPWCMS_ROOT')) {
   die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------



//article menu

$CNT_TMP .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);

$alinkmenu 					= unserialize($crow["acontent_form"]);
$alinkmenu["catid"] 		= ($alinkmenu["cat"]) ? $alinkmenu["catid"] : $content["cat_id"];
$alinkmenu['headertext']	= empty($alinkmenu["headertext"]) ? 0 : 1;
$alinkmenu['ul']			= empty($alinkmenu["ul"]) ? 0 : $alinkmenu["ul"];
$alinkmenu['titlewrap'] 	= empty($alinkmenu["titlewrap"]) ? array('', '') : array('<'.$alinkmenu["titlewrap"].'>', '</'.$alinkmenu["titlewrap"].'>');
$alinkmenu['link'] 			= '';

$ao 						= get_order_sort($content['struct'][ $alinkmenu["catid"] ]['acat_order']);

$alink_sql  = "SELECT article_id, article_title, article_cid, article_summary FROM ";
$alink_sql .= DB_PREPEND."phpwcms_article WHERE article_public=1 AND ";
$alink_sql .= "article_aktiv=1 AND article_deleted=0 AND article_cid=";
$alink_sql .= intval($alinkmenu["catid"])." AND article_begin<NOW() ";
$alink_sql .= 'AND article_end>NOW() ';
if(!empty($alinkmenu['hideactive'])) {
	$alink_sql .= 'AND article_id != '. $aktion[1] . ' ';
}
$alink_sql .= 'ORDER BY ' . $ao[2] ;
			 
if($result = mysql_query($alink_sql, $db) or die("error while getting link article list: ".$alink_sql)) {

	while($row = mysql_fetch_row($result)) {
	
		$tempRowSpan 			= '';
		$row[3]					= preg_replace('/<br[^>]*?>$/i', '', $row[3]);
		
		if($alinkmenu['headertext'] && !empty($row[3])) {
		
			$alinkmenu['sum']	= $row[3];
			
			if(!empty($alinkmenu['maxchar'])) {
			
				$alinkmenu['sum'] 		= clean_replacement_tags($alinkmenu['sum']);
				$alinkmenu['sum'] 		= remove_unsecure_rptags($alinkmenu['sum']);
				$alinkmenu['sum'] 		= preg_replace('/\s/i', ' ', $alinkmenu['sum']);
				$alinkmenu['sum'] 		= preg_replace('/\s{2,}/i', ' ', $alinkmenu['sum']);
				$alinkmenu['sum'] 		= trim(decode_entities($alinkmenu['sum']));
				$alinkmenu['sum']		= wordwrap($alinkmenu['sum'], $alinkmenu['maxchar'], "\n");
				list($alinkmenu['sum'])	= explode("\n", $alinkmenu['sum']);
				$alinkmenu['sum']		= trim($alinkmenu['sum']);
				$alinkmenu['sum']		= html_specialchars($alinkmenu['sum']);
				
				if(!empty($alinkmenu['morelink'])) {
					
					$alinkmenu['sum']  .= '<a href="index.php?aid='.$row[0].'">';
					$alinkmenu['sum']  .= $alinkmenu['morelink'];
					$alinkmenu['sum']  .= '</a>';
					
				}
			
			}
				
		} else {
		
			$alinkmenu['sum']	= false;
		
		}
		
		switch($alinkmenu['ul']) {
		
			case 1:		// render as unordered list
						$alinkmenu['link'] .= '<li>'.$alinkmenu['titlewrap'][0];
						$alinkmenu['link'] .= '<a href="index.php?aid='.$row[0].'">';
						$alinkmenu['link'] .= html_specialchars($row[1]);
						$alinkmenu['link'] .= '</a>'.$alinkmenu['titlewrap'][1];
						
						if($alinkmenu['sum'] !== false) {
							$alinkmenu['link'] .= "\n".$alinkmenu['sum'];
						}
						
						$alinkmenu['link'] .= "</li>\n";
						break;
						
			case 2:		// render as div
						$alinkmenu['link'] .= '<div>'.$alinkmenu['titlewrap'][0];
						$alinkmenu['link'] .= '<a href="index.php?aid='.$row[0].'">';
						$alinkmenu['link'] .= html_specialchars($row[1]);
						$alinkmenu['link'] .= '</a>'.$alinkmenu['titlewrap'][1];
						
						if($alinkmenu['sum'] !== false) {
							$alinkmenu['link'] .= "\n".$alinkmenu['sum'];
						}
						
						$alinkmenu['link'] .= "</div>\n";
						break;
		
			default:	// render as table
		
						if($alinkmenu['sum'] !== false) {
							$tempRowSpan		= ' rowspan="2"';
							$alinkmenu['sum']	= "<tr>\n\t<td>" . $alinkmenu['sum'] . "</td>\n</tr>\n";
						}
					
						$alinkmenu['link'] .= "<tr>\n\t<td valign=\"top\"".$tempRowSpan." nowrap=\"nowrap\">".$template_default["article"]["link_article_sign"]."</td>\n\t";
						$alinkmenu['link'] .= '<td>'.$alinkmenu['titlewrap'][0].'<a href="index.php?aid='.$row[0].'" ';
						$alinkmenu['link'] .= get_class_attrib($template_default["article"]["link_article_class"]).">";
						$alinkmenu['link'] .= html_specialchars($row[1]).'</a>'.$alinkmenu['titlewrap'][1]."</td>\n</tr>\n";
						$alinkmenu['link'] .= $alinkmenu['sum'];
			
		}	
		
		
	}
	mysql_free_result($result);

}

if($alinkmenu['link']) {

	switch($alinkmenu['ul']) {
	
			case 1:		// render as unordered list
						$alinkmenu['link'] = "<ul>\n" . $alinkmenu['link'] . "</ul>\n";						
						break;
						
			case 2:		// render as div			
						break;
		
			default:	// render as table
						$alinkmenu['link'] = '<table border="0" cellspacing="0" cellpadding="0">'."\n" . $alinkmenu['link'] . "</table>\n";
			
	}

	// now check if class name is given
	// if so wrap article menu in div
	if(!empty($alinkmenu['class'])) {
	
		$alinkmenu['link'] = '<div class="' . html_specialchars($alinkmenu['class']) . "\">\n" . $alinkmenu['link'] . "</div>\n";
	
	}	
	$CNT_TMP .= $alinkmenu['link'];
	
}

unset($alinkmenu);
									
?>
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: how modify content type: article menu?

Post by flip-flop »

Hmm, you can´t solve this problem with a reduced teaser CP? (Don´t hack the core).
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
numlock
Posts: 16
Joined: Wed 30. Apr 2008, 09:14

Re: how modify content type: article menu?

Post by numlock »

but how? how generate short first and second news in index page? all news by second "news.phtml" page Image
numlock
Posts: 16
Joined: Wed 30. Apr 2008, 09:14

Re: how modify content type: article menu?

Post by numlock »

any help?, very important..
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: how modify content type: article menu?

Post by flip-flop »

I don´t know your problem.
If you uses the teaser cp there iss the option "max.: [..] articles".

'In your teaser template you only need the article link? - This example uses CATEGORY, PRIO (since _r170) and date too.

Code: Select all

<!--TEASER_HEAD_START//-->
<ul>
<!--TEASER_HEAD_END//-->

<!--TEASER_ENTRY_START//-->
	<li[PRIO] class="prio{PRIO}"[/PRIO]><a href="{ARTICLELINK}">[CATEGORY]{CATEGORY}[/CATEGORY]: Prio-[PRIO]{PRIO}[/PRIO]: {TITLE}</a> {DATE:d. F Y lang=EN}
	</li>
<!--TEASER_ENTRY_END//-->

<!--TEASER_SPACER_START//-->

<!--TEASER_SPACER_END//-->

<!--TEASER_FOOTER_START//-->
</ul>
<!--TEASER_FOOTER_END//-->
The only problem we have is the sort order of the articles in teaser. (At this time we haven´t the option to use the backend chronological order - it is very complex to implement this for all the teaser stuff (original soundtrack O.G.)).
But sinze _r170 we can use article priorisazion in the teaser cp.

E.g.: Push up the article you will show at first with a hight "prioritization: [...]".
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
numlock
Posts: 16
Joined: Wed 30. Apr 2008, 09:14

Re: how modify content type: article menu?

Post by numlock »

thanks.
another problem, how modify that auto insert "back" link in all news when read full store? now impissible return,,
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: how modify content type: article menu?

Post by flip-flop »

I hope I understand you right:

Code: Select all

[BACK]&laquo;&laquo; back -[/BACK]
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
numlock
Posts: 16
Joined: Wed 30. Apr 2008, 09:14

Re: how modify content type: article menu?

Post by numlock »

hm, ok
but how change that not show "back" in index page? only full story article

Code: Select all

 
<div class="article_right">
{CONTENT}
[BACK]back[/BACK]
</div> 
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: how modify content type: article menu?

Post by flip-flop »

... when read full store?
In this case (article detail:) it is absolutly right. You return to the list view (article listing:).
I don´t know your article construction list/detail and site construction with teaser.
(Headline of this posting ist: 2how modify content type: article menu?")

But I see you don´t use the back tag in combination with the article template.
If you use this tag in your main template, for me it no problem if there is a back button.
The only objection is a call from another side, but if you came from your own side it is right.

Call from another side: Write a little frontend_render or includet [PHP]....[/PHP] snippet to solve this problem.
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Post Reply