Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#97 2009-05-14 18:40:27

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: [plugin] [ORPHAN] cbs_category_list

Great plugin. Works like a charm. There is one thing missing. I need to exclude=“cat1,cat2,etc…” so as to hide certain cats. Any ideas?


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#98 2009-07-09 16:13:48

coleh
Member
From: Edinburgh, UK
Registered: 2007-08-16
Posts: 28
Website

Re: [plugin] [ORPHAN] cbs_category_list

Hey

Reposing a question asked elsewhere in the forums as relevance has shifted somewhat.

I wanted to display a grouping of article by categories along the lines of those listed in this forum thread/post

However, what I wanted to also do was precede this with a list of categories (showing only those that featured articles) that instead of providing links to pages would provide links to an id defined for each of the category groupings further down the page, eg linking to #category-name or similar.

The idea was that if I could control the display of a category list using a form then this could be quite easily achieved with something along the lines of:

<a href="#link-<txp:category />"><txp:category title="1" /></a>

I can achieve this using category_list as a container but that then shows all categories relating to the section listed (and not just those for which articles exist). However, if I try this using cbs_category_list as a container to specifically exclude those categories without articles then the listing just gives me the default category permalink.

Is cbs_category_list supposed to work like category_list when used as a container?

Cole


Jack of all trades, Doctor of one

Offline

#99 2009-07-09 19:26:33

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: [plugin] [ORPHAN] cbs_category_list

btw, have you tried the adi_cat_menu plugin ?

Offline

#100 2009-10-19 18:13:11

CharlesCountyArtsAlliance
New Member
Registered: 2009-10-19
Posts: 6

Re: [plugin] [ORPHAN] cbs_category_list

I’m using cbs_category_list with the wraptag set to UL and the break set to LI. I’d like to apply a class to the LI attribute as opposed to the wraptag, because I want the background colors of each LI item to change using gho_alternation. Is there any way to add a class to the break in cbs_category_list?

Offline

#101 2011-05-09 03:37:26

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

Re: [plugin] [ORPHAN] cbs_category_list

milkshake wrote:

the default <txp:category_list /> tag covers the functionality of this plugin now i think, though requires a bit more tinkering

how can one make the default category list tag out put this?
globalcat
– cat 1
– – subcat 1
– – subcat 2
– – subcat 3
– cat 2
– – subcat 4
– – subcat 5
– – subcat 6

The documentation doesn’t provide an example?


…. texted postive

Offline

#102 2011-05-09 11:02:05

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [plugin] [ORPHAN] cbs_category_list

Giovanni, something like this:

<txp:category_list children="0" wraptag="ul" break="li">
   <txp:category title="1" link="1" />
   <txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="li">
      <txp:category title="1" link="1" />
   </txp:category_list>
</txp:category_list>

Offline

#103 2011-05-10 03:30:41

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

Re: [plugin] [ORPHAN] cbs_category_list

Els wrote:

Giovanni, something like this:

<txp:category_list children="0" wraptag="ul" break="li">
   <txp:category title="1" link="1" />
   <txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="li">
      <txp:category title="1" link="1" />
   </txp:category_list>
</txp:category_list>

Magic!!

But this leads to another question or two.

If I only want to use the Parent Category as a Heading and not have it link to an entry, is that possible? If not I can always add some filler text so no big deal if i need to have appear as a link.

BUT i would like to be able to css style the Parent category so that it is a larger font and perhaps underlined. How can i apply a css style to the Parent cat

PS i had this :

<txp:category_list label="VACANZE Al MARE" parent="mare"  exclude="mare" children="0" sort="id" wraptag="ul" break="">    
<li>
<txp:category class='<txp:if_variable name="cat" value=''<txp:category />''>active<txp:else />inactive</txp:if_variable>' title="1" link="1" /></li>

</txp:category_list> 

but i was not sure what i was doing!

Last edited by els (2011-05-10 07:36:36)


…. texted postive

Offline

#104 2011-05-10 07:43:17

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [plugin] [ORPHAN] cbs_category_list

Something like this?

<txp:variable name="cat" value='<txp:category />' />
<txp:category_list children="0" break="">
   <h3><txp:category title="1" /></h3>
   <txp:category_list label="VACANZE Al MARE" parent='<txp:category />' exclude='<txp:category />' children="0" sort="id" wraptag="ul" break="">    
      <li><txp:category class='<txp:if_variable name="cat" value=''<txp:category />''>active<txp:else />inactive</txp:if_variable>' title="1" link="1" /></li>
   </txp:category_list>
</txp:category_list>

Offline

#105 2012-03-14 16:40:12

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 595
Website

Re: [plugin] [ORPHAN] cbs_category_list

I’m using this plugin to show how many articles exist per category, and it doesn’t seem to accept a comma-delimited set of sections—only one of my listed sections is being displayed. Anybody see a quick fix, or know of another way to get the same result?

/*
   cbs_category_list v0.9
   by Christophe Beyls [http://www.digitalia.be]
*/

function cbs_category_list($atts)
{
	global $s, $c;

	extract(lAtts(array(
		'label'    => '',
		'labeltag' => '',
		'break'    => 'br',
		'wraptag'  => '',
		'parent'   => '',
		'posted'   => '',
		'section'  => $s,
		'sticky'   => '',
		'showcount'=> '',
		'class'    => __FUNCTION__,
		'activeclass'=> ''
	),$atts));

	$parent = ($parent) ? " AND c.parent = '$parent'" : '';
	$showcount = ($showcount == 'true') ? ', COUNT(*) AS count' : '';
	$sticky = ($sticky == 'true') ? '5' : '4';

	switch($posted) {
		case 'all':
			$posted = '';
			break;
		case 'future':
			$posted = ' AND t.Posted >= now()';
			break;
		default:
			$posted = ' AND t.Posted < now()';
	}

	if($section == 'default') {
		$table = ', `'.PFX.'txp_section` AS s';
		$sqlsection = 's.name AND s.on_frontpage = 1';
	} else {
		$table = '';
		$sqlsection = "'$section'";
	}

	$rs = startRows(
	  'SELECT c.name, c.title'.$showcount.' FROM `'.PFX.'txp_category` AS c, `'.PFX.'textpattern` AS t'.$table
	  .' WHERE (c.name = t.Category1 OR c.name = t.Category2) AND c.type = \'article\' AND t.Section = '.$sqlsection.$parent.$posted
	  .' AND t.Status = '.$sticky.' GROUP BY c.name ORDER BY c.title'
	);
	if(!$rs)
		return '';

	$count = '';
	$out = array();
	while($a = nextRow($rs)) {
		extract($a);
		$out[] = tag(str_replace('& ','& ', $title), 'a', ' href="'.pagelinkurl(array('c'=>$name, 's'=>$section))
				.(($activeclass && ($s == $section) && ($c == $name)) ? '" class="'.$activeclass.'"' : '"')).($count ? ' ('.$count.')' : '');
	}
	return doLabel($label, $labeltag).doWrap($out, $wraptag, $break, $class);
}

Last edited by maruchan (2012-03-14 16:40:53)

Offline

Board footer

Powered by FluxBB