U
D
RM9WY ( ex. ra9woy ) Ham's site
      help
10 Jan 2022 by RM9WY #  

What are Categories and How To Use Them

When adding new category, it will appear in the "Add News" section. Therefore when you post your news you'll be able to specify a category to which the article will belong (selecting category it optional), that way you can organize your news. Now, when adding new category you'll be able to specify name for this category and optionally URL to icon for this category. Automatically an ID number will be set for the new category, this ID is used when using include script to show all news only from this category. Example code:

<?PHP
$category = "2";
include("path/to/show_news.php");
?>

the above PHP code included on your page will display all news from category with ID 2
If you for example have 5 categories and want to display news on one page from only 3 of the categories, you can use the fallowing code:

<?PHP
$category = "2,3,5";
include("path/to/show_news.php");
?>

the above code will display all news from categories with ID 2, 3 and 5.
When you does not use $category = "<ID>"; CuteNews will display the news from all categories, but when using this code, only news from the specified category(s) will be shown.

The category icon can be shown together with your news, to do this you must put {category-icon} in your news templates.

 

Template variables

 

Active news, Full story, Print

Common variables  
{title} Title of the article
{short-story} Short story of news item
{full-story} The full story
{date} Date when the story is written
{author} Author of the article, with link to his email (if any)
{author-name} The name of the author, without email
{comments-num} This will display the number of comments posted for article
{category} Name of the category where article is posted (if any). If there is no category for the article, it is empty.
{category-icon} Shows the category icon. If there is no category for the article, it is empty.
{month} Month name from system config
{weekday} Equivalent to date('l')
{year} Equivalent to date('Y')
{day} Equivalent to date('d')
{hours} Equivalent to date('H')
{minute} Equivalent to date('i')
{since} Display, for ex. "N minutes ago."
{tagline} Tags line
{page_alias} Show page alias
System variables  
{phpself} $PHP_SELF value
{go-back} Go back button
{cute-http-path} CuteNews root path
{news-id} News ID
{category-id} Category ID
{archive-id} Archive ID
{rss-news-include-url} Link to include rss
Social buttons  
{fb-comments} Facebook comments
{fb-like} Facebook Like button
{twitter} Twitter send button
{gplus} G+ button
Wrappers  
.. Will generate a permanent link to the full story
Will generate a print link
Link to the full story of article, only if there is full story
Generate link to the comments of article
Make link to edit article at admin panel
Truncate specified words number
Will generate a link to the author mail (if any) eg.
Show code only for CATID
Show a template fragment for an authorized user
Make image link
Make "more" field
... Make youtube link
Save the text unchanged

 

Comment, Add coment form

{author} Name of the comment poster
{date} Date when the comment was posted
{smilies} Show smiles tab
{remember_me} Remember form
Captcha image
Captcha image
{input_username} Input username form
{input_email} Input email form
{input_commentbox} Input comment box form
{edited} Show edited date of comment
{comment} The comment
Text, show if edit allowed
Delete, show if edit allowed
{mail} E-mail of the poster
{username} If user logged, show username
{usermail} If user logged, show e-mail
{comment-id} The Comment ID
{comment-iteration} Show the sequential number of individual comment

Stylize search form

{php_self} $PHP_SELF
{search_basic} Input box for search phrase
{author} Input box for author
{in_archives} Checkbox "in archives"
Submit button wrapper
HIDDEN input box for custom user query
{select=year:from}
{select=mon:from}
{select=day:from}
{select=year:to}
{select=mon:to}
{select=day:to}
SELECT box for date range

 

News and comments pagination

Will generate a link to previous page (if there is)
Will generate a link to next page (if there is)
{pages} Shows current page number
 

Understanding Templates

Templates are used for easy editing the news look and the way news are displayed.

You can view the different parts of the template that are used for different parts of your news look. For example the "Active News" part of the default template is used to modify the look of the active news, "Full Story" for the way your full story will look like, "Comment" is the part corresponding to the appearance of the comments posted by users etc.

When editing parts of the template you can use HTML in them to build different structures etc. Now you'll need to add some special tags in your templates to specify the place where the title of your news will be displayed and the author name and the date when the news was pasted etc... these tags are explained above each part of the template.
Lets take the "Active News" part for example: when you expand this part, a list of allowed tags for this part will be displayed and under them will be the text area. One very common and easy tag is {title}, wherever you put this tag in your template it will be replaced with the real title of your news.

You can have more than one template, this is useful if you want to include the news on different pages of your site with different look of the news.
After creating more templates you must use specific code when including news to indicate whit which template the news to be shown.
example code:

<?PHP
$template = "my_test_template";
include("path/to/show_news.php");
?>

With the above code, all news will be showed using the my_test_template that you have created yourself. if you don't specify what template to use, all news will use Default template which cannot be deleted.

 

Understanding user levels

For better security and control of your users there four types of user-levels implemented in CuteNews. Each user-level has limited permissions in doing specified actions.
The user-levels are as follows:

  1. Administrators - administrators are allowed to do anything they want: edit others posts, comments, ban users, edit system configurations and everything else ... so be careful when adding users as administrators!
  2. Editors - the users from this level are allowed to post news, they can edit own posts and the news posted from all other users. They can also approve news which are added by the 'Journalists'
  3. Journalists - this level is for users who only need to post and edit news. They can edit only own posts !. When journalist add's new article it will not be active and instead will be marked as 'Unapproved', In order for this article to become visible admin or editor must approve it.
  4. Commenters and Ban - when users from this level login, they are allowed only to change their passwords. Cannot post, edit news or perform any other action. This is useful when some user wants his username to be password protected when posting comments and no one else to be able to post with his username. You can also deny unregistered users to be able to post comments.

In 2.0 you can create more user level groups.

 

About HTML-scripts

Insert by $snippet = 'sandbox'; include 'snippet.php';

 

Some variables you are allowed to use

Here is a list of all possible variables that you are allowed to use when including news or archives:

<?PHP

$number = "<X>";  // show only the X newest articles.
$template = "<NAME>";  // load another template, if you don't use it the default template will be loaded.
$static = TRUE;  // included news will not load on this location, for more info see 'Using Multiple Includes'.
$category = "<ID>";  // show only news from the selected category where <ID> is the id of category.
$start_from = "<NUMBER>";  // show the news starting not from the first newest but from <NUMBER>, it is required to use $start_from = "<NUMBER>"; only when you use $number = "X";.

include("path/to/show_news.php");
?>

All of the above variables are optional and you may wish don't to use them. See more at usage.html.

 

Including The News

After CuteNews is successfully installed you can start posting your news. To display the news you must include the file show_news.php (located in the main cutenews folder). To include show_news.php on your page you must use a code like this:

<?PHP
include("path/to/show_news.php");
?>

And you must replace path/to/show_news.php with the real path to show_news.php, NOT the URL !!!
Examples:
CORRECT: include("cutenews/show_news.php");
WRONG   : include("http://site.com/cutenews/show_news.php");

Remember that to be able to use the php code, the extension of the file where you include it must be .php
If you want to include the code in .html page, you can rename he .html to .php and everything will work normal

 

Using multiple includes on one page

Now will examine the situation when you want to use more than one include on a single page. For example if you want to show 5 headlines (using template headlines) and below them to be shown all other news. The problem in this situatuion situation is that when you click on a headline CuteNews won't understand where to show the result, on the headlines part or where all other news are included. The solution is to use the variable $static = TRUE; before including the headlines. When you use this variable CuteNews won't display any result on the place where you use $static.
Here is the correct code of the above example with the headlines and news:

<?PHP
Our Latest 5 Headlines:
$static = TRUE;
$number = "5";
$template = "Headlines";
include("path/to/show_news.php");

The News
include("path/to/show_news.php");
?>

Now When you click on a headline it will be displayed on the place of the other news and the list with the latest 5 headlines will still be showed.

Make some test with $static = TRUE; yourself to understand how it works exactly and how powerful it can be.

 

Options when adding news

When adding/editing news, you have several options that you can choose to apply to the specified article.

  • Use HTML in this article - if checked, CuteNews will parse this article as HTML elements + text, if unchecked - your article will be treated as pure text.
  • Normal adding of Article - if you are adding your article as normal it will be immediately desplayed
  • Draft adding of Article - this option will add the article but it will not be visible for your visitors until you activate (approve) it later.
 

Explaining archives and their Usage

When you send your news to the archive, CuteNews will automatically create a new archive file. Then all news that you selected for archiving will be moved from news (where only the active news are held) to the newly created file in archives.

When you send all your active news to the archive there won't be left active news, but if you use
$number = X; in your include code, CuteNews will automatically show the X newest news from the archive.

Sending your news to archive is optional and you may never use it, but it is useful if you have many news articles and want to organize them. Using archive is also recommended when you have more than 3000 active news.

Powered by CuteNews

    Archive 2010 2011 2012 2013 - Go read
Views: 650 Visitors: 650