NP_TempVars.php

This plugin is a collection of some additional template variables and is intended as a framework for adding others.

I have started with some replacements for <%itemlink%>, <%categorylink%>, and <%authorlink%>, all of which give links with the current page's blog as the base url. This causes some trouble for users with multiple blogs who use the <%otherblog%> skinvar. <%TempVars%> in its forms use the current item's blog url for the base of its links, so links take the user to the correct blog for an item, member, or category.

General Plugin info
Author: Frank Truscott
Current Version: 0.5
Code: NP_TempVars_code
Forum Thread: http://forum.nucleuscms.org/viewtopic.php?t=12310

Installing

  1. Copy/paste the plugin code and save as NP_TempVars.php
  2. Install the plugin…

Upgrading

  1. To upgrade just replace the old file with new one.

How to use the plugin

Add the appropriate form of the plugin in your templates. The general form is as follows.

<%TempVars($action, $param1, $param2, $param3,…)%>

where $action is one of blogsetting, permalink, itemlink, icategory, category, iauthor, author, smartmore, userwebsitelink, usermaillink, iscurrentitem

Available SkinVars and/or TemplateVars

<%TempVars(blogsetting,type,blogname)%>

where type is one of id, name, desc, short, url and blogname is a blog's shortname (optional)

This is like the blogsetting skinvar, but chooses blog item belongs to not the blog of the displaying page. Replaces <%blogurl%>, <%blogid%>

<%TempVars(permalink,includeblog,includecat)%>

where

includeblog is whether to include blog specifier in link, yes or no, default is yes. (optional) includecat is whether to include category specifier in link, yes or no, default is yes. (optional)

This gives a link to item using the item's blog url and catid as specified. Replaces <%itemlink%>

<%TempVars(itemlink,includeblog,includecat)%>

synonym of permalink

<%TempVars(icategory, type)%>

where type is one of url, link, id, desc, name

displays info about item's category, but url and link use item's blog url as base instead of calling page Replaces <%categorylink%>, <%category%>

<%TempVars(category, type)%>

synonym of icategory

<%TempVars(iauthor, type)%>

where type is one of realname, link, id, email, url, name

displays info about item's author. link gives link to member area of item's blog, not the calling page. url gives the member's home site url. Replaces <%authorlink%>, <%author%>, <%authorid%>

<%TempVars(author, type)%>

synonym of iauthor

<%TempVars(smartmore)%>

This is the opposite of smartbody (if there is an extended, it is displayed, otherwise it displays the body). Use on item pages to show only the extended part if it exists. This let's you use the body of the item for a synopsis to show on main pages and the extended on the item pages.

<%TempVars(userwebsitelink)%>

This is a comment template var. Displays a link to the comment author's web site if given, otherwise just displays the name. Does not display email addresses.

<%TempVars(useremaillink)%>

This is a comment template var. Displays a link to the comment author's email address, if given, otherwise just displays the name. Does not display website addresses.

<%TempVars(iscurrentitem)%>

This is an item template var. Outputs 'yes' if viewing the current item and no if not. Useful to use css class to highlight current item in a list in menu or sidebar.

Options

Tips and Tricks

Wishlist

Bugs

History

  • Version 0.5 - 04-25-2007
    • give option of cat and blog inclusion in itemlink
  • Version 0.4 - 11-14-2006
    • updated blogsetting to mimic changes in Nucleus v3.24
    • added iscurrentitem
  • Version 0.3, released 07 November 2006
    • added userwebsitelink, useremaillink
  • Version 0.2, released 23 May 2006
tempvars.txt · Last modified: 2008/09/26 21:59 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki