New staticpage feature: Show staticpages via Smarty

Creating and modifying plugins.
Post Reply
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

New staticpage feature: Show staticpages via Smarty

Post by garvinhicking »

Hi!

I just upgraded the staticpage plugin in CVS to version 3.50.

It now supports to use a custom smarty function to show static pages. This can be used in your custom template files (like the userprofile .tpls) to emit specific staticpages depending on variables.

Go ahead and play with it. The API is quite basic and described in the new 'smarty.inc.php' file. It basically works like this:
// {staticpage_display template="$TEMPLATE" pagevar="$PAGEVAR" id="$ID" permalink="$PERMALINK" pagetitle="$PAGETITLE" authorid="$AUTHORID" query="$QUERY"}
//
// Variable options:
// $TEMPLATE can be replaced with the name of the staticpage template to parse. It defaults to "plugin_staticpage.tpl".
// $PAGEVAR must match the variable prefix of the staticpage template. If you want to parse multiple staticpages,
// you might need to seperate those from each other. Always use the variable prefix that is also employed in the template file.
//
// To retrieve a staticpage, you need to supply either one of those options:
// $ID can be replaced with the ID of the staticpage you want to fetch.
// $PERMALINK can be replaced with the fully configured permalink of a staticpage.
// $PAGETITLE can be replaced with the URL shorthand/backwards compatibility name of a staticpage
// $AUTHORID additionally can be combined with the variables above to restrict output to a specific author
//
// If you need more customization, you can pass a SQL query directly using $QUERY.
//
// EXAMPLE:
// To fetch a static page with the URL shorthand name 'static' you simply put this in your template file (index.tpl, a userprofile .tpl or whatever):
// {staticpage_display pagetitle='static'}
The API is quite fundamanetal right now. If you want to access more properties/parameters, please let me know, and I'll implement them.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply