Shortcodes:News

From e107 Wiki
Jump to: navigation, search

e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page

logo_wiki.png

Current Release 1.0.4 | e107.org | Download | Changelog | Forum | Plugins | Themes | RSS Feed of Latest Changes | Atom Feed of Latest Changes


e107 Shortcode Guide
Main page > I : First Aid > II : Development > III : Administration > IV : How To's > V : Plugin Writing > VI : Theming & Shortcodes



These shortcodes are those used for the news in themes and other areas of your site and can be found in the e107_files/shortcode/batch/news_shortcodes.php file.

Contents

{NEWSTITLE}

Displays the title of the news article.

{NEWSBODY}

Displays the news item's body.

{NEWSICON}

Displays the news category icon and makes it a link to that category page.

{NEWSHEADER}

Contains the path to the news category's icon. With this you can display the icon without the link.

Code: example
<img src='{NEWSHEADER}' />

{NEWSCATEGORY}

This displays the name of the category in a link to the category page.

{NEWSAUTHOR}

Displays the user name of the news author.

Parameters

{NEWSAUTHOR=nolink}: removes the link to the author's Member Profile page.

{NEWSDATE}

Displays the time and date stamp of the news article.

Parameters

{NEWSDATE}: Monday 01 January 2006 - 01:01:01
{NEWSDATE=long}: Monday 01 January 2006 - 01:01:01
{NEWSDATE=short}: 01 Jan : 01:01
{NEWSDATE=forum}: Mon Jan 01 2006, 01:01AM

{NEWSCOMMENTS}

Displays a link and the number of comments for that news article. Inorder for {NEWSCOMMENTS} to work properly you need to set the COMMENTLINK constant.

Code: example theme.php

define("COMMENTLINK", "comment(s): ");

$NEWSSTYLE = "{NEWSCOMMENTS}";

If the news item has 2 comments it will output:

Code: example

comment(s): 2

You should use a language files for the COMMENTLINK constant, but I won't go into that. See this link for more information: Creating a theme from scratch: Language Information

{NEWSCOMMENTLINK}

Similar to {NEWSCOMMENTS}, but this does not display the number of comments.

{NEWSCOMMENTCOUNT}

Displays the number of comments for the current news item.

{EMAILICON}

Displays a image link so the news item can be emailed to others.

Override this icon by placing an email.png in your images/ folder of your theme.

{PRINTICON}

Displays a image link to a printable version of the news item.

Override this icon by placing a print.png in your images/ folder of your theme.

{PDFICON}

Displays a link to a pdf version of the news item (only is displayed if the PDF plugin is installed).

{NEWSID}

Displays the news item's id number.

{ADMINOPTIONS}

This displays a image link allowing the news item to be edited by an administrator. This is only visible if you are an administrator.

Override this icon by placing a newsedit.png in your images/ folder of your theme.

{EXTENDED}

Displays a link to the news item's extended page, it is only visible if there was an extended post for the news item. You can format the link with the constants PRE_EXTENDEDSTRING, EXTENDEDSTRING, and POST_EXTENDEDSTRING.

Code: example theme.php

define("PRE_EXTENDEDSTRING", "<br /><br />[ ");
define("EXTENDEDSTRING", "Read the rest ...");
define("POST_EXTENDEDSTRING", " ]<br />");

$NEWSSTYLE = "{EXTENDED}";

If news item #3 has an extended post it will output:

Code: example

<br /><br />[ <a href='news.php?extend.3'>Read the rest ...</a> ]<br />

You should use a language files for the PRE_EXTENDEDSTRING, EXTENDEDSTRING, and POST_EXTENDEDSTRING constants, or at least the EXTENDEDSTRING constant, but I won't go into that. See this link for more information: Creating a theme from scratch: Language Information


Note: In 0.7.5 and earlier there was a potential conflict because the {EXTENDED} shortcode was also used in user-related fields. For 0.7.6 {USER_EXTENDED} has been defined, and {EXTENDED} applies only to news.

{CAPTIONCLASS}

This gives you a DIV tag with a the class='category(category_id)'. For example, in the default install of e107 it comes with a category named "Misc" this an id of "1" with a news item title "Welcome to e107" so the output would be:

Code: example output
<div class='category1'>Welcome to e107</div>

{ADMINCAPTION}

comming soon

{ADMINBODY}

comming soon

{NEWSSUMMARY}

Displays the news item's summary.

{NEWSTHUMBNAIL}

This displays the image chosen for the news item. It is the same as the {NEWSIMAGE}.

{NEWSIMAGE}

This displays the image chosen for the news item. It is the same as the {NEWSTHUMBNAIL}.

{STICKY_ICON}

This displays the sticky image icon on the news item if the item is set to sticky.

{NEWSTITLELINK}

This displays the news title as a link. The link goes to a separate page for that news item.

Parameters

{NEWSTITLELINK=item}: Link goes to short version of item (default)
{NEWSTITLELINK=extend}: Will make the newstitle link go directly to the extended view of the item

{NEWSCATICON}

This displays the category icon, as a link, that the news item is in.

{TRACKBACK}

This displays the trackback link. It also requires the TRACKBACKSTRING constant and the TRACKBACKBEFORESTRING constant.

Code: example theme.php
define("TRACKBACKSTRING", "Trackback");
define("TRACKBACKBEFORESTRING", " :: ");

$NEWSSTYLE = "{TRACKBACK}";

This would output a link like:

Code: Output
:: <a href='comment.php?comment.news.3#track'>Trackbacks: </a>

You should use a language files for the TRACKBACKSTRING constant, but I won't go into that. See this link for more information: Creating a theme from scratch: Language Information

{NEWSINFO}

This displays all sort of information on the news item such as start date, end date, render type, news class, if it is sticky, does it allow comments, body length (in bytes), and the extended length (in bytes).