My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Integration  
How to integrate N-13 News into your design
Updated Feb 27, 2012 by chris@network-13.com

Introduction

To integrate the system into your own design requires only a few lines of code. Below are some examples and the variables you can specify to change how your news gets displayed.

Examples

The most basic type of include is just the include code without specifying any variables

<?php
include 'news/index.php';
?>

This will display the news and use whichever template is selected as default in Options > Templates. Because no variables have been specified the amount of news articles and the order they are shown is determined by the system options. Options > System.

Below is a list of all the variables that can be specified before the include code.

<?php
$newstimeformat = '%m.%y';
include 'news/index.php';
?>

Format how the date is displayed on news articles. See here http://uk.php.net/strtotime

<?php
$commentstimeformat = '%m.%y';
include 'news/index.php';
?>

Formats how the datae is displayed when viewing the full article/read more page. See here http://uk.php.net/strtotime

<?php
$news_layout = '0';
// How the articles are shown when not viewing a single post
// 0 = default, shows article, if post has a summary shows it instead
// 1 = Show summary only
// 2 = Show article only
// 3 = Show summary and article

$comments_layout = '0';
// How the articles are shown when viewing a single post
// 0 = Show both article and summary
// 1 = Show summary only
// 2 = Show article only

include 'news/index.php';
?>

Format how your news articles get displayed using the above variables.

<?php
$imgresize = true;
include 'news/index.php';
?>

Can be used to automatically create thumbnails for images that have been resized using the WYSIWYG editor.

<?php
$stripimg = true;
include 'news/index.php';
?>

Can be used to remove all images from the Article/Summary. Note that smilies will also be removed.

<?php
$nppage = '10'; 
include 'news/index.php';
?>

Number of news articles to show per page

<?php
$cppage = '10'; 
include 'news/index.php';
?>

Number of comments to show per page when viewing the full news article

<?php
$orderby = 'timestamp'; 
include 'news/index.php';
?>

The order your news will be displayed, default is timestamp, possible options are rating, views, title & comments

<?php
$newsorder = 'DESC'; 
include 'news/index.php';
?>

Possible options DESC & ASC

<?php
$archives = '1'; 
include 'news/index.php';
?>

Default is 0, if set to 1 then only news articles which have been archived will be shown

<?php
$template = 'Template name'; 
include 'news/index.php';
?>

Name of the template that should be used. If not specified whichever template is selected as default in Options > Templates will be used. See Templates

<?php
$cat[] = 'Cat1';
$cat[] = 'Cat2';
include 'news/index.php';
?>

If specified only news that has been assigned to these categories will be shown. You can specify as many categories if you like. If no categories have been specified then all news articles will be shown

<?php
$author[] = 'Chris';
$author[] = 'Test';
include 'news/index.php';
?>

Same as specifying categories except you can show only news articles which were posted by certain authors. If no authors are specified all are shown

<?php
$static = 'true';
include 'news/index.php';
?>

Defaults to false, explained further down the page on the Multiple Includes section

<?php
$linkprefix = 'variable=value&';
?>

This will be added to the beginning of all hyperlinks to help users who are incorporating the script into another system

<?php
//no longer works as of version 3.6 and below
$image_maxheight = 300;
$image_maxwidth = 500;
include 'news/index.php';
?>

If specified any images within the post will automatically be resized to the above dimensions.

<?php
//no longer works as of version 3.6 and below
$image_clickable = true;
include 'news/index.php';
?>

If specified any images that are resized will be made into hyperlinks which once clicked will open the full size image in a new window. Used with $image_maxheight & $image_maxwidth.

<?php
$search = true;
include 'news/index.php';
?>

If specified the search form will show instead of the news articles.

<?php
$register = true;
include 'news/index.php';
?>

If specified the new user registration form will show instead of the news articles.

<?php
$invalid = '404.html';
include 'news/index.php';
?>

If the user tries to view a news article that doesn't exist you can show them a 404 in its place by specifing the filename here.

All of the above variables are optional. You can use as many of the variables per include as you like. All variables must go before the include code.

TPL files

To include the script in a .tpl file use the following code

{include_php file='news/index.php'}

You can also use an html iframe include your news but this isn't recommended as you can't specify any variables using an iframe.

<iframe src="http://example.com/news/index.php" style="height: 100%; width: 100%; border: 0px"></iframe>
Comment by Chilter...@gmail.com, Jun 18, 2010

is there a variable to allow just the titles to be displayed? or jus t the short story? (with links to the full story) would like to have a seprate scrolling headline box on aonther page

Comment by Chilter...@gmail.com, Jun 18, 2010

actually - I think I can use a custom template to do this. wonder is there's a variable to limit the length of the short story displayed?

Comment by Chilter...@gmail.com, Jun 18, 2010

oh actually the link generated uses the same page the link is on so I have a php page chosing a custom title page only with links but the links then use the same page to generate the news page display with the cusomte template is there are way of have the link use anothe page?

Comment by urom.sam...@gmail.com, Apr 12, 2011

Good Work Pal....


Sign in to add a comment
Powered by Google Project Hosting