Virtually, all of the content that CMS Made Simple displays or uses to display pages is stored in a database; therefore, it's not at all unexpected that you might want to access the database from a User-Defined Tag. Fortunately, this is not a difficult thing to do.
This recipe shows you how to get a reference to the database abstraction layer and how to issue and process a query from within your User-Defined Tag.
For this recipe, you will need access to your site's Administration area with permission to "Modify User-Defined Tags" and "Modify Templates". It assumes that you are using the default NCleanBlue template, but will work for any template.