HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


ocPortal Tutorial: Advanced news

Written by Chris Graham, ocProducts
This tutorial describes some of the more complex features available for news, including blogging and syndication.



Personal Categories / Blogs

Thumbnail: A blog being started by adding news to a category that will automatically be created

A blog being started by adding news to a category that will automatically be created

Thumbnail: The blog in action

The blog in action

ocPortal has advanced support for blogging: members in permitted usergroups may have their own personal news categories, otherwise known as 'blogs' (short for 'web logs').

Thumbnail: The blog is linked to in the member profile

The blog is linked to in the member profile

To create a 'blog', a member only needs to choose to add news, and select their own personal category; if the category does not yet exist, it will be displayed as 'new', and created automatically upon submission. The news will display on the front page of the website (by default), and the blog for the member may be viewed from the links given in their member profile.

There is a blogs CMS interface separate to the news CMS interface. This is provided for two reasons:
  1. as a niceity so that you don't need to explain 'blogs are news' to your users
  2. so you can lock down access, so that members may submit to blogs but not website news
The presence of the blogs CMS interface does not stop you using the regular news CMS interface to submit blog posts.

Advanced filtering

The news system supports some advanced filtering:
  • Whether to show just non-blog posts, blog posts, or both
  • Whether to limit results to within certain news categories
  • As above, but double filtered so that news is only returned if it matches a second category filter also (this allows you to have a two-level news categorisation system, useful for large news sites)

The news blocks take parameters representing these filters, and then the links they spawn relay those, throughout the various navigation links.
Also, when you view a news post you can see what categories it is in and choose a new filter to limit results just to ones within that category.

Feeds

Thumbnail: Syndication links are displayed in the news block

Syndication links are displayed in the news block

ocPortal supports the two main formats for syndication of news (and most other kinds of content) in clean XML format: 'Atom' and 'RSS'. These formats are simple representations of news that may be viewed using an external program such as 'FeedReader', or incorporated onto another website. ocPortal itself provides two blocks that allow display of RSS and atom feeds in a news-like fashion (including feeds from other ocPortal sites, or any other site that provides them).

Thumbnail: RSS/Atom are really XML formats, and look a bit like this

RSS/Atom are really XML formats, and look a bit like this

Links to view the feeds are made available from the news blocks, as well as from the web browsers auto-discovery mechanism. If the news block is filtered (for a blog, for example) the link will open up the feed with the same filter. The URLs are not intended to be viewed directly, although we have used a technology called 'XSLT' to allow them to be displayed in the browser if desired; instead, they should be copied and pasted to another program.

The Comcode syntax you should use to place the main block in a page is as follows:

Code

[block="http://example.com/feed.xml"]main_rss[/block]

You may also use the compressed version intended for the sides of pages:

Code

[block="http://example.com/feed.xml"]side_rss[/block]

Thumbnail: FeedReader is a good free program for viewing feeds

FeedReader is a good free program for viewing feeds

Please note that you should trust a feed before you consider placing it on your site, as it is possible for them to contain Javascript that could intercept your password cookies, and perform other malicious actions.

Before RSS and Atom became popular, there was a type of feed called a 'Javascript feed', and also feeds that work via 'iframes'. ocPortal supports use of these feeds simply by putting the HTML that the feed maintainers ask you to use in your website, inside a Comcode HTML tag. The nature of these feeds are such that they embed portions of HTML into your own site, either via Javascript adding it directly on the client-side (users computers), or via a frame: they provide a simple bridge, rather than a clean feed.

To see all the feeds available in ocPortal (news is just the most typical usage for them), you may go to http://yourbaseurl/backend.php: you will be presented with a screen that lists the feeds. The screen here is written in yet another language named OPML, and again made viewable in a web browser using XSLT.

Yahoo Pipes

If you want to merge or filter feeds, Yahoo Pipes is an absolutely fantastic tool. You basically tell it to look at a set of RSS feeds, give it some filters, and you get an RSS feed you can then plug into ocPortal.

Trackbacks

Thumbnail: Special invisible mark-up code in the ocPortal HTML allows systems to see how they can place trackbacks to ocPortal

Special invisible mark-up code in the ocPortal HTML allows systems to see how they can place trackbacks to ocPortal

Thumbnail: Trackbacks as displayed

Trackbacks as displayed

Trackbacks are an advanced standard-based blogging feature, that allow a link to be established from an article on one blog to an article on another. It basically is a citation mechanism.

Trackbacks work as follows:
  1. The original article has a 'trackback' link written into the HTML
  2. When a blogger decides to write an article based upon the original article, they inform their software of the source article they are citing
  3. The software loads up the trackback link so as to inform the original article of the new one.
  4. The original article then can display a list of articles that lead on from it, along with other features such as comments.

ocPortal can send trackbacks for news and receive them for almost any kind of content.

Avatars in news posts

By default news posts show the news category image rather than the poster's avatar.

If you uninstall the 'authors' addon it will automatically change to showing avatars. The reason being that default ocPortal acts more like a news site than a community site – but by removing 'authors' you tell it you're not interested in that focus.

Instead of removing the 'authors' addon you could change the NEWS_BOX template – this template encodes the logic described above, so by changing the template you can achieve either behaviour, or any combination.

Integrating third-party widgets

There are a lot of 'widgets' out there for blogging platforms and there's nothing stopping you using them with ocPortal too. For example, this widget allows you to see what people are saying about your article on Twitter. You could easily put the HTML provided into your NEWS_ENTRY_SCREEN template.

Make news archive screens show summaries

The default news archive screen shows just the news headlines. By adding :inline=1 to the page-link you can make it show like the news block does.

Concepts

Blog
A contraction of web-log: the popular term for an on-line journal
Blogger
Someone who runs a blog
RSS
Really simple syndication: a family of news feed formats
Atom
A news feed format made official by a standards body
Trackback
A trackback is placed at the content home-site when a blogger references a piece of content- in essence, allowing the source material to automatically link to those that reference/quote/comment-upon it

See also