1 (edited by 2009-01-22 14:14:23)

Topic: [FAQ][TEMPLATES] The Templates

As the subtitle suggest, templates define how an article will display on your site.
With the CN zip file come 2 templates you can use.

* Default:as the name suggests, this tempalte will be used by CuteNews when no template has been defined with your CN include code. There's nothing special about this template. It shows a number of short stories on your site with a 'read more' link to the full story.
* Headlines: The headlines template will ony show a number of article TITLES without their short stories. The titles will be links to the full story.



Templates: Where?
Login into your CN panel and then go to 'options'->'Edit templates'

Making a template
When you want to use your own template it's better to create a NEW template based on the default or headlines template. It wouldn't be the first time some asked on the forum for the original code of the default template.

Template parts
I'm not going into details here. the names pretty much explain it all i think.
Else do a google search for the meaning of the word.

How to customize
Well, the templates are pretty much html. Be aware that for each article that'll display, this html will be added to the html source of your site. So please don't do something foolish like adding CSS definitions to the templates. This will only result in repeating of the styles for each article on your page ==> bigger site to download. Some browser even give trouble when the same styles are defined multiple times on a page.
And beside the regular html CN offers some tags of their own. Thes tags will be replaced with data of your written articles.
Below we'll list all tags you can use as not all are listed in your CN panel.

Active news and Full story

* {title}: Title of the article.
* {author}: Username of the articles author. If the user has set a email-address, the name will link to that mail-address.
* {author-name}: Nickname of the articles author. No mail link is added.
* {avatar}: Show the avatar of articles author. If the user hasn't set any avatar url, no image will show. Don't forget that this tag will only work if you've set the avatars on 'enabled' under 'system configurations' in the 'news' section.
* {avatar-url}: This tag will be replaced with the url of the avatar. The same remarks for {avatar} apply here. Be aware this tag may be used inside html attributes like 'src' and 'href'.
* {short-story}: The short story of an article.
* {full-story}: The full story of an article.
* {category}: This will list the name(s) of the categorie(s) your article belongs to. This tag is bugged since CN 1.4.5. For articles within multiple categories, nothing will be shown.
* {category-id}: Shows the category id of the categorie(s) the article belongs to.
* {category-icon}: Shows the category icon(s) of the categorie(s) your article belongs to. This tag is also bugged since CN 1.4.5. A fix can be found in the FAQ forum under the [BUG] category.
* {comments-num}: The number of comments an article has.
* {news-id}: The id of an article. This is not some follow number e.g 1,2,3,4,5 but an actual id: 1227993689
* {archive-id}: The id of the archive the article belongs to. Note that only archived news has an archive id.
* {php-self}: The url to the current page without parameters. Note that this is not a html url but text.
* {date}: The date when the article was written.
* [mail][/mail]: everything in between these 2 tags will be changed into a link to send a mail to the author of the article. If a user hasn't set a email address, no the text will remain unchanged.
* [com-link][com-link]: everything in between these 2 tags will be changed into a link to the comments. If you want to use popups, have the option enabled under 'System configurations'. Also note that due to a setting under 'System configurations' the full story may appear above the comments aswell.
* [link][/link]: everything in between these 2 tags will be changed into a link to the full story. This link will always be active, even when there is no full story. This can't be used for showing popups. Also note that due to a setting under 'System configurations' the comments may appear under the full story aswell.
* [full-link][/full-link]: Can't be used in the full story section. everything in between these 2 tags will be changed into a link to the full story if there is a full story. Else the text in between the tags will remain unchanged. If you want to use popups, this tag is the only way to use them and have the option enabled under 'System configurations'. Also note that due to a setting under 'System configurations' the comments may appear under the full story aswell.


Comment

* {author}: Name of the comment poster. If the poster gave a email address or website url, his name will be clickable.
* {mail}: email address or website url of the poster.
* {date}: date when the comment was posted.
* {comment}: The message.
* {comment-iteration}: Show the sequential number of individual comment. e.g. the first comment will have number 1, the second comment number 2, etc.


Add comment form
Don't edit this part unless you know how html forms work!

* {smilies}: show a list of installed smilies user may use in their comment. Possible relevant topic.


News and Comments pagination

* {pages}: Shows linked numbers of the pages (if you have pages)
* [prev-link][/prev-link]: Will generate a link to the previous page (if there is a previous page). The text between these 2 tags will be made into a link.
* [next-link][/next-link]: Will generate a link to the next page (if there is a next page). The text between these 2 tags will be made into a link.