Ik ben een beetje aan het prutsen aan een nieuwe site en zit met volgend probleem:
Ik zou graag achter mijn artikelen bij recent nieuws de categorie weergeven waarin ze zitten. Nu heb ik al vanalles aan het proberen geweest maar ik kom er niet uit… Ik kom nu voorlopig tot onderstaand resultaat: (Enkel bovenste artikel zit in categorie ‘neobux’, rest in ‘bux.to’)

[img]http://img393.imageshack.us/img393/9241/probleemdutchbuxsy1.th.jpg[/img]
[img]http://img393.imageshack.us/images/thpix.gif[/img]
hieronder staat de code die achter recent nieuws zit.
get( ‘source’, 2 ); //default to category
// id value corresponding to selected items/cats/section
$id = trim( $params->get( ‘id’ ) );
$id = rtrim($id,”,”); //strip trailing comma, if any
// number of items to display
$number = trim( $params->get( ‘items’, 5 ) ); //default to five items
//type of link list: 1=plain; 2= bulleted; 3= numbered
$type = $params->get( ‘list_type’, 2 ); //default to bulleted
//order of link list: created, title, id
$order = $params->get( ‘list_order’, ‘created’ ); //default to created
//sort order of link list: asc; desc
$sort = $params->get( ‘list_sort’, ‘desc’ ); //default to descending
//Show date below title link?
$show_date = $params->get( ‘show_date’, ‘no’ ); //default to no date
//Format of list date?
$date_format = $params->get( ‘date_format’, ‘%Y/%m/%d’ ); //default to year/month/day
//enable mouseover overlib tooltip?
$enable_tooltip = $params->get( ‘enable_tooltip’, ‘no’ ); //default to no tooltip
/*Content Link Mouseover Fields */
//fields to show in overlib tooltip
$tooltip_intro = $params->get( ‘tooltip_intro’, ‘no’ ); //default to no
$tooltip_intro_word_count = $params->get( ‘tooltip_intro_word_count’ );
if(!$tooltip_intro_word_count && $tooltip_intro_word_count != 0){
$tooltip_intro_word_count = ’25’; //default to 25 words
}
$tooltip_created = $params->get( ‘tooltip_created’, ‘no’ ); //default to no
$tooltip_created_date_format = $params->get( ‘tooltip_created_date_format’, ‘%Y/%m/%d’ ); //default to year/month/day
$tooltip_author = $params->get( ‘tooltip_author’, ‘no’ ); //default to no
//tooltip styles
$tooltip_bgcolor = $params->get( ‘tooltip_bgcolor’, ‘#24537d’ ); //default to dark blue
$tooltip_fgcolor = $params->get( ‘tooltip_fgcolor’, ‘#E1F0FF’ ); //default to light blue
$tooltip_border = $params->get( ‘tooltip_border’, ‘1’ ); //default to 1px border
$tooltip_capcolor = $params->get( ‘tooltip_capcolor’, ‘#ffffff’ ); //default to white
$tooltip_textcolor = $params->get( ‘tooltip_textcolor’, ‘#000000’ ); //default to black
$tooltip_images = $params->get( ‘tooltip_images’, ‘1’ ); //default to true
//extra tooltip parameters
$tooltip_extra_invocation_string = $params->get( ‘tooltip_extra_invocation_string’ );
if(!$tooltip_extra_invocation_string){
$tooltip_extra_invocation_string = “”; //default
}
else{
$tooltip_extra_invocation_string = “,”.$tooltip_extra_invocation_string;
}
//checking if function exists first allows multiple copies of module on page and avoids redeclaration error
if(!function_exists(”getContentItems”)){
//Get Content Function
function getContentItems($source, $id, $number, $order, $sort, $date_format, $tooltip_intro){
//returns selected content items as associative array
global $mainframe, $database, $my;
switch($source){
//check type of content item to return, set where clause. Allows for multiple categories, sections, items
case ‘1’: //content item
$where = “id IN ($id)”;
break;
case ‘2’: //category
$where = “catid IN ($id)”;
break;
case ‘3’: //section
$where = “sectionid IN ($id)”;
break;
}
$nullDate = $database->getNullDate(); //used for published check
$now = _CURRENT_SERVER_TIME; //ditto
$content = array(); //stores content items
if($tooltip_intro==’yes’){ $introtext = ‘, introtext ‘;}else{$introtext=””;} //get introtext only if requested
//Select query checks whether item is published, is not checked out and whether user has permission to access item
$query=”SELECT id, title, created, created_by”.$introtext.” FROM #__content WHERE ($where)” //has specified id(s)
. ” AND ( ‘$now’ <= publish_down OR publish_down = '$nullDate' AND state = 1 )" //still up and published . " AND ( '$now' >= publish_up OR publish_up = ‘$nullDate’)” //publishing period is active
. ” AND ( checked_out = 0 OR checked_out = $my->id )” //not checked out or checked out by me
. ” AND (access <= $my->gid)” //permission to access
. ” ORDER BY $order $sort”
. ” LIMIT $number”; //limit number of items to return
//query the DB
$database->setQuery($query);
$database->query();
//load items into object array
$content_list=$database->loadObjectList();
$total=count($content_list);
//loop through and generate the array of content item links
for($i=0;$i<$total;$i++){ //print $mainframe->getItemid($content_list[$i]->id);
$link=”index.php?option=com_content&task=view&id=”.$content_list[$i]->id.”&Itemid=”.$mainframe->getItemid($content_list[$i]->id);
$content[$i][’id’]=$content_list[$i]->id;
$content[$i][’title’]=$content_list[$i]->title;
$content[$i][’author’]=$content_list[$i]->created_by;
if($introtext){$content[$i][’introtext’]=$content_list[$i]->introtext;}
$content[$i][’date’]=mosFormatDate($content_list[$i]->created, $date_format);
$content[$i][’link’]=sefRelToAbs($link); //search engine friendly URL, if SEF is off normal URL is displayed
}
return $content;
}
}
if(!function_exists(”getIntroText”)){
//returns introtext chunk
function getIntroText($text, $length, $tooltip_images){
$text = str_replace(”{mosimage}”,””,$text); //strip out mosimage tags
$text = preg_replace(”/(rn|n|r)/”, “”, $text); //replace new line characters, important!
if($length==0){
return $text.”…”;
}
$words = explode(” “,$text); //convert text to array of words for count
for($i=0;$i<$length;$i++){ $introtext .= $words[$i]." "; //make HTML safe string for overlib popup } rtrim($introtext," "); //trim trailing space. if(!$tooltip_images){ $introtext = preg_replace("/
]+>/i”, “”, $introtext);
}
$introtext = $introtext . “…”; //add …
return $introtext;
}
}
if(!function_exists(”getAuthorName”)){
//return authors name
function getAuthorName($id){
global $database;
$query = “SELECT name”
. “n FROM #__users”
. “n WHERE id = $id”
;
$database->setQuery( $query );
if ($name=$database->loadResult()){
return $name;
}
else{
return false;
}
}
}
if(!function_exists(”buildTooltip”)){
//make the tooltip content, wrap content in styleable css spans
function buildTooltip($item, $tooltip_created, $tooltip_created_date_format, $tooltip_author, $tooltip_intro, $tooltip_intro_word_count, $tooltip_images){
$text=””;
if($tooltip_created == ‘yes’){
$text.= “” . strftime($tooltip_created_date_format, strtotime($item[’date’])). “
“;
}
if($tooltip_author == ‘yes’){
$author=getAuthorName($item[’author’]);
if($author){
$text .= “” . $author . “
“;
}
}
if($tooltip_intro == ‘yes’){ $text.= “” . getIntroText($item[’introtext’],$tooltip_intro_word_count, $tooltip_images) . ““;}
return htmlspecialchars(addslashes(str_replace(’,’,’,’,$text)));
}
}
//end function declarations
//get, process data and output content
$items=getContentItems($source, $id, $number, $order, $sort, $date_format, $tooltip_intro); //get content items array using module parameters
$output=array(); //buffer to hold content items
switch($type){
//determine type of link list to generate
case ‘1’: //plain list
$start_list = “”; //list starting tag
$end_list = “”; //list ending tag
$start_link = “”; //list item starting tag
$end_link = “
“; //list item ending tag
break;
case ‘2’: //bulleted
$start_list = “
“;
$start_link = “