We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2136
    • 134 Posts
    hey folks,

    finally got around to working with ModX, for www.tinygrass.com/welcome. i’m still getting my head around the organization and such, and took a peak at the basic blog tutorial on the site. some quick qs (which is from a mind of mush after a long day at work):

    - why can’t content admins also be web users? seems strange to make another user when i already exist.
    - as i’m coming over from textpattern, is there a way to make the home page show all the latest blog topics, or is it limited to the folder that the blog pages are created in?
    - what shows up for the recent pages link? i made a test blog page, shouldn’t it show up for that?
    - similar q for ’related links’: how are pages related?
    - i have some memory that there was some sort of functionality for word replacement, but now i’m not sure if it was ModX or not (ie someone makes a comment with a word, say ’liverwurst’ and when the page is published, that word is replaced by ’chocolate’).

    apologies if this is really basic stuff, i’m in the process of drinking coffee to wake myself up a bit....
      Sorry - not using ModX anymore 01/01/2007
      • 7923
      • 4,213 Posts
      Quote from: arphaus at Jul 17, 2006, 03:49 AM

      - why can’t content admins also be web users? seems strange to make another user when i already exist.
      The user separation will be removed in upcoming v1.0 and maybe even sooner, but atleast in 1.0.
      Quote from: arphaus at Jul 17, 2006, 03:49 AM

      - as i’m coming over from textpattern, is there a way to make the home page show all the latest blog topics, or is it limited to the folder that the blog pages are created in?
      You can use Ditto to get the blog topics/summarys from anywhere in any shape. In &startID parameter you can define the folders where to look for blog posts (comma delimitted for multiple folders) and with &descendentDepth parameter you can define how deep it should go through the hierarchy.
      Quote from: arphaus at Jul 17, 2006, 03:49 AM

      - what shows up for the recent pages link? i made a test blog page, shouldn’t it show up for that?
      If you mean the "recently" section in your site, it depends what you have there in your template. In the default template, this section has [[ListIndexer?LIn_root=0]] snippet call. That calls a snippet named ListIndexer, what should get most recent documents. It goes through the whole tree hierarchy, but by default, it wont go through unpublished folders. So if your blogs come to an unpublished folder (or there is an unpublished folder somewhere above that tree branch), they wont show up in your recent pages list.. It’s all how you setup it and want to show your content. Look at the start of ListIndexer snippet for the available parameters to use.

      Also the snippet call is being cached. If your document is set to cached too, the snippet will get the recent pages only first load of that page. Then it wont get them until you do site refresh. But if you change it to uncached call [!ListIndexer?LIn_root=0!] it will run every time even if the document’s itsef are cached.
      Quote from: arphaus at Jul 17, 2006, 03:49 AM

      - similar q for ’related links’: how are pages related?
      Again, the default template has a snippet call [[ListRelated? &LR_title=`Other pages possibly of interest...`]] here. It lists related document’s based on the keywords that they have. Look at the start of the snippet for more information. The same cache things above are valid for this too.
      Quote from: arphaus at Jul 17, 2006, 03:49 AM

      - i have some memory that there was some sort of functionality for word replacement, but now i’m not sure if it was ModX or not (ie someone makes a comment with a word, say ’liverwurst’ and when the page is published, that word is replaced by ’chocolate’).
      Yes, there is a plugin for this, you can get it from here. The resources are abit scattered currently, but you can find newest resources from the resource repository and we are working on getting the past resources added to there too. You might also be interested to see the AutoLink module.

      I hope these answers will get you further in your studying. Feel free to ask more questions if you need.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 2136
        • 134 Posts
        thanks very much - that clears up a lot. hopefully i can get the basic site going in the next day or two and share it with the community.
          Sorry - not using ModX anymore 01/01/2007
          • 2136
          • 134 Posts
          Quote from: doze at Jul 17, 2006, 07:10 AM

          You can use Ditto to get the blog topics/summarys from anywhere in any shape. In &startID parameter you can define the folders where to look for blog posts (comma delimitted for multiple folders) and with &descendentDepth parameter you can define how deep it should go through the hierarchy.
          cool - it makes sense after reading through the docs a bit. i still don’t have a handle on commenting, but i’m sure there’s something in the forums for that.

          Quote from: doze at Jul 17, 2006, 07:10 AM

          If you mean the "recently" section in your site, it depends what you have there in your template. In the default template, this section has [[ListIndexer?LIn_root=0]] snippet call. That calls a snippet named ListIndexer...

          Again, the default template has a snippet call [[ListRelated? &LR_title=`Other pages possibly of interest...`]] here....
          are these snippets that i have to add? i don’t see either ListIndexer or ListRelated in my list of snippets. is there a difference between installing with the minimal site or the full site?

          thanks again for the help.
            Sorry - not using ModX anymore 01/01/2007
            • 7923
            • 4,213 Posts
            Quote from: arphaus at Jul 18, 2006, 02:53 AM

            Quote from: doze at Jul 17, 2006, 07:10 AM

            If you mean the "recently" section in your site, it depends what you have there in your template. In the default template, this section has [[ListIndexer?LIn_root=0]] snippet call. That calls a snippet named ListIndexer...

            Again, the default template has a snippet call [[ListRelated? &LR_title=`Other pages possibly of interest...`]] here....
            are these snippets that i have to add? i don’t see either ListIndexer or ListRelated in my list of snippets. is there a difference between installing with the minimal site or the full site?

            thanks again for the help.
            They should have come with the installation. There is a step where you can select what snippets you want to be installed. Not sure if they were missing from the newest installation package, there was some issues with the default contents, because the release had to be speeded up to fix some security issues.

            Unfortunately, these core snippets are not added to the repository yet, so here they are:

            Just copy-paste to modx manager to create new snippets out of the source. (Tip: you can select the source easiest by first clicking the beginning of code, then scrolldown and by holding shift click at the end of the code.)

            ListRelated
            // --------------------
            // Snippet: ListRelated
            // --------------------
            // Version: 1.0 beta 1
            // Date: September 6, 2005
            // [email protected]
            //
            // This snippet was designed to show a list of pages that are
            // related based on specified keywords, or those used in the
            // current page
            //
            // Based on ListRelated by Jaredc and updated for MODx.
            // [email protected]
            //
            // Needs to be updated to support Webuser Logins Menu Items
            // and also possibly "in menu" items.
            //
            
            // Configuration Settings
            
               // LR_keywords [ string ]
               // This is a comma separated list of keywords that can be set
               // from the snippet parameter ONLY. Ex:
               // [[ListRelated?LR_keywords=fun,functional,good stuff]]
               // If no snippet variable is set, related pages will be found
               // based on the host page's keywords.
            
               // $maxRelated [ int ]
               // The maximum number of related pages you want to have. Can also
               // be set/overridden as the snippet variable "LR_max" as in:
               // [[ListRelated?LR_max=5]]
               $maxRelated = 10;
            
               // $relatedListTitle [ string ]
               // Give your related list of links a title if you desire- otherwise
               // set as an empty string ''. Can also be declared in snippet call
               // with "LR_title" like:
               // [[ListRelated?LR_title=Other links you might like]]
               $relatedListTitle = 'Related links:';
            
               // $linkToSearch [ true | false ]
               // If you would like to have a link at the end of your list for more
               // links based on search results of the current keywords.
               // FUTURE FEATURE - NOT CURRENTLY USED
               $linkToSearch = false;
            
               // $removeNewlines [ true | false ]
               // As always, with lists, it's best NOT to have new lines and whitespace
               // with IE. For debugging and reading source code, set to false, for live
               // implementation and styling, try setting to true.
               $removeNewlines = true;
               
               // $sortBy [ 'date' | 'pagetitle' ]
               // Field you would like to sort by. Options include:
               // date       - dates will be sorted by pub_date if it exists, else createdon
               // pagetitle  - page title
               // Can also be set in snippet call with $LR_sortBy (see example under $sortDir)
               $sortBy = 'date';
               
               // $sortDir [ 'ASC' | 'DESC' ]
               // Choose to sort in ascending (ASC) or descending (DESC) order. Can be set
               // in snippet call with $LR_sortDir:
               // [[ListRelated?LR_sortBy=date&LR_sortDir=DESC]]
               $sortDir = 'DESC';
            
               // $nonefound [ 'string' ]
               // What to return when no related  records are found.
               $nonefound = '<p>No related pages or links.</p>';
            
            // Styles
            
               // .LR_listTitle     class for list title
               // .LR_linksList     class for ul element
            
            // ***********************************
            // END CONFIG SETTINGS
            // THE REST SHOULD TAKE CARE OF ITSELF
            // ***********************************
            
            // assign IE variable
            $newline = ($removeNewlines)? '':"\n";
            
            // assign appropriate default or passed variables
            $maxRelated = (isset($LR_max))? $LR_max : $maxRelated;
            $relatedListTitle = (isset($LR_title))? $LR_title : $relatedListTitle ;
            $sortBy = (isset($LR_sortBy))? $LR_sortBy: $sortBy ;
            $sortDir = (isset($LR_sortDir))? $LR_sortDir :$sortDir ;
            
            // Make array of keywords from snippet or from current page. Snippet
            // variables have priority.
            
            if (isset($LR_keywords)){
              $kArray= explode(",",$LR_keywords);
            } else {
              $kArray = $modx->getKeywords();
            }
            
            // if there are keywords, make the list
            $relatedOutput = '';
            if ($kArray) {
              $keyString = '';
              foreach ($kArray as $key){
                $keyString .= "'".$key."',";
              } 
              $keyString = substr($keyString,0,strlen($keyString)-1);
            
              // make sql statement for retreiving similar pages
              $pre= $modx->dbConfig['dbase'].".".$modx->dbConfig['table_prefix'];

            $relatedSql = "
            SELECT DISTINCT content.id, content.pagetitle,
            IF(content.pub_date > 0, content.pub_date, content.createdon) AS date
            FROM
            ".$pre."site_content AS content,
            ".$pre."keyword_xref AS xref,
            ".$pre."site_keywords AS keywords
            WHERE keywords.keyword IN (".$keyString.")
            AND xref.keyword_id = keywords.id
            AND content.id = xref.content_id
            AND content.id != ".$modx->documentObject['id']."
            ORDER BY ". $sortBy . ' ' . $sortDir ."
            LIMIT ".$maxRelated.";";

            $relatives = $modx->dbQuery($relatedSql);
            $relativeCount = $modx->recordCount($relatives);
            $relArray = array();
            for($i=0;$i<$relativeCount;$i++) {
            array_push($relArray,$modx->fetchRow($relatives));
            }

            // start output if we have results
            if ($relativeCount) {
            $relatedOutput .= ($relatedListTitle )?'<span class="LR_listTitle">' . $relatedListTitle . '</span>' : '' ;
            $relatedOutput .= '<ul class="LR_linksList">'.$newline;
            for ($li=0;$li<$relativeCount;$li++){
            $relatedOutput .= '<li><a href="[~' . $relArray[$li]['id'] . '~]">' . $relArray[$li]['pagetitle'] . '</a></li>'.$newline;
            }
            $relatedOutput .= '</ul>'.$newline;
            }
            }
            if (empty($relatedOutput)) {
            // there are no related records for this page
            $relatedOutput .= $nonefound.$newline;
            }

            return $relatedOutput;
            <br /><br />ListIndexer<br />
            // --------------------
            // Snippet: ListIndexer
            // --------------------
            // Version: 1.0
            // Date: 10 Oct 2005
            //
            // Derived from ListIndex 0.6j by [email protected]
            // Now supports Show In Menu
            //
            // This snippet was designed to be a VERY flexible way
            // of showing what has been recently added. You can use
            // this snippet to show news from one folder, or what has
            // been recently added site wide. You can even show what's
            // new in a 'section' (everything under a defined folder)!
            //

            // Configuration Settings

            // Set the following snippet defaults the way you would normally
            // use this snippet, then use snippet variables in other situations
            // to override the default behaviors.

            // GENERAL OPTIONS

            // $rootFolder [ NULL | string (comma separated page id's) ]
            // Decide which folder to pull recent documents from.
            // If you want to specify a few folders, comma separate them.
            // The default NULL will set current page as root. Using 0
            // would search site wide. Can be set with snippet parameter
            // $LIn_root like:
            // [[ListIndexer?LIn_root=3,6,88]]
            $rootFolder = NULL;

            // $descendentDepth [ int ]
            // How many levels below the root folder(s) do you want to
            // include? Can be overridden in snippet call with LIn_depth:
            // [[ListIndexer?LIn_depth=2]]
            // Uncomment one of these common two or create your own:
            // $descendentDepth = 1; // just children of root folder(s)
            $descendentDepth = 0; // all decendents of root folder(s)

            // $seeThruUnpub [ true | false ]
            // When using descendents, do you want to consider files below
            // an unpublished (hidden) folder? Usually no. But you decide.
            // Snippet parameter: LIn_seeThru
            // [[ListIndexer?LIn_seeThru=1]]
            $seeThruUnpub = false;

            // $seeShowInMenu [ true | false ]
            // When using descendents, do you want to consider files flagged
            // to be hidden from the menus? Usually no. But you decide.
            // Snippet parameter: LIn_seeShowInMenu
            // [[ListIndexer?LIn_seeShowInMenu=1]]
            $seeShowInMenu = false;

            // $mode [ 'short' | 'full' ]
            // Defines whether this list should be a full, paged
            // list of all documents, or a short list of the most
            // recent few (how many will be defined next). Can be
            // overridden in snippet call with $LIn_mode:
            // [[ListIndexer?LIn_mode=full]]
            $mode = 'short';

            // $sortBy [ 'alpha' | 'date' | 'menuindex' ]
            // The default date will sort by most recent items first, but
            // by using the 'alpha' option, and using full mode, you could
            // use this to create an index, or directory.
            // Settable with snippet call $LIn_sort:
            // [[ListIndexer?LIn_sort=alpha]]
            $sortBy = 'date';

            // $sortDir [ 'ASC' | 'DESC' ]
            // Sort direction ascending or descending. Is applied to whatever $sortBy
            // field you have chosen above. If left blank, menuindex and alpha will sort
            // ASC and date DESC.
            // $LIn_dir in snippet call:
            // [[ListIndexer?LIn_dir=ASC&LIn_sortBy=menuindex]]
            $sortDir = '';

            // WHAT TO DISPLAY

            // $defaultTitle [ string ]
            // If you want a default title for your list
            // you can declare it here. Or use an empty
            // string to leave this off. This can be overridden
            // in the snippet call with the variable $LIn_title:
            // [[ListIndexer?LIn_title=Some new title]]
            $defaultTitle = '';

            // $shortDesc [ true | false ]
            // Show the description on the short list, or not. Snippet
            // parameter $LIn_sDesc:
            // [[ListIndexer?LIn_sDesc=0]]
            $shortDesc = true;

            // $fullDesc [ true | false ]
            // Show the description on the full list, or not. Snippet
            // parameter $LIn_fDesc:
            // [[ListIndexer?LIn_fDesc=0]]
            $fullDesc = true;

            // $linkToIndex [ int ]
            // If you have a page set up as an 'index' for all the
            // documents in this list, you can link to it by specifying
            // its id- can also be set in snippet call with LIn_link:
            // [[ListIndexer?LIn_link=8]]
            // The default 0 will eliminate this link
            $linkToIndex = 0;

            // $indexText [ string ]
            // If you want a link to an index (probably a page running this
            // snippet in "full" mode), you can declare what you want that
            // link to say here. Or in the snippet call with LIn_indexText:
            // [[ListIndexer?LIn_indexText=Financial News Index]]
            $indexText = 'Index';

            // $showCreationDate [ true | false ]
            // Decide to include date of creation in output or not. From
            // snippet call $LIn_showDate use 1 (true) or 0 (false)
            // [[ListIndexer?LIn_showDate=1]]
            $showCreationDate = true;

            // $dateFormat [ string ]
            // Used to define how date will be displayed (if using date)
            // Y = 4 digit year y = 2 digit year
            // M = Jan - Dec m = 01 - 12
            // D = Sun - Sat d = 01 -31
            // Other standard PHP characters may be used
            $dateFormat = 'Y.m.d';

            // $shortQty [ int ]
            // Number of entries to list in the short list. Can be
            // overridden in snippet call with $LIn_sQty:
            //[[ListIndexer?LIn_sQty=3]]
            $shortQty = 3;

            // PAGING

            // $fullQty [ int ]
            // Number of entries PER PAGE to list in the full list
            // Can be overridden in snippet call with $LIn_fQty:
            // [[ListIndexer?LIn_fQty=20]]
            // To show all set to 0 here or in snippet call
            $fullQty = 10;

            // $pageSeparator [ string ]
            // What you want your page number links to be separated by.
            // You NEED to include spaces if you want them. They are NOT
            // created automatically to facilitate styling ability.
            // For instance, " | " will render links like:
            // 1 | 2 | 3 | 4
            $pageSeparator = " | ";

            // $pgPosition [ 'top' | 'bottom' | 'both']
            // Pick where you want your pagination links to appear.
            $pgPosition = 'both';

            // PERFORMANCE

            // $useFastUrls [ true | false ]
            // IMPORTANT- using fast urls will reduce database queries
            // and improve performance WHEN IN FULL MODE ONLY and
            // should NOT be used when multiple instances of this snippet
            // appear on the same page. With snippet call LIn_fast use 1
            // (true) or 0 (false)
            // [[ListIndexer?LIn_fast=0]]
            $useFastUrls = false;

            // $newLinesForLists [ true | false ]
            // Depending on how you want to style your list, you may
            // or may not want your <li>s on new lines. Generally, if you
            // are displaying then inline (horizontal, you do not want new
            // lines, but standard vertical block styling you do. This is
            // for IE, real browsers don't care.
            $newLinesForLists = true;

            // Styles
            //
            // The following are the styles included in this snippet. It is up
            // to you to include these styles in your stylesheet to get them to
            // look the way you want.

            // div.LIn_title {} List title div
            // ul.LIn_fullMode {} UL class
            // ul.LIn_shortMode {} UL class
            // span.LIn_date {} Span surrounding pub/created date
            // span.LIn_desc {} Span surrounding description
            // div.LIn_pagination Div surrounding pagination links
            // span.LIn_currentPage {} Span surrounding current page of
            // pagination (which wouldn't be css-able
            // by virtue of its <a> tag)


            // **********************************************************************
            // END CONFIG SETTINGS
            // THE REST SHOULD TAKE CARE OF ITSELF
            // **********************************************************************

            // Take care of IE list issue
            $ie = ($newLinesForLists)? "\n" : '' ;

            // Use snippet call defined variables if set
            $activeTitle = (isset($LIn_title))? $LIn_title : $defaultTitle ;
            $mode = (isset($LIn_mode))? $LIn_mode : $mode ;
            $descendentDepth = (isset($LIn_depth))? $LIn_depth : $descendentDepth ;
            $seeThruUnpub = (isset($LIn_seeThru))? $LIn_seeThru : $seeThruUnpub ;
            $seeShowInMenu = (isset($LIn_seeShowInMenu))? $LIn_seeShowInMenu : $seeShowInMenu ;
            $linkToIndex = (isset($LIn_link))? $LIn_link : $linkToIndex ;
            $rootFolder = (isset($LIn_root))? $LIn_root : $rootFolder ;
            $shortQty = (isset($LIn_sQty))? $LIn_sQty : $shortQty ;
            $fullQty = (isset($LIn_fQty))? $LIn_fQty : $fullQty ;
            $showCreationDate = (isset($LIn_showDate))? $LIn_showDate : $showCreationDate ;
            $indexText = (isset($LIn_indexText))? $LIn_indexText : $indexText ;
            $useFastUrls = (isset($LIn_fast))? $LIn_fast : $useFastUrls ;
            $sortBy = (isset($LIn_sort))? $LIn_sort : $sortBy;
            $shortDesc = (isset($LIn_sDesc))? $LIn_sDesc : $shortDesc ;
            $fullDesc = (isset($LIn_fDesc))? $LIn_fDesc : $fullDesc ;
            $sortDir = (isset($LIn_dir))? $LIn_dir : $sortDir ;
            if ($sortDir == '') $sortDir = ($sortBy == 'date')? 'DESC' : 'ASC' ;


            // Make useful variable shortcut for the content table
            $tbl = $modx->dbConfig['dbase'] . "." . $modx->dbConfig['table_prefix'] . "site_content";

            // Initialize output
            $output = '';

            // ---------------------------------------------------
            // ---------------------------------------------------
            // Query db for parent folders, or not. First check to
            // see if a querystring cheat has been provided- this
            // should speed things up considerably when using this
            // in full mode. (a.k.a. fastUrls)
            // ---------------------------------------------------
            // ---------------------------------------------------
            $inFolder= isset($_GET['LIn_f'])? $_GET['LIn_f']: 0;
            if ((!$inFolder && $useFastUrls) || !$useFastUrls ){
            // Only run all the database queries if we don't already
            // know the folders AND fastUrls are desired.

            // ---------------------------------------------------
            // Seed list of viable parents
            // ---------------------------------------------------

            if ($rootFolder == NULL){
            $rootFolder = $modx->documentIdentifier;
            }
            // Set root level parent array
            $seedArray = explode(',',$rootFolder);
            $parentsArray = array();
            foreach($seedArray AS $seed){
            $parentsArray['level_0'][] = $seed;
            }

            // ---------------------------------------------------
            // Make array of all allowed parents
            // ---------------------------------------------------

            // Process valid parents
            $levelCounter = 1;

            while (((count($parentsArray) < $descendentDepth) || ($descendentDepth == 0)) && ($levelCounter <= count($parentsArray)) && ($levelCounter < 10)){

            // Find all decendant parents for this level
            $pLevel = 'level_'.($levelCounter - 1);
            $tempLevelArray = $parentsArray[$pLevel];

            foreach($tempLevelArray AS $p){

            // Get children who are parents (isfolder = 1)
            $validParentSql = "";
            $validParentSql .= "SELECT id FROM $tbl WHERE ";
            $validParentSql .= "isfolder = 1 AND parent = $p ";
            $validParentSql .= "AND $tbl.deleted=0 ";
            $validParentSql .= ($seeThruUnpub)? ";" : "AND $tbl.published = 1;";

            // Run statement
            $rsTempParents = $modx->dbQuery($validParentSql);
            // Get number of results
            $countTempParents = $modx->recordCount($rsTempParents);

            // If there are results, put them in an array
            $tempValidArray = false;
            if ($countTempParents){
            for ($i=0;$i<$countTempParents;$i++){
            $tempId = $modx->fetchRow($rsTempParents);
            $tempValidArray[] = $tempId['id'];
            } // end while
            } // end if

            // populate next level of array
            if ($tempValidArray){
            foreach($tempValidArray AS $kid){
            $kidLevel = 'level_'.$levelCounter;
            $parentsArray[$kidLevel][] = $kid;
            } // end foreach

            } // end if
            } // end foreach

            // Do next level
            $levelCounter++;

            } // end while

            // Finalize list of parents
            $validParents = '';
            foreach ($parentsArray AS $level){
            foreach ($level AS $validP){
            $validParents .= $validP . ',';
            }
            }

            // Remove trailing comma
            $validParents = substr($validParents,0,strlen($validParents)-1);

            } else {
            $validParents = $_GET['LIn_f'];
            }

            // ---------------------------------------------------
            // Make appropriate SQL statement to pull recent items
            // ---------------------------------------------------

            // Initialize
            $recentSql = "";
            $recentSql .= "SELECT id, pagetitle, description";
            // Include pub_date or createdon date if date is desired
            $recentSql .= ($showCreationDate)? ", IF(pub_date > 0, pub_date, createdon) AS pubDate ": " " ;
            $recentSql .= "FROM $tbl ";
            $recentSql .= "WHERE ";
            // Look everywhere, or just under valid parents
            $recentSql .= (($rootFolder == 0) && $seeThruUnpub && ($descendentDepth == 0))? "" : "parent IN ($validParents) AND " ;
            // Published
            $recentSql .= "$tbl.published = 1 ";
            // Show In Menu
            $recentSql .= ($seeShowInMenu)? " " : " AND $tbl.hidemenu=0 " ;
            // Not deleted
            $recentSql .= "AND $tbl.deleted=0 ";
            // Choose sort method
            switch ($sortBy){
            case 'alpha':
            $recentSql .= "ORDER BY pagetitle ";
            break;
            case 'menuindex':
            $recentSql .= "ORDER BY menuindex ";
            break;
            default:
            $recentSql .= "ORDER BY IF(pub_date>0, pub_date, createdon) ";
            break;
            }
            // Provide a sort direction
            $recentSql .= $sortDir;

            // If this is a short list, just pull a limited number
            $recentSql .= ($mode == 'short')? " LIMIT $shortQty;" : ";" ;

            // Run statement
            $rsRecent = $modx->dbQuery($recentSql);
            // Count records
            $recentLimit = $modx->recordCount($rsRecent);

            // ---------------------------------------------------
            // Generate pagination string if needed
            // ---------------------------------------------------
            $offsetParam = isset($_GET['LIn_o'])? $_GET['LIn_o']: 0;
            $offset = ($offsetParam && ($mode == 'full'))? $offsetParam : 0 ;
            $pagination = '';

            // Don't bother unless there are enough records to justify it
            if ( ($mode == 'full') && ($recentLimit > $fullQty) && ($fullQty) ){
            $fullUrl = $_SERVER['REQUEST_URI'];
            $urlPieces = parse_url($fullUrl);
            $urlPath = $urlPieces['path'];
            $otherQs = '';

            if ($urlPieces['query']){
            foreach($_GET AS $qsKey=>$qsValue){
            if (($qsKey != 'LIn_o') && ($qsKey != 'LIn_f')){
            $otherQs .= '&'.$qsKey.'='.$qsValue;
            }
            }
            }

            $fastUrl = $urlPath.'?LIn_f='.$validParents.$otherQs;

            // Determine number of pages needed to show results
            $totalPages = ceil($recentLimit/$fullQty);

            // Make links
            for ($j = 0 ; $j < $totalPages; $j++){
            // only include links to OTHER pages, not current page
            if($offset == $j*$fullQty){
            $pagination .= '<span class="LIn_currentPage">'.($j+1) .'</span>';
            } else {
            $pagination .= '<a href="'.$fastUrl.'&LIn_o='.($j*$fullQty).'" title="'.($j+1).'">'.($j+1) .'</a>';
            }
            if ($j < $totalPages-1){
            $pagination .= $pageSeparator;
            }
            }

            // Make final pagination link set in it's own div
            $pagination = '<div class="LIn_pagination">'."\n".$pagination."\n</div>\n";

            }


            // ---------------------------------------------------
            // Create title if wanted
            // ---------------------------------------------------

            if ($activeTitle){
            $output .= '<div class="LIn_title">'.$activeTitle.'</div>'."\n";
            }

            // ---------------------------------------------------
            // Create list of recent items
            // ---------------------------------------------------

            // Include pagination
            $output .= ($pgPosition == 'top' || $pgPosition == 'both')? $pagination : '' ;

            $output .= '<ul class="LIn_'.$mode.'Mode">' . $ie;

            $recentCounter = $offset;
            if ($mode == 'short') {
            $recentCounterLimit = min($shortQty,$recentLimit);
            } else {
            $recentCounterLimit = ($fullQty)? min(($fullQty+$offset),$recentLimit) : $recentLimit ;
            }

            while (($recentCounter < $recentCounterLimit) && $rsRecent && ($recentLimit > 0)){
            mysql_data_seek($rsRecent,$recentCounter);
            $recentRecord = $modx->fetchRow($rsRecent);
            $output .= '<li>';
            // Link to page
            $output .= '<a href="[~'.$recentRecord['id'].'~]" title="'.strip_tags($recentRecord['pagetitle']).'">'.$recentRecord['pagetitle'].'</a> ';
            // Date if desired
            if ($showCreationDate){
            $output .= '<span class="LIn_date">'.date($dateFormat,$recentRecord['pubDate']).'</span> ';
            }
            // Description if desired
            if ((($mode == 'short') && ($shortDesc)) || (($mode == 'full') && ($fullDesc))){
            $output .= '<span class="LIn_desc">'.$recentRecord['description'].'</span>';
            }
            // wrap it up
            $output .= '</li>' . $ie;
            $recentCounter ++;
            }

            $output .= '</ul>' . $ie;

            $output .= ($pgPosition == 'bottom' || $pgPosition == 'both')? $pagination : '' ;

            // ---------------------------------------------------
            // Link to index
            // ---------------------------------------------------

            if ($linkToIndex) {

            $output .= '<div class="LIn_index">';
            $output .= '<a href="[~'.$linkToIndex.'~]" title="'.$indexText.'">'.$indexText.'</a>';
            $output .= '</div>';

            }

            // ---------------------------------------------------
            // Send to browser
            // ---------------------------------------------------

            return $output;
            <br />


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 2136
              • 134 Posts
              thanks, those are working now smiley. having fun looking through the repository for stuff to try as well!
                Sorry - not using ModX anymore 01/01/2007