Macro Reference
From pixyWiki
This section lists the macros that are available for use in the page templates and a brief description of how each works.
Contents |
Pager macros
These macros can be used for any macros which use the $pager object.
- #showNextPrevControl($pager) - Display the next/prev links of the specified $pager object.
- #showNextLink($pager) - Display the next link of the specified $pager object.
- #showPrevLink($pager) - Display the previous link of the specified $pager object.
Entry macros
- #showEntriesPager($pager $pageLink) - Displays the website entries contained in the specified $pager object and using $pageLink page template to render each entry.
- #showWeblogEntriesPager($pager) - Displays the website entries contained in the specified $pager object and using _day page template to render each entry.
Comment macros
- #showPopupCommentsLink($entry) - Display the link to make the comments for the specified entry open in a new browser windows. Uses the _popupcomments page template to display the comments.
- #showWeblogEntryComments($entry) - Display the comments associated with the specified entry, not including those entries that are not approved for posting or that are marked as spam.
- #showWeblogEntryCommentForm($entry) - Display a comment form for adding a comment to the specified entry.
Gallery macros
- #showGalleriesPager($pager $pageLink) - Displays the website galleries contained in the specified $pager object and using $pageLink page template to render each gallery.
- #showWeblogGalleryPath($gallery $divider) - Displays the list of links to parent gallery names for the given $gallery object separated by the given divider (default being "|").
Image macros
- #showImagesPager($pager $pageLink) - Displays the website images contained in the specified $pager object and using $pageLink page template to render each image.
- #showImageExifList($image $expanding $showAll) - Display a simple list of the Exif values for the specified image with a default title for each value. If $showAll is true all available Exif values will be shown, otherwise just the most common values will be shown.
List macros
- #showWeblogEntryLinksList($entries) - Display a simple list of entries, with a title and link for each.
- #showBookmarkLinksList($folderObj $expanding $subfolders) - Displays all bookmarks in a specified bookmark folder object. If $expanding and $subfolders are set to true, then display the bookmarks as an expandable tree view.
- #showReferrersList($refs $maxCount $maxLength) - Display a simple list of referrers for the blog. '$maxCount' is the total number of referrers to display. '$maxLength' is the maximum length of text for each line of the referrers list.
Menu macros
- #showPageMenu($website $showSearch $showLogin) - Display a page navigation menu that lists all pages in the website. If $showSearch is true, show a search menu item which displays a popup search box when the user hovers-over the name. If $showLogin is true, show a the login link to administer the weblog.
- #showAuthorMenu($vertical) - Display an authoring menu for the current website. If $vertical is true, then display a menu suitable for use in a narrow sidebar.
Search macros
- #showWeblogSearchForm($website $withGals) - Show a search form for searching the website and, if $withGals is true show a gallery chooser.
- #showWeblogSearchAgainForm($website) - Show search again form, suitable for display at the start of a page of search results.
- #showNextPrevSearchControl($pager) - Show special pager designed for paging through search results.
Misc macros
- #showWeblogEntryCalendar($website $gallery) - Show website entry calendar, optionally restricted by gallery name ("nil" for no gallery)
- #includeTemplate($website $pageLink) - Parse and include a page template into the current page template.
- #showAutodiscoveryLinks($website) - Show the RSS, Atom and RSD auto-discovery links suitable for use within an HTML <head> element.
- #showTrackbackAutodiscovery($entry) - Show trackback autodiscovery code for a specified website entry, suitable for use within a day template.
Displaying a Tag Cloud
We don't yet include a Tag Cloud macro because it's so easy to create one yourself. Here's what you do to display a tag cloud for your weblog. First, if you have not already done so, customize your theme. Next, you've got to get the tags you want to display from your weblog object. For example, to get your most 100 most often used tags for all time you'd do this:
#set($mytags = $model.weblog.getPopularTags(-1, 30))
Or if you want to only get tags used in the last 90 days you'd do this:
#set($mytags = $model.weblog.getPopularTags(90, 30))
Once you've got your tags, you can display them with a foreach loop. For example, here's a loop that displays each tag as a link to your weblog that displays only entries in that tag. It also gives each tag a CSS class that indicates the intensity of the tag, which indicates on a scale of zero to five how often-used the tag is.
#foreach ($tag in $mytags)
<a class="tag s${tag.intensity}" href="$url.tag($tag.name)" title="$tag.count">
$tag.name
</a>
#end
Include that #set statement and loop in your weblog template and you'll see a tag cloud, but it all the tags will be displayed in the same size and font. If you'd like to vary the size of the tags based on how often they are used, then you'll need to add some CSS. Edit your CSS template and add this to size often used tags larger than those less often used:
.s1 {font-size:60%;}
.s2 {font-size:80%;}
.s3 {font-size:100%;}
.s4 {font-size:120%;}
.s5 {font-size:140%;}

