Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2008-07-19 09:48:15
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
List of authors?
Multiple authors writes to a site. How to show an active list of all authors, where name of the author links to listing of his/her posts?
Offline
Re: List of authors?
This might help http://textbook.textpattern.net/wiki/index.php?title=Txp:author_/
Offline
#3 2008-07-19 10:49:10
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: List of authors?
ultramega wrote:
Multiple authors writes to a site. How to show an active list of all authors, where name of the author links to listing of his/her posts?
1) Using the attribute “author” with the “txp:article_custom” tag returns a list of articles filtered by author (probably you already know)
2) in a page you can hard code a list of authors (or call them dinamically through php). Like:
<ul><li><a href="<txp:site_url />yoursection?user=john">john</a></li>
<li><a href="<txp:site_url />yoursection?user=mary">mary</a></li> </ul>
3) you can take different routes here. I would go using smd_if in the same page. Something like:
bc: <txp:smd_if field=“urlvar:author” operator=“eq” value=“john”>
<txp:article_custom author=“john” />
</txp:smd_if>
4) you can easily automate it with some php or with the new tag txp:variable (coming with txp 4.07)
Offline
#4 2008-07-21 04:08:12
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: List of authors?
I just wrote up something for the sake of curiosity and I have two questions.
1. Is an “author_list” (like category-list) an idea worth pursuing? it`s untested as yet, but I’ll make it available as a plugin if anyone is interested.
2. given that I don’t see a variable that can be called globally like $thiscategory for authors, is the wraptag (4.0.7) option as available for the tag that follows, or feasible at all? if so, perhaps a nudge in the right direction.
function ras_author_list ($atts, $thing = NULL) {
extract(lAtts(array(
'break' => br,
'form' => '',
'label' => '',
'labeltag' => '',
'sort' => 'AuthorId desc',
'wraptag' => '',
'class' => __FUNCTION__
), $atts));
$sort = doSlash($sort);
$where = " 1 order by ".$sort."";
$rs = array_unique(safe_column('AuthorId', 'textpattern', $where));
foreach($rs as $row) {
$where = "name='".$row."'";
$title = safe_field('RealName', 'txp_users', $where);
$out[] = tag($title, 'a', ' href="'.site_url().'author/'.urlencode($title).'/"');
}
if ($out)
{
return doLabel($label, $labeltag).doWrap($out, $wraptag, $break, $class);
}
return '' ;
}
Offline
#5 2008-07-21 06:56:21
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
Re: List of authors?
1. Is an “author_list” (like category-list) an idea worth pursuing?
Definately. Should be built-in, I think :)
Offline
#6 2008-07-21 14:02:10
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: List of authors?
Well, I can`t get filtering by author to work with this tag or the built txp:author tag by url on any of my sites. Perhaps I`m trying to use the functionality the wrong way, but it seems unreliable under both 4.0.4 and 4.0.6 which is what I’ve tested it with. In any case, i wouldn`t run to far with this.
Offline
Pages: 1