Advanced Include Codes
If the readme.html file didn't make much sense, read on for more explanations.
Remember that we'll create a PHP code that will only work on web pages with the extension .php and not .htm/.html
Not just showing all news
When showing news/archives you can use $number = x; to limit the showed news on one page (x must be replaced by a number). If you have more than the x number of news, a pagination (<<previous next>>) will appear under your news.
If you want to show news/archives from a certain category you can use $category = "ID"; where ID is the ID (i.e. number) of the category. You can choose more than one category like this:
$category = "ID1,ID2,ID3";
Categories are created and managed in your CuteNews Panel under Options > Edit Categories.
When you want to display the full story of an article and the headlines on one page for example, wanting that when a headline is clicked, the full story of the article is NOT displayed where the headlines are (but at an other place), use $static = TRUE; on your headlines.
These are the most commonly used variables. An extensive list of all variables can be found here.
In this topic you'll see an example of how to use the code that you'll make here.
Now we’ll see some examples of include codes (which will show the news on your site).
If you are unsure of where to put this on your page, read this.
Note that you’ll see ‘path/to’ in all examples. This needs to be changed with the real path!
If you use the news integration wizard to make your include code, you’ll notice that the path will be longer than in the manual method (using relative paths). Don’t worry about that, both are correct, but we don’t expect you to know this long path by heart.
Show all the news
This will show all active (not-archived) news on your page.
Showing with a different template
$template = "YOUR_TEMPLATE_NAME";
A template will change the default look of your articles on your website. You can make your own template so the news can blend in with the rest of your layout. With the installation you already have the templates: default, headlines, and RSS. You can create and manage templates at Options > Templates in your CuteNews administration panel.
To prevent your site lagging, you can make archives of older articles. This way you can keep the news database small and have a fast loading news page.
Showing the latest 5 articles
$number = 5;
As said before, this will show a maximum of 5 articles on your news page. If there are more articles than the chosen number, a pagination will appear on the bottom of the page.
Showing the latest 5 articles from category 2
$number = 5;
$category = 2;
You can also have categories. This could be used to show news of various topics on different pages. E.g. page 1 shows the category ‘movies’ and page 2 shows category ‘music’. You can add 2 categories to 1 include code, like so:
$category = '1,2';
Show all headlines and the latest article on one page
$static = TRUE;
$template = "Headlines";
$number = 1;
This will show all the article headlines. A headline is basically the same as an articles title. When clicking on a headline, you’ll see the full story, same goes for the latest article that is shown in full. That article will be shown with its short story and a ‘read more’ link to the full story. $static=TRUE; is used so when you click on a headline or ‘read more’, the full story will show for the second include and not the first.