1 (edited by 2009-09-21 18:36:44)

Topic: [FAQ][INSTALL] How do I show the news on my site?

Showing the News on Your Website
With your CuteNews .zip file came 2 files example.php and example2.php.
Try adding a test news with CuteNews and see if it appears on those pages. If it doesn’t, there must be something wrong with your installation.
If you can’t find the problem, ask for help on this forum.

In this post we'll discuss the easy way.
In the next post we'll discuss how to do it manually and possibly using more options.

The Easy Way
This is not possible in all CuteNews versions!
Log in to CuteNews and go to Options > Integration Wizards and follow the instructions.
Remember that this wizard creates a PHP code that will only work on web pages with the extension .php and not  .htm/.html!
In this topic you'll see an example of how to use the code.

2 (edited by 2009-09-21 18:48:09)

Re: [FAQ][INSTALL] How do I show the news on my site?

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.

Some examples
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!
WRONG: include("www.site.com/cutenews/show_news.php);
CORRECT: include("cutenews/show_news.php);
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

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

This will show all active (not-archived) news on your page.

Showing with a different template

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

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.

Showing archives

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

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

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

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

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

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

<?PHP
$static = TRUE;
$template = "Headlines";
include("path/to/show_news.php");
$number = 1;
include("path/to/show_news.php");
?>

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.

3 (edited by Aqibjawed 2023-09-22 11:18:07)

Re: [FAQ][INSTALL] How do I show the news on my site?

I&#039;m currently working on my website and would like to display news articles on it. I'm wondering if anyone can guide me on how to achieve this. Are there any specific tools, plugins, or coding techniques that can help me showcase the latest news updates on my site? I would appreciate any suggestions or recommendations you might have based on your own experiences or expertise.

Thank you for your assistance!

Re: [FAQ][INSTALL] How do I show the news on my site?

Currently, I am developing my website and would like to include news articles. Any suggestions as to how I can accomplish this would be greatly appreciated. Could you please share with me which tools, plugins, or coding techniques I could use to provide my users with the latest news updates? If you have any suggestions or recommendations based on your own experience or expertise, I would appreciate them.

Your assistance is greatly appreciated!