Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
This plugin is a modified txp:recent_articles tag. It changes the output from a list to a dropdown list via a select tag. It supports all the parameters that txp:recent_articles supports, and also supports css styling via the class akhRecentArticles.
Download the plugin <a href=“http://www.ember.co.nz/resources/textpattern/” target=”_blank”>HERE</a>.
Last edited by tweak (2006-08-11 05:43:16)
Arg! Too much pressure!
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
That looks awesome – I’ll give it a workout shortly.
Saaay, on that topic, anyone into making a popup menu that lists archives by month? I’d start a new topic, but I think I’m skewing “demanding” around here. ;)
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
The plugin has been updated to v0.3 to fix some errors in the output. It is now standards-compliant.
Download the plugin <a href=“http://www.ember.co.nz/resources/textpattern/” target=”_blank”>HERE</a>.
Last edited by tweak (2006-08-11 05:43:31)
Arg! Too much pressure!
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
all i see is is < ? php and ? > with nothing in between. am i doing something wrong?
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
^^^ right click and “save as…” ^^^^^
Is there any way to control the length of the drop down box? It breaks my edge.
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
ah! thanks :P works perfect.
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
> Tom Alday wrote:
> Is there any way to control the length of the drop down box? It breaks my edge.
Theres a couple ways to control the list. It can be limited in contents via limit=”“. If no limit is specified it will default to limit=“10”.
Secondly, it looks for the style class akhRecentArticles in whichever stylesheet you happen to be using, so you can create that class in your preferred stylesheet and control its appearance from there.
Last edited by tweak (2004-08-04 19:45:02)
Arg! Too much pressure!
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
I found another error in the output which affects standards compliance again.
There is a new version fixing this error available <a href=“http://www.ember.co.nz/resources/textpattern/” target=”_blank”>HERE</a>.
Last edited by tweak (2006-08-11 05:43:50)
Arg! Too much pressure!
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
Hopeful request:
‘wondering if someone who knows how would be willing to add a feature to this plugin, enabling it to be section aware? That would be really, really awesome :)
textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation
Offline
Re: [plugin] [ORPHAN] akh_selrecent 0.2 - Dropdown list of recent articles
Long time since the initial request, but maybe still handy so here you go!
function akh_selrecent($atts)
{
if (is_array($atts)) extract($atts);
global $pretext;
extract($pretext);
$label = (empty($label)) ? '' : $label;
$break = (empty($break)) ? '' : $break;
$wraptag = (empty($wraptag)) ? '' : $wraptag;
$limit = (empty($limit)) ? 10 : $limit;
$section = (empty($section)) ? '' : doSlash($section);
$category = (empty($category)) ? '' : doSlash($category);
$sortby = (empty($sortby)) ? '' : doSlash($sortby);
$sortdir = (empty($sortdir)) ? '' : doSlash($sortdir);
$secq = ($section) ? "and Section='$section'" : '';
$catq = ($category) ? "and (Category1='$category' or Category2='$category')" :'';
$sortq = ($sortby) ? "$sortby" : 'Posted';
$dirq = ($sortdir) ? "$sortdir" : 'desc';
$rs = safe_rows(
"*",
"textpattern",
"Status = 4 and Posted <= now() $catq $secq order by $sortq $dirq limit 0,$limit"
);
if ($rs) {
if ($label) $out[] = $label;
$out[] = '<select class="akhRecentArticles" size="1" onchange="window.location.replace(this.value);">'."\n";
$out[] = '<option value=""></option>'."\n";
foreach ($rs as $a) {
extract($a);
$conTitle = ($url_title) ? $url_title : stripSpace($Title);
$out[] = ($url_mode)
? '<option value="'.$pfr.$Section.'/'.$ID.'/'.$conTitle.'">'.$Title.'</option>'."\n"
: '<option value="'.$pfr.'index.php?id='.$ID.'">'.$Title.'</option>'."\n";
}
$out[] = '</select><br />';
if (is_array($out)) {
if($break == 'li') {
return ($wraptag)
? tag("<li>".join("</li>\n<li>",$out)."</li>",$wraptag)
: "<li>".join("</li>\n<li>",$out)."</li>";
}
return ($wraptag)
? tag(join($break.n,$out),$wraptag)
: join($break.n,$out);
}
}
return '';
}
Offline