Thanks for posting even tho I’m probably the most annoying whiny person ever to grace your forums!

<?php
/* This one is called with: [[ArchiveLister]]
* NewsArchive by Mark Kaplan (October 2005)
* Displays an archive of posts with full support for pagination (paging of content in increments)
*
* Version 1.2
*
* Updates:
* October 30th 2005 - 1 - FURL detection and support added.
* October 30th 2005 - 2 - Increment support added
*
* Based on NewsListing
*
* Always call uncached like so: [!NewsArchive!]
*
* Use the following placeholders for locating the prev/next buttons and other info
* [+buttons+] - the previous/next text links
* [+start+] - the # of the first item shown
* [+limit+] - the # of the last item shown
* [+resourcecount+] - the total # of items
*
* Example:
*
* Showing <strong>[+start+]</strong> - <strong>[+limit+]</strong> of <strong>[+resourcecount+]</strong><br />[+buttons+]
*
* Snippet parameters [default] :
* &startID - the folder containing the posts [the document called from]
* &total - max number of posts to retrieve [100]
*
* &increment - # of items to advance by each time the previous or next links are clicked [10]
* &trunc - truncate to summary posts? if set to false, shows entire post [true]
* &truncSplit - use the special "splitter" format to truncate for summary posts [true]
* &truncAt - the split-point splitter itself [<!-- splitter -->]
* &truncText - text for the summary "show more" link
*
*
* &tpl - name of the chunk to use for the summary view template
* &dateformat - the format for the summary date (see http://php.net/strftime ) [%d-%b-%y %H:%M]
* &pubOnly - only show Published posts [true]
* &emptytext - text to use when no news items are found
* &commentschunk - if you're using comments, the name of the chunk used to format them
*
*/
$furls = $modx->config['friendly_urls'];
// are furls enabled
$limit = isset($increment)? $limit : 70;
// sey # of items to advance by each time the previous or next links are clicked
$resourceparent = isset($startID) ? $startID : $modx->documentIdentifier;
// the folder that contains post entries
$nrtotal = isset($total) ? $total : 100;
// total number of posts to retrieve
$trunc = isset($truc) ? $trunc : true;
// should there be summary/short version of the posts?
$truncsplit = isset($trucSplit) ? $truncSplit : true;
// should the post be summarized at the "splitter"?
$splitter = isset($trucAt) ? $truncAt : "<!-- splitter -->";
// where to split the text
$tpl = isset($tpl) ? $modx->getChunk($tpl):'
<div class="summaryPost">
<h3>[+title+]</h3>
<div>[+summary+]</div>
<p> [+link+]</p>
<div style="text-align:right;">by <strong>[+author+]</strong> on [+date+]</div>
</div>
';
// optional user defined chunk name to format the summary posts
$showPublishedOnly = isset($pubOnly) ? $pubOnly : true;
// allows you to show unpublished docs if needed for some reason...
$linktext = isset($truncText)? $truncText : "More on this story >";
// text to be displayed in news link
$emptytext = isset($emptytext)? $emptytext : '<p>No entries found.</p>';
// text to be displayed when there are no results
$comments = isset($comments)? $comments : false;
// can the posts have comments?
$commText = isset($commText)? $commText : 'Comments';
// text to be used for the comments link
$start= $_GET['start']? $_GET['start']: 0;
$commentschunk = isset($commentschunk)? '{{'.$commentschunk.'}}' : '';
// if you're using comments, the name of the chunk used to format them
$date = isset($dateformat)? $dateformat :"%d-%b-%y %H:%M";
// format for the summary post date format
$output = '';
// initialize the blog variable
$callby = ($showPublishedOnly)? 'getActiveChildren' : 'getAllChildren';
$resource = $modx->$callby($resourceparent, 'createdon', 'DESC', $fields='id, pagetitle, description, introtext, content, createdon, createdby, hidemenu, alias');
$resourcecount = count($resource);
$output .= ($resourcecount < 1)? $emptytext."\n" : '';
// function used to clean all the open HTML tags inside summary posts
// useful so it won't break layouts due to there being open tags like
// OL, UL, DIV, H1 or maybe even A tags for example
function endtags($text) {
$openPattern = "/<([^\/].*?)>/";
$closePattern = "/<\/(.*?)>/";
$endOpenPattern = "/<([^\/].*?)$/";
$endClosePattern = "/<(\/.*?[^>])$/";
$endTags='';
preg_match_all($openPattern,$text,$openTags);
preg_match_all($closePattern,$text,$endtags);
$c=0;
$loopCounter = count($endtags[1]); //used to prevent an infinite loop if the html is malformed
while($c<count($endtags[1]) && $loopCounter) {
$i=0;
while($i<count($openTags[1])) {
$tag = trim($openTags[1][$i]);
if(strstr($tag,' ')) {
$tag = substr($tag,0,strpos($tag,' '));
}
//echo $tag.'=='.$endtags[1][$c]."\n";
if($tag==$endtags[1][$c]) {
$openTags[1][$i]='';
$c++;
break;
}
$i++;
}
$loopCounter--;
}
$results = $openTags[1];
if(is_array($results)) {
$results = array_reverse($results);
foreach($results as $tag) {
$tag = trim($tag);
if(strstr($tag,' ')) {
$tag = substr($tag,0,strpos($tag,' '));
}
if(!stristr($tag,'br') && !stristr($tag,'img') && !empty($tag)) {
$endTags.= '</'.$tag.'>';
}
}
}
return $text.$endTags;
}
if ($resourcecount > 0) {
if ($furls == 0){
$char = "&";
}else if($furls == 1){
$char = "?";
}
$currentpageid = $modx->documentObject['id'];
$next = $start + $limit;
$nextlink = "";
$previous = $start - $limit;
$previouslink = "";
$limten = $limit + $start;
if ($previous > -1 && $next < $resourcecount){
$buttons = $previouslink.$nextlink;
}
else if ($previous > -1) {
$buttons = $previouslink;
}
else if ($next < $resourcecount) {
$buttons = $nextlink;
}
else if ($start < $resourcecount) {
$limit = $limten;
}
if ($limten > $resourcecount){
$limiter = $resourcecount;
} else {$limiter = $limten;}
$modx->setPlaceholder('buttons',$buttons);
$modx->setPlaceholder('start',$start+1);
$modx->setPlaceholder('limit',$limiter);
$modx->setPlaceholder('resourcecount',$resourcecount);
if ($start < $resourcecount) {
$limit = $limten;
}else if ($limit > $resourcecount){
$die = ture;
}
for ($x = $start; $x < $limit; $x++) {
if ($x >= $resourcecount) {
$die = ture;
}
if ($resource[$x]['createdby']<0) {
// get web user name
$tbl = $modx->getFullTableName("web_users");
$sql = "SELECT username FROM $tbl WHERE $tbl.id = '".abs($resource[$x]['createdby'])."'";
}
else {
// get manager user name
$tbl = $modx->getFullTableName("manager_users");
$sql = "SELECT username FROM $tbl WHERE $tbl.id = '".$resource[$x]['createdby']."'";
}
//perform the query
$rs2 = $modx->dbQuery($sql);
$limit2 = $modx->recordCount($rs2);
if($limit2<1) {
$username = "anonymous";
}
else {
$resourceuser = $modx->fetchRow($rs2);
$username = $resourceuser['username'];
}
// determine and show summary
// summary is turned off
if (!$trunc) {
$summary = $resource[$x]['content'];
// contains the splitter and use splitter is on
} else if ((strstr($resource[$x]['content'], $splitter)) && $truncsplit) {
$summary = array();
// HTMLarea/XINHA encloses it in paragraph's
$summary = explode('<p>'.$splitter.'</p>',$resource[$x]['content']);
// For TinyMCE or if it isn't wrapped inside paragraph tags
$summary = explode($splitter,$summary['0']);
$summary = $summary['0'];
$summary = endtags($summary);
// fall back to the summary text
} else if (strlen($resource[$x]['introtext'])>0) {
$summary = $resource[$x]['introtext'];
// fall back to the summary text count
// skipping this because of ease of breaking in the middle of an A tag...
// so it's not a good idea. If you must have this, then uncomment
// } else if(strlen($resource[$x]['content']) > $lentoshow) {
// $summary = substr($resource[$x]['content'], 0, $lentoshow).'...';
//
// and back to where we started if all else fails (short post)
} else {
$summary = $resource[$x]['content'];
}
$summary = str_replace($commentschunk,'',$summary);
// add the link to the full post (permalink)
$link = '<a href="[~'.$resource[$x]['id'].'~]">'.$linktext.'</a>';
$fields = array('[+title+]','[+summary+]','[+link+]','[+author+]','[+date+]','[+id+]','[+alias+]');
$values = array($resource[$x]['pagetitle'],$summary,$link,$username,strftime($date, $resource[$x]['createdon']),$resource[$x]['id'],$resource[$x]['alias']);
if ($die != true) {$output .= str_replace($fields,$values,$tpl);}
}
}
return $output;
?><?php
//
// **************************
// Snippet: PrevNext
// By: Jeroen Bosch
// Date: februari 2005
// for: Etomite 0.6
// version: 0.9
// **************************
//
// Function:
// Generates a simple previous and next button. very
// handy on top or bottom of each individual newspost/log item
// Highly configurable. It can display document titles
// and add 'first' and 'last' to the options.
//
// You can set every option with the snippet call.
// example:
// [[PrevNext?sortBy=menuindex&sortHow=ASC&displayTitle=true]]
# Settings
# Sort items by? 'menuindex' or 'id' or 'createdon'
if(!isset($sortBy)){
$sortBy = 'createdon'; // default in NewsListing-snippet
}
# Sort items How? 'ASC' or 'DESC'
if(!isset($sortHow)){
$sortHow = 'ASC'; // default in NewsListing-snippet
}
# Show 'prev' and 'next' or display document titles?
if(!isset($displayTitle)){
$displayTitle = false;
}
# Show 'first' and 'last'
if(!isset($displayFixed)){
$displayFixed = false;
}
// The code:
// Get the parent ID
$parentid = $etomite->documentObject['parent']; // maybe this solves it all, but I'm not sure.
// (re)set the $id variable to the one of this document.
$id = $etomite->documentIdentifier;
// select the other members in this folder -- See: NOTE 1
$fields='id,pagetitle,isfolder'; // what fields do you want to know
$children = $etomite->getActiveChildren($parentid, $sortBy, $sortHow, $fields);
// the number of selected documents
//$limit = $etomite->recordCount($children);
$limit = count($children);
// set $y to zero
$y = 1;
// sorting the documents, giving them a sequential and searchable index
foreach ($children as $child) {
$my_array[$y] = $child;
if ($my_array[$y]['id']==$id)
{
$current=$y; // The current page has number $y in the array
}
$y++;
}
$prev = $current-1;
$next = $current+1;
// Here starts the output
$output = "";
$output .= "<div class='PrevNextMenu'>";
if($displayFixed==true) {
$output .= "< <a href='[~".$my_array[1]['id']."~]'>first</a> ";
}
else {
$output .= "";
}
if($prev > 0 && $displayTitle==false){
$output .= " <span class='footerRecent'><a href='[~".$my_array[$prev]['id']."~]'><img src='assets/images/1x1.gif' width='1' height='1' border='0' /></a></span> ";
}
elseif($prev > 0 && $displayTitle==true){
$output .= " <a href='[~".$my_array[$prev]['id']."~]'>".$my_array[$prev]['pagetitle']."</a> ";
}
if($next <= $limit && $displayTitle==false){
$output .= " <span class='footerPrevious'><a href='[~".$my_array[$next]['id']."~]'><img src='assets/images/1x1.gif' width='1' height='1' border='0' /></a></span> ";
}
elseif($next <= $limit && $displayTitle==true) {
$output .=" <a href='[~".$my_array[$next]['id']."~]'>".$my_array[$next]['pagetitle']."</a> ";
}
if($displayFixed==true) {
$output .= " <a href='[~".$my_array[$limit]['id']."~]'>last</a> >";
}
else {
$output .= " ";
}
$output .= "</div>";
$output .= "";
return $output;
?>$trunc = isset($truc) ? $trunc : true;
// should there be summary/short version of the posts?
$truncsplit = isset($trucSplit) ? $truncSplit : true;
// should the post be summarized at the "splitter"?
$splitter = isset($trucAt) ? $truncAt : "<!-- splitter -->";
<?php
$resourceparent = isset($newsid) ? $newsid : $modx->documentIdentifier;
// the folder that contains blog entries
$output = '';
// initialise the blog variable
$nrblogs = 3;
// nr of blogs to show a short portion of
$nrblogstotal = 100;
// total nr of blogs to retrieve
$lentoshow = 150;
// how many characters to show of blogs
$resource = $modx->getActiveChildren($resourceparent, 'createdon', 'DESC', $fields='id, pagetitle, description, introtext, content, createdon, createdby');
$limit=count($resource);
if($limit<1) {
$output .= "No entries found.<br />";
}
$nrblogs = $nrblogs<$limit ? $nrblogs : $limit;
if($limit>0) {
for ($x = 0; $x < $nrblogs; $x++) {
if ($resource[$x]['createdby']<0) {
// get web user name
$tbl = $modx->getFullTableName("web_users");
$sql = "SELECT username FROM $tbl WHERE $tbl.id = '".abs($resource[$x]['createdby'])."'";
}
else {
// get manager user name
$tbl = $modx->getFullTableName("manager_users");
$sql = "SELECT username FROM $tbl WHERE $tbl.id = '".$resource[$x]['createdby']."'";
}
$rs2 = $modx->dbQuery($sql);
$limit2 = $modx->recordCount($rs2);
if($limit2<1) {
$username = "anonymous";
}
else {
$resourceuser = $modx->fetchRow($rs2);
$username = $resourceuser['username'];
}
// show summary
$rest = $resource[$x]['content'];
$output .= "<div class="episode">
<div class="episodeTopOld"><div class='albums'><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_1.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_3.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_2.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_4.jpg' width='71' height='71' /></div>
".$resource[$x]['pagetitle']."<br />".strftime("%A, %B %d, %Y", $resource[$x]['createdon'])."</a>
</div>
<div class="episodeContent">".$rest."<div class="clear"></div></div>
<div class="episodeBottom"><span class="subscribe"><a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=259654789"></a></span><a href="index.php?id=".$resource[$x]['id']."">Permalink</a></div>
</div>";
}
}
if($limit>$nrblogs) {
$output .= "<br /><br /><b>Older news</b><br />";
for ($x = $nrblogs; $x < $limit; $x++) {
$output .= "> <a href='[~".$resource[$x]['id']."~]'>".$resource[$x]['pagetitle']."</a><br />";
}
}
return $output;
?><?php
/**
* Snippet Name: NewsListing
* Short Desc: Displays News Articles and Blog Posts
* Created By: The MODx Project
* Version: 4.4
*
* Displays posts with full support for pagination (paging of content in increments) and Template Variables
*
* Important Notes
* When in pagination mode (&paginate = 1) always call the snippet uncached in the [!NewsListing!] format
* Also, in pagination mode, make sure to use the placeholders for navigation!
* To display tv's make sure you use the tv prefix!
* For example, if you have the template variable author you would put [+tvauthor+] in your template.
*
* Snippet placeholders:
* [+next+] - next button
* [+previous+] - previous button
* [+prevnextsplitter+] - splitter if always show is 0
* [+pages+] - page list
* [+totalpages+] - total number of pages
* [+start+] - the # of the first item shown
* [+stop+] - the # of the last item shown
* [+total+] - the total # of items
*
* Example of placeholder use:
* Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles<br /><div id="nl_pages">[+previous+] [+pages+] [+next+]</div>
*
* Example CSS:
* <style type="text/css">
* #nl_pages {margin-top: 10px;}
* #nl_pages #nl_currentpage {border: 1px solid blue;padding: 2px; margin: 2px; background-color: rgb(90, 132, 158); color: white;}
* #nl_pages .nl_off {border: 1px solid #CCCCCC; padding: 2px; margin: 2px}
* #nl_pages a {border: 1px solid rgb(203, 227, 241);; padding: 2px; margin: 2px; text-decoration: none; color: black;}
* #nl_pages a:hover {border: 1px solid #000066; background-color: white; }
* #nl_archivelist ul{list-style-type: none; margin-left: 15px; padding-left: 0px;}
* #nl_archivelist ul ul{list-style-type: square;margin-left: 35px;}
* .nl_month {font-weight: bold;}
* </style>
*
* Snippet parameters [default] :
* &startID - the folder containing the posts [the document called from]
* &paginate - paginate [0]
* &prv - chunk to be used inside the previous link ["< Previous"]
* &nxt - chunk to be used inside the next link ["Next >"]
* &alwaysshow - always show previous or next links (if enabled, hyperlink will be removed when prev/next page is not available, | delimiter will not be inserted) [0]
* &prevnextsplitter - character delimiter to use to separate previous next links if alwaysshow is 0 ["|"]
* &summarize - number of posts to list partially/fully [3]
* &total - max number of posts to retrieve [all posts]
* &increment - # of items to advance by each time the previous or next links are clicked [10]
* &trunc - truncate to summary posts? if set to false, shows entire post [true]
* &truncSplit - use the special "splitter" format to truncate for summary posts [true]
* &truncAt - the split-point splitter itself [<!-- splitter -->]
* &truncText - text for the summary "show more" link
* &truncLen - number of characters to show in the doc summary [300]
* &truncOffset - negative offset to use to fall back when splitting mid-open tag [30]
*
* &comments - whether or not the posts have comments [false]
* &commText - comments link text ["Read Comments"]
*
* &tpl - name of the chunk to use for the summary view template
* &dateformat - the format for the summary date (see http://php.net/strftime ) [%d-%b-%y %H:%M]
* &datetype - the date type to display (values can be createdon, pub_date, editedon) [&sortby | "createdon"]
* &pubOnly - only show Published posts [true]
* &emptytext - text to use when no news items are found
* &showarch - show archive listing? [true]
* &archplaceholder -output archive (older posts section) as a placeholder called archive [0]
* &archivetext - text to use for the Post Archives listing ["Older Items"]
* &commentschunk - if you're using comments, the name of the chunk used to format them
* &sortby - field to sort by (reccomended values include createdon, pub_date, editedon; reverts to createdon if value is invalid) ["createdon"]
* &sortdir - direction to sort by ["desc"]
* &debug - enables debug output [0]
*
* Modified by Mark Kaplan, Susan Ottwell, Raymond Irving, Greg Matthews and Ryan Thrash:
* 10-Dec-2005 restored ability to split after N charcacters without splitting inside an open tag (such as img, a href, etc.)
* 06-Dec-2005 added xhtml strict month based archives, added nl_ prefix to all styles, minor fixes and documentation cleanup
* 05-Dec-2005 added support for pages and TVs!
* 03-Dec-2005 added pagination from NewsArchive (Mark)
* 01-Dec-2005 cleaned up code and parameters for 0.9.1 release and improved debug code (Mark)
* 25-Nov-2005 added multisort capabilities (Jason/Mark)
* 25-Nov-2005 added ability to call useful parts of the document object in a template via [+documentobject+] (Mark)
* 24-Nov-2005 added [+longtitle+] by Paul
* 11-Nov-2005 showarch added
* 04-Nov-2005 various improvements and bugfixes
* 21-Oct-2005 footer/header removed from summaries
* 12-Oct-2005 malformed tag-closing mojo and more cleanups
* 11-Oct-2005 many updates inc. showPublishedOnly, summary splitter, configs and default template format
* 22-Sept-2005 add &linktext support
* 22-Sept-2005 add template support. Fields - [+title+],[+summary+],[+author+],[+date+],[+link+]
* 19-April-2005 add introtext field support
*
*
* To Do:
* comment counts where applicable
* evaluate date formats/server offsets
* query optimizations
* show in menu if needed ?
*
* Credits:
* Now "goes to eleven" thanks to Mark Kaplan
* Month archives based on code from the "event-list" snippet by kastor
* Enhancements by Raymond Irving, Ryan Thrash and tag-closing mojo by Greg Matthews
* Original code by Alex with improvements by LePrince, mrruben5, lloyd_barrett
*/
$paginate = isset($paginate)? $paginate : 0;
// paginatation enabled or disabled
$furls = $modx->config['friendly_urls'];
// are furls enabled
$resourceparent = isset($startID) ? $startID : $modx->documentIdentifier;
// the folder that contains post entries
$nrposts = isset($summarize) ? $summarize : 3;
// number of posts of which to show a summary
// remainder (to nrtotal) go as an arhived/other posts list
$trunc = isset($trunc) ? $trunc : true;
// should there be summary/short version of the posts?
$truncsplit = isset($truncSplit) ? $truncSplit : true;
// should the post be summarized at the "splitter"?
$splitter = isset($truncAt) ? $truncAt : "<!-- splitter -->";
// where to split the text
$lentoshow = isset($truncLen) ? $truncLen : 300;
// how many characters to show of blogs
$lenoffset = isset($truncOffest) ? $truncOffset : 30;
// how many characters to show of blogs
$tpl = isset($tpl) ? $modx->getChunk($tpl):'
<div class="nl_summaryPost">
<h3><a href="[~[+id+]~]">[+title+]</a></h3>
<div>[+summary+]</div>
<p>[+link+]</p>
<div style="text-align:right;">by <strong>[+author+]</strong> on [+date+]</div>
</div>
';
// optional user defined chunk name to format the summary posts
$showPublishedOnly = isset($pubOnly) ? $pubOnly : true;
// allows you to show unpublished docs if needed for some reason...
$showInMenuOnly = isset($menuOnly) ? $menuOnly : true;
// allows you to show docs marked not to show in the menus
// if needed for some reason...
// TO BE IMPLEMENTED
$linktext = isset($truncText)? $truncText : "More on this story...";
// text to be displayed in news link
$emptytext = isset($emptytext)? $emptytext : '<p>No entries found.</p>';
// text to be displayed when there are no results
$comments = isset($comments)? $comments : false;
// can the posts have comments?
$commText = isset($commText)? $commText : 'Comments';
// text to be used for the comments link
$date = isset($dateformat)? $dateformat :"%d-%b-%y %H:%M";
// format for the summary post date format
$showarch = isset($showarch)? $showarch : true;
// whether or not to show the Post Archives listing
$archtxt = isset($archivetext)? $archivetext :"Older Items";
// text to use for the Post Archives listing
$commentschunk = isset($commentschunk)? '{{'.$commentschunk.'}}' : '';
// if you're using comments, the name of the chunk used to format them
$sortdir = isset($sortdir) ? strtoupper($sortdir) : 'DESC';
// get sort dir
if (isset($sortby) && ($sortby == "createdon" || $sortby == "editedon" || $sortby == "pub_date" || $sortby == "unpub_date" || $sortby =="deletedon")) {
$dt = $sortby;
} else if (isset($datetype)) {
$dt = $datetype;
} else {
$dt = "createdon";
}
$datetype = $dt;
// date type to display (values can be createdon, pub_date, editedon)
$start= isset($_GET['start'])? $_GET['start']: 0;
// get post # to start at
$debug = isset($debug)? $debug : 0;
// for testing only
$output = '';
// initialize the output variable
$debugtext = '';
// initialize the debugtext variable
$prv = isset($prv)? $modx->getChunk($prv) : "< Previous";
// get the chunk code to be used inside the previous <a> tag.
$nxt = isset($nxt)? $modx->getChunk($nxt) : "Next >";
// get the chunk code to be used inside the next <a> tag.
$alwaysshow = isset($alwaysshow)? $alwaysshow : 0;
// determine whether or not to always show previous next links
$archplaceholder = isset($archplaceholder)? $archplaceholder : 0;
// output archive (older posts section) as a placeholder called [+archive+]
$prevnextsplitter = isset($prevnextsplitter)? $prevnextsplitter : "|";
// splitter to use of always show is disabled
// Check for valid field to sort by
$columns = $modx->db->query("show columns from ".$modx->getFullTableName('site_content'));
while($dbfield = $modx->db->getRow($columns))
$dbfields[] = $dbfield['Field'];
if(isset($sortby) && in_array($sortby,$dbfields)) {
$sortby = $sortby;
} else {
$sortby = "createdon";
}
if ($sortby != "pub_date" && $sortby != "unpub_date" && $sortby != "editedon" && $sortby != "deletedon") {
// API Method (allows for everything except pub_date, unpub_date, editedon, deletedon)
$debugtext = "Using the API Method (allows for everything except pub_date, unpub_date, editedon, deletedon) <br />";
$callby = ($showPublishedOnly)? 'getActiveChildren' : 'getAllChildren';
$resource = $modx->$callby($resourceparent, $sortby, $sortdir, $fields='*');
} else {
// SQL Method (alows for all possibilites but is slower)
$debugtext = "Using the SQL Method (alows for all possibilites but is slower) <br />";
$tblContent= $modx->db->config['table_prefix'] . 'site_content';
$activeClause= $showPublishedOnly? 'AND published = 1': '';
$query= "SELECT id , type , contentType , pagetitle , longtitle , description , alias , published , IF(pub_date > 0, pub_date, createdon) as pub_date, IF(unpub_date > 0, unpub_date, createdon) as unpub_date , parent , isfolder , introtext , content , richtext , template , menuindex , searchable , cacheable , createdby , createdon, editedby , IF(editedon > 0, editedon, createdon) as editedon, deleted , IF(deletedon > 0, deletedon, createdon) as deletedon, deletedby , menutitle , donthit , haskeywords , hasmetatags , privateweb , privatemgr , content_dispo , hidemenu FROM $tblContent WHERE parent = $resourceparent $activeClause ORDER BY $sortby $sortdir";
if (!$rs= $modx->db->query($query)) {
return '';
}
while ($row= $modx->db->getRow($rs)) {
$resource[]= $row;
}
}
$recordcount = count($resource);
$output .= ($recordcount < 1)? $emptytext."\n" : '';
$nrtotal = isset($total) ? $total : $recordcount;
// total number of posts to retrieve
$limit = min( $recordcount, $nrtotal );
if ($recordcount < $nrposts)
{
$stop = $recordcount;
} else {
$stop = $nrposts;
}
if ($nrtotal > $recordcount) {$nrtotal = $recordcount;}
if ($debug == 1) {
// rudimentary debugging output
$output .= "Number supposed to be summarized (nrposts/count): $nrposts<br />Total supposed to be returned: $stop<br />Count of total in db (count): $recordcount<br />Sort by (sortby): $sortby <br />Sort direction (sortdir): $sortdir <br/ >$debugtext";
}
// function used to clean all the open HTML tags inside summary posts
// useful so it won't break layouts due to there being open tags like
// OL, UL, DIV, H1 or maybe even A tags for example
if(!function_exists('html_substr')) {
function html_substr($posttext, $minimum_length, $length_offset) {
// The approximate length you want the concatenated text to be
// $minimum_length = 200;
// The variation in how long the text can be
// in this example text length will be between 200-20=180 characters
// and the character where the last tag ends
// $length_offset = 20;
// Reset tag counter & quote checker
$tag_counter = 0;
$quotes_on = FALSE;
// Check if the text is too long
if (strlen($posttext) > $minimum_length) {
// Reset the tag_counter and pass through (part of) the entire text
for ($i = 0; $i < strlen($posttext); $i++) {
// Load the current character and the next one
// if the string has not arrived at the last character
$current_char = substr($posttext,$i,1);
if ($i < strlen($posttext) - 1) {
$next_char = substr($posttext,$i + 1,1);
}
else {
$next_char = "";
}
// First check if quotes are on
if (!$quotes_on) {
// Check if it's a tag
// On a "<" add 3 if it's an opening tag (like <a href...)
// or add only 1 if it's an ending tag (like </a>)
if ($current_char == "<") {
if ($next_char == "/") {
$tag_counter++;
}
else {
$tag_counter = $tag_counter + 3;
}
}
// Slash signifies an ending (like </a> or ... />)
// substract 2
if ($current_char == "/") $tag_counter = $tag_counter - 2;
// On a ">" substract 1
if ($current_char == ">") $tag_counter--;
// If quotes are encountered, start ignoring the tags
// (for directory slashes)
if ($current_char == "\"") $quotes_on = TRUE;
}
else {
// IF quotes are encountered again, turn it back off
if ($current_char == "\"") $quotes_on = FALSE;
}
// Check if the counter has reached the minimum length yet,
// then wait for the tag_counter to become 0, and chop the string there
if ($i > $minimum_length - $length_offset && $tag_counter == 0) {
$posttext = substr($posttext,0,$i + 1) . "...";
return $posttext;
}
}
}
return $posttext;
}
}
// function used to clean all the open HTML tags inside summary posts
// useful so it won't break layouts due to there being open tags like
// OL, UL, DIV, H1 or maybe even A tags for example
if(!function_exists('closeTags')) {
function closeTags($text) {
global $debug;
$openPattern = "/<([^\/].*?)>/";
$closePattern = "/<\/(.*?)>/";
$endOpenPattern = "/<([^\/].*?)$/";
$endClosePattern = "/<(\/.*?[^>])$/";
$endTags='';
preg_match_all($openPattern,$text,$openTags);
preg_match_all($closePattern,$text,$closeTags);
if ($debug == 1) {
print_r($openTags);
print_r($closeTags);
}
$c=0;
$loopCounter = count($closeTags[1]); //used to prevent an infinite loop if the html is malformed
while($c<count($closeTags[1]) && $loopCounter) {
$i=0;
while($i<count($openTags[1])) {
$tag = trim($openTags[1][$i]);
if(strstr($tag,' ')) {
$tag = substr($tag,0,strpos($tag,' '));
}
if ($debug == 1) { echo $tag.'=='.$closeTags[1][$c]."\n"; }
if($tag==$closeTags[1][$c]) {
$openTags[1][$i]='';
$c++;
break;
}
$i++;
}
$loopCounter--;
}
$results = $openTags[1];
if(is_array($results)) {
$results = array_reverse($results);
foreach($results as $tag) {
$tag = trim($tag);
if(strstr($tag,' ')) {
$tag = substr($tag,0,strpos($tag,' '));
}
if(!stristr($tag,'br') && !stristr($tag,'img') && !empty($tag)) {
$endTags.= '</'.$tag.'>';
}
}
}
return $text.$endTags;
}
} // end if function exists
if ($nrposts > 0) {
// Start Pagination
if ($paginate == 1) {
if ($furls == 0) {
$char = "&";
} else if($furls == 1) {
$char = "?";
}
$currentpageid = $modx->documentObject['id'];
$next = $start + $nrposts;
$nextlink = "<a href='[~$currentpageid~]".$char."start=$next'>".$nxt."</a>";
$previous = $start - $nrposts;
$previouslink = "<a href='[~$currentpageid~]".$char."start=$previous'>".$prv."</a>";
$limten = $nrposts + $start;
if ($alwaysshow == 1) {
$previousplaceholder = "<span class='nl_off'>".$prv."</span>";
$nextplaceholder = "<span class='nl_off'>".$nxt."</span>";
} else {
$previousplaceholder = "";
$nextplaceholder = "";
}
$split = "";
if ($previous > -1 && $next < $nrtotal) $split = $prevnextsplitter;
if ($previous > -1) $previousplaceholder = $previouslink;
if ($next < $nrtotal) $nextplaceholder = $nextlink;
if ($start < $nrtotal) $stop = $limten;
if ($limten > $nrtotal){$limiter = $nrtotal;} else {$limiter = $limten;}
$totalpages=ceil($nrtotal/$nrposts);
for ($x=0; $x<=$totalpages-1; $x++) {
$inc = $x * $nrposts;
$display = $x+1;
if($inc != $start) {
$pages .= "<a class=\"nl_page\" href='[~$currentpageid~]".$char."start=$inc'>$display</a>";
} else {
$pages .= "<span id=\"nl_currentpage\">$display</span>";
}
}
$modx->setPlaceholder('next',$nextplaceholder);
$modx->setPlaceholder('previous',$previousplaceholder);
$modx->setPlaceholder('prevnextsplitter',$split);
$modx->setPlaceholder('start',$start+1);
$modx->setPlaceholder('stop',$limiter);
$modx->setPlaceholder('total',$nrtotal);
$modx->setPlaceholder('pages',$pages);
$modx->setPlaceholder('totalpages',$totalpages);
if ($start < $nrtotal) $stop = $limten;
}
// End Pagination
if ($debug == 1) $output .= "Start at $start and stop at $stop (stop)/$nrtotal (total)";
for ($x = $start; $x < $stop; $x++) {
if ($x <= $nrtotal && $x <= $nrtotal-1) {
if ($resource[$x]['createdby']<0) {
// get web user name
$tbl = $modx->getFullTableName("web_users");
$sql = "SELECT username FROM $tbl WHERE $tbl.id = '".abs($resource[$x]['createdby'])."'";
}
else {
// get manager user name
$tbl = $modx->getFullTableName("manager_users");
$sql = "SELECT username FROM $tbl WHERE $tbl.id = '".$resource[$x]['createdby']."'";
}
$link = '';
//perform the query
$rs2 = $modx->dbQuery($sql);
$limit2 = $modx->recordCount($rs2);
if($limit2<1) {
$username = "anonymous";
} else {
$resourceuser = $modx->fetchRow($rs2);
$username = $resourceuser['username'];
}
// determine and show summary
// summary is turned off
if (!$trunc) {
$summary = $resource[$x]['content'];
// contains the splitter and use splitter is on
} else if ((strstr($resource[$x]['content'], $splitter)) && $truncsplit) {
$summary = array();
// HTMLarea/XINHA encloses it in paragraph's
$summary = explode('<p>'.$splitter.'</p>',$resource[$x]['content']);
// For TinyMCE or if it isn't wrapped inside paragraph tags
$summary = explode($splitter,$summary['0']);
$summary = $summary['0'];
// $link = '<a href="[~'.$resource[$x]['id'].'~]">'.$linktext.'</a>';
// fall back to the summary text
} else if (strlen($resource[$x]['introtext'])>0) {
$summary = $resource[$x]['introtext'];
// $link = '<a href="[~'.$resource[$x]['id'].'~]">'.$linktext.'</a>';
// fall back to the summary text count of characters
} else if(strlen($resource[$x]['content']) > $lentoshow) {
$summary = substr($resource[$x]['content'], 0, $lentoshow).' ...';
// and back to where we started if all else fails (short post)
} else {
$summary = $resource[$x]['content'];
}
// Post-processing to clean up summaries
$summary = html_substr($summary,$lentoshow,$lenoffset);
$summary = closeTags($summary);
$summary = str_replace($commentschunk,'',$summary);
// Build the "show more" link
$link = '<a href="[~'.$resource[$x]['id'].'~]">'.$linktext.'</a>';
// Output debug info
if ($debug == 1) $output .= '<p><strong>Document Data for "'.$resource[$x]['pagetitle'].'"</strong></p><textarea name="Document Data" rows="5" readonly>';
// Set placeholders for document object
foreach ($resource[$x] as $docVar => $docVarValue) {
$modx->setPlaceholder($docVar, $docVarValue);
if ($debug == 1 && $docVar != "content"){
$output .= $docVar." = ".htmlspecialchars($docVarValue)." \n";
}
}
if ($debug == 1) $output .= '</textarea>';
// Set tv placeholders
preg_match_all('~\[\+tv(.*?)\+\]~', $tpl, $matches);
$cnt = count($matches[1]);
for($i=0; $i<$cnt; $i++) {
$value = $modx->getTemplateVarOutput($idname=array($matches[1][$i]), $docid=$resource[$x]['id'], $published=$resource[$x]['published']);
$v = $value[$matches[1][$i]];
$modx->setPlaceholder("tv".$matches[1][$i], $v);
}
// Set placeholders that can be used in the Chunk
// Set placeholders for backwards compadibility and custom fields
$modx->setPlaceholder('title', $resource[$x]['pagetitle']);
$modx->setPlaceholder('summary', $summary);
$modx->setPlaceholder('link', $link);
$modx->setPlaceholder('author', $username);
$modx->setPlaceholder('date', strftime($date, $resource[$x][$datetype]));
// Expand the chunk code, and replace Placeholders
if ($debug != 1) $output .= $modx->mergePlaceholderContent($modx->mergeChunkContent($tpl));
}
}}
$archivehtml = "";
if ($debug == 1) $output .= "<br />Generate arcive (if true): $stop<$nrtotal and $showarch == true<br />";
if($stop<$nrtotal && $showarch == true) {
$displayeds = 0;
$lastMonth = -1;
$archivehtml .= "<h3>$archtxt</h3><div id=\"nl_archivelist\"><ul>";
for ($i = $stop; $i < $nrtotal; $i++) {
$unixdate = $resource[$i][$datetype];
$dateArray = getdate($unixdate);
$curMonth = $dateArray['mon'];
$month = strftime("%B %Y", $resource[$i][$datetype]);
if ($curMonth != $lastMonth) {
if ($lastMonth != -1) {
$archivehtml .= '</ul></li>';
}
$archivehtml .= '<li><span class="nl_month">'.$month.'</span><ul>';
}
$archivehtml .= "<li class=\"nl_archpost\"><a href='[~".$resource[$i]['id']."~]'>".$resource[$i]['pagetitle']."</a> (<span class=\"nl_date\">".strftime($date, $resource[$i][$datetype])."</span>)</li>";
++$displayeds;
$lastMonth = $curMonth;
}
$archivehtml .= "</ul></li></ul></div>";
}
if ($archplaceholder == 1)
{
$modx->setPlaceholder('archive', $archivehtml);
}
else if($showarch == true && $paginate != 1)
{
$output .= $archivehtml;
}
else
{
$output .= "";
}
return $output;
?><div class="episode">
<div class="episodeTopOld"><div class='albums'><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_1.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_3.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_2.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_4.jpg' width='71' height='71' /></div>
<a href="http://www.thesoundsinmyhead.com/episodes/[+alias+].m4a">[+title+]</a>
</div>
<div class="episodeContent">[+summary+]<div class="clear"></div></div>
<div class="episodeBottom"><span class="subscribe"><a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=259654789"></a></span><a href="[~[+id+]~]">Permalink</a></div>
</div> <div class="episode">
<div class="episodeTopOld"><div class='albums'><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_1.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_3.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_2.jpg' width='71' height='71' /><img src='http://www.thesoundsinmyhead.com/assets/images/albums/[+alias+]_4.jpg' width='71' height='71' /></div>
<a href="http://www.thesoundsinmyhead.com/episodes/[+alias+].m4a">[+title+]</a>
</div>
<div class="episodeContent">[+content+]<div class="clear"></div></div>
<div class="episodeBottom"><span class="subscribe"><a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=259654789"></a></span><a href="[~[+id+]~]">Permalink</a></div>
</div><?php
// get folder id where we should look for news else look in current document
$folder = isset($newsfolder) ? intval($newsfolder):$modx->documentIdentifier;
// get current document id
$docid = $modx->documentIdentifier;
// set subscribe mode
$makerss = isset($makerss) ? $makerss:1;
// set link id
$linkid = isset($linkid) ? intval($linkid): 0;
// set show link mode
$showlink = isset($showlink) ? $showlink: 1;
// set top items
$topitems = isset($topitems) ? $topitems : 10;
// set copyright info
$copyright = isset($copyright) ? $copyright:"";
// set ttl value
$ttl = ($ttl) ? intval($ttl):1440;
// set lentoshow
$lentoshow = isset($truncLen) ? $truncLen : 450;
$trunc = isset($truc) ? $trunc : true;
// should there be summary/short version of the posts?
$truncsplit = isset($trucSplit) ? $truncSplit : true;
// should the post be summarized at the "splitter"?
$splitter = isset($trucAt) ? $truncAt : "<!-- splitter -->";
// where to split the text
$showPublishedOnly = isset($pubOnly) ? $pubOnly : true;
// allows you to show unpublished docs if needed for some reason...
// functions
function closeTags($text) {
$openPattern = "/<([^\/].*?)>/";
$closePattern = "/<\/(.*?)>/";
$endOpenPattern = "/<([^\/].*?)$/";
$endClosePattern = "/<(\/.*?[^>])$/";
$endTags='';
//$text=preg_replace($endOpenPattern,'',$text);
//$text=preg_replace($endClosePattern,'',$text);
preg_match_all($openPattern,$text,$openTags);
preg_match_all($closePattern,$text,$closeTags);
//print_r($openTags);
//print_r($closeTags);
$c=0;
$loopCounter = count($closeTags[1]); //used to prevent an infinite loop if the html is malformed
while($c<count($closeTags[1]) && $loopCounter) {
$i=0;
while($i<count($openTags[1])) {
$tag = trim($openTags[1][$i]);
if(strstr($tag,' ')) {
$tag = substr($tag,0,strpos($tag,' '));
}
//echo $tag.'=='.$closeTags[1][$c]."\n";
if($tag==$closeTags[1][$c]) {
$openTags[1][$i]='';
$c++;
break;
}
$i++;
}
$loopCounter--;
}
$results = $openTags[1];
if(is_array($results)) {
$results = array_reverse($results);
foreach($results as $tag) {
$tag = trim($tag);
if(strstr($tag,' ')) {
$tag = substr($tag,0,strpos($tag,' '));
}
if(!stristr($tag,'br') && !stristr($tag,'img') && !empty($tag)) {
$endTags.= '</'.$tag.'>';
}
}
}
return $text.$endTags;
}
// switch block
switch ($makerss) {
case true: // generate rss2xml
// Get children of specified document
$tblContent= $tbl = $modx->getFullTableName('site_content');
$query= "SELECT id, pagetitle, description, introtext, content, createdon, createdby, longtitle, alias FROM $tblContent WHERE parent IN (129, 261) AND published = 1 AND isfolder = 0 ORDER BY createdon DESC";
if (!$rs= $modx->db->query($query)) {
return '';
}
while ($row= $modx->db->getRow($rs)) {
$children[]= $row;
}
$ds = $children;
// Set the Last Build Date
if ($children[0]['pub_date'] == 0) { $pubdate = $children[0]['createdon']; }
else { $pubdate = $children[0]['pub_date']; }
$buildate = "<lastBuildDate>".date("r", $children[0]['createdon'])."</lastBuildDate>";
$output .= '
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.thearchitect.co.uk/schemas/rss-2_0.xsd"
xmlns:itunes="http://www.itunes.com/DTDs/PodCast-1.0.dtd"
version="2.0"><channel>
<title>The Sounds in My Head</title>
<itunes:author>Daniel</itunes:author>
<link>http://www.thesoundsinmyhead.com/</link>
<description>A biweekly music show featuring songs and bands you might have missed. With as much liberal propaganda as I can squeeze in. Every-other Monday.</description>
<itunes:subtitle>A weekly music show featuring songs and bands you might have missed.</itunes:subtitle>
<itunes:summary>A weekly music show hosted by Daniel featuring songs and bands you might have missed. With as much liberal propaganda as he can squeeze in. Every Monday.</itunes:summary>
<language>en-us</language>
<copyright>Daniel, 2005</copyright>
<itunes:owner>
<itunes:name>Daniel</itunes:name>
<itunes:email>[email protected]</itunes:email>
</itunes:owner> <image>
<url>http://www.thesoundsinmyhead.com/images/tsimh_rss.jpg</url>
<title>The Sounds in My Head</title>
<link>http://www.thesoundsinmyhead.com/</link>
<height>320</height>
<width>126</width> </image>
<managingEditor>[email protected]</managingEditor>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<category>podcast</category>
<itunes:category text="Music"/>
<itunes:explicit>No</itunes:explicit>
<itunes:keywords>Daniel Sounds My Head indiepop indierock tmbg wompedy</itunes:keywords>
'.$buildate.'
';
// Set the Last Build Date
if ($children[0]['pub_date'] == 0) { $pubdate = $children[0]['createdon']; }
else { $pubdate = $children[0]['pub_date']; }
$bd = "<lastBuildDate>".date("r", $children[0]['createdon'])."</lastBuildDate>";
$link = $modx->config['site_url'].$modx->makeUrl($modx->documentIdentifier); // url to current page
$limit=count($ds);
if($limit>0) {
//$limit = $topitems<$limit ? $topitems : $limit;
for ($i = 0; $i < $limit; $i++) {
if ($ds[$i]['createdby']<0) {
// get web user name
$tbl = $modx->getFullTableName("web_user_attributes");
$sql = "SELECT fullname, email FROM $tbl WHERE $tbl.id = '".abs($ds[$i]['createdby'])."'";
}
else {
// get manager user name
$tbl = $modx->getFullTableName("user_attributes");
$sql = "SELECT fullname, email FROM $tbl WHERE $tbl.id = '".$ds[$i]['createdby']."'";
}
$rs2 = $modx->dbQuery($sql);
$limit2 = $modx->recordCount($rs2);
if($limit2<1) {
// get manager user name
$btbl = $modx->getFullTableName("user_attributes");
$bsql = "SELECT fullname, email FROM $btbl WHERE $btbl.id = '1'";
$brs = $modx->dbQuery($bsql);
$blimit = $modx->recordCount($brs);
$bdsuser = $modx->fetchRow($brs);
$username = "".$bdsuser['fullname']." <".$bdsuser['email'].">";
}
else {
$dsuser = $modx->fetchRow($rs2);
$username = "".$dsuser['fullname']." <".$dsuser['email'].">";
}
// determine and show summary
// contains the splitter and use splitter is on
if ((strstr($ds[$i]['content'], $splitter)) && $truncsplit) {
$summary = array();
// HTMLarea/XINHA encloses it in paragraph's
$summary = explode('<p>'.$splitter.'</p>',$ds[$i]['content']);
// For TinyMCE or if it isn't wrapped inside paragraph tags
$summary = explode($splitter,$summary['0']);
$summary = $summary['0'];
$summary = closeTags($summary);
// fall back to the summary text
} else if (strlen($ds[$i]['introtext'])>0) {
$summary = $ds[$i]['introtext'];
// fall back to the summary text count
// skipping this because of ease of breaking in the middle of an A tag...
// so it's not a good idea. If you must have this, then uncomment
// } else if(strlen($ds[$i]['content']) > $lentoshow) {
// $summary = substr($ds[$i]['content'], 0, $lentoshow).'...';
//
// and back to where we started if all else fails (short post)
} else {
$summary = $ds[$i]['content'];
}
// summary is turned off
if ($trunc == false) {
$summary = $ds[$i]['content'];
}
$alias = $ds[$i]['alias'];
$split = explode(".", $alias);
$combined = $split[2];
$combined .= $split[0];
$combined .= $split[1];
$combined .= " 0800";
$formatted = strtotime($combined );
$pubdate = date("r", $formatted);
$filename = 'episodes/'.$ds[$i]['alias'].'.m4a';
if (file_exists($filename)) {
$fileSize = filesize($filename);
}
$tbl = $modx->getFullTableName('site_tmplvar_contentvalues');
$id = $ds[$i]['id'];
$duration = $modx->db->getValue('SELECT `value` FROM '.$tbl.' WHERE `tmplvarid` = 15 AND `contentid` = '.$id .'');
$allowedTags = '<a><p><br><i><em><b><strong><img><ul><ol><li>';
// format content
$strippedsummary = $modx->stripTags($summary,$allowedTags);
$link = $modx->config['site_url'].$modx->makeUrl($ds[$i]['id']);
$output .= '<item>'."\n".
' <title>'.$ds[$i]['longtitle'].'</title>'."\n".
' <itunes:author>Daniel</itunes:author>'."\n".
' <description><![CDATA['.$strippedsummary.']]></description>'."\n".
' <author>[email protected]</author>'."\n".
' <pubDate>'.$pubdate.'</pubDate>'."\n".
' <enclosure url="http://www.thesoundsinmyhead.com/episodes/'.$ds[$i]['alias'].'.m4a" length="'.$fileSize.'" type="audio/x-m4a"/>'."\n".
' <itunes:duration>'.$duration.'</itunes:duration>'."\n".
' </item>'."\n";
}
}
$output .= ' </channel>'."\n".
'</rss>';
break;
default: // defaul mode
$output = '';
$title = $modx->documentObject['pagetitle'];
$link = $modx->config['site_url'].$modx->makeUrl($linkid);
$modx->regClientCSS('<link rel="alternate" type="application/rss+xml" title="'.$title.'" href="'.$link.'" />');
if($showlink) $output = '<a href="'.$link.'">'.$title.'</a>';
break;
}
return $output;
?>