Home / Blog / Using the built-in eZ Publish RSS import feature to syndicate ez.no news

Using the built-in eZ Publish RSS import feature to syndicate ez.no news

Following steps similar to those in Paul Wilson's RSS import "how to" guide, we were able to quickly set up the syndication of the ez.no company news feed. This way, ezsystems.ca visitors can get a quick summary on the front page of what's new at eZ Systems in general, such as the much anticipated eZ Publish 4.0 release, which runs on PHP 5!

You might have noticed the ez.no News section below the listing of the latest blog posts on the ezsystems.ca front page:

ez.no News section on our front page

ez.no News section on our front page

Because the process is quite well documented in Paul's guide, we will provide only a brief outline here about the steps we took to set up the RSS import.

  1. Create a folder in the node tree to contain the imported items.
    For us, this is the ez.no News folder.
  2. Create a custom class (under the Classes menu in the Setup tab of the Administration Interface. Analyze the fields in the source RSS feed that you want to import, in order to determine the appropriate attributes in the custom class.

    ez.no Company News RSS feed

    ez.no Company News RSS feed

    For us, under each "item" tag we wanted the pubDate, title, link (not visible in the screenshot) and description. Therefore, we created corresponding attributes in a custom "eZ News" class.

  3. Set up the RSS import under the RSS menu in the Setup tab of the Administration Interface, mapping the fields from the source RSS feed to the class attributes.

    RSS import settings in the Setup tab

    RSS import settings in the Setup tab

  4. Set up a cronjob, if this hasn't already been done, to run the runcronjobs.php script periodically. This script manages all of the cronjobs in eZ Publish, such as the workflow processes, notifications, and RSS importing.
  5. If needed, create a template for your custom class. Depending on what you are importing, you could base this template on an existing template, such as an article. Because ezsystems.ca is based on the Website Interface, we placed the new template in the extension/ezwebin/design/ezwebin/override/templates/full/ folder. You should also edit the override.php override for your siteaccess. In our case, we placed the following code in extension/ezwebin/settings/override.ini.append.php.

    [full_ez_news]
    Source=node/view/full.tpl
    MatchFile=full/ez_news.tpl
    Subdir=templates
    Match[class_identifier]=ez_news
  6. Because we wanted to syndicate the news on our front page, we simply edited the front page object and embedded our eZ News container folder, setting its class to itemized_sub_items and configuring it to show the latest five objects.

    Embed properties for ez.no News

    Embed properties for ez.no News

A special thanks goes to Paul for his wonderful contribution, which is one of the hundreds of eZ Community contributions!

Comments

Comments are closed