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.Table of contents
Personal Categories / Blogs
|
A blog being started by adding news to a category that will automatically be created |
|
The blog in action |
|
The blog is linked to in the member profile |
Since version 4.2 there is a blogs CMS interface separate to the news CMS interface. This is provided for two reasons:
- as a niceity so that you don't need to explain 'blogs are news' to your users
- so you can lock down access, so that members may submit to blogs but not website news
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
|
Syndication links are displayed in the news block |
|
RSS/Atom are really XML formats, and look a bit like this |
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]
|
FeedReader is a good free program for viewing feeds |
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
|
Special invisible mark-up code in the ocPortal HTML allows systems to see how they can place trackbacks to ocPortal |
|
Trackbacks as displayed |
Trackbacks work as follows:
- The original article has a 'trackback' link written into the HTML
- When a blogger decides to write an article based upon the original article, they inform their software of the source article they are citing
- The software loads up the trackback link so as to inform the original article of the new one.
- 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_PIECE_SUMMARY template – this template encodes the logic described above, so by changing the template you can achieve either behaviour, or any combination.
Twitter and Facebook integration
You can configure ocPortal to syndicate your news to Twitter and Facebook accounts in the configuration.When you post news (or calendar events) a link to them will be syndicated to these services.
However, if you want to do it the fancy way then you need to:
- Create an app on Facebook. Make sure the app is configured for the real URL and domain name of your site
- Fill in all the details in your configuration
- When you first post, you will be directed to authorise your Facebook application to post to your wall. Make sure you are logged into the Facebook with the user you have configured as the target for the Facebook postings
- ocPortal will confirm the authorisation
- Your first post will appear on your Facebook wall, as will subsequent ones
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_FULL_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



