Services Products Purchase Free Trial Partner Support About LoopIP Contact Us Home

Tutorial 1 > Next tutorial

NRS Tutorial: Integrating NRS into an existing site

There are 2 main approaches to integrating NRS into an existing site:

  • 1. XML Feeds: Use NRS purely as an XML datastream provider. The XML datastreams are accessed over HTTP and can be used with any XML parsing tool.
  • 2. Side by side: Both your site and NRS will act as webservers serving content. Your site will link to NRS and NRS will link back to your site. On the NRS side you will need to customize the HTML rendered by providing new XSL files. This is the recommended way as it requires a lot less effort and lets you use all NRS features easily.
1. XML Feeds

NRS generates XML feeds in UTF-8 character set. You can download the following example for Windows IIS 5.0 servers with the Microsoft XML Parser installed:

http://www.loopip.com/files/directory-example.asp.txt.

It shows a basic implementation of rendering ODP category pages from XML. It uses VBScript on an ASP page. This implementation has problems displaying international characters, we don't recommend this solution except for very basic implementations of category browsing and searching.

For more information about the usage of the XML streams you can refer to the XSL files inside NRS. For example to access the XSL file for templates of type 'directory'. Looking inside the file you'll find blocks named 'drawcategories' and 'drawcatsites' that show how the XML is rendered using XSLT language.

Any page in NRS can be accessed as XML by appending '.xml' to the URL.

You can use NRS to retrieve XML feeds for ODP categories and searches, for searching multiple search engines at once, for retrieving multiple news sources at once, or for aggregating XML/RSS feeds.

2. Side by side

Running NRS on a given domain name and port

To use NRS side by side you first need to make NRS run on the right domain name and port. For example if your main site is hosted under http://www.mysite.com, you could have NRS running under http://nrs.mysite.com. To do this you can start NRS with the command-line option: -address "nrs.mysite.com:80"

or in the NRS admin interface you can modify the address parameter found under the webserver tab and then restart the server by clicking the 'restart server' button on the administration tab.

If you have trouble getting NRS to run on port 80, you can refer to the FAQ.

Changing the HTML

NRS renders HTML using XSL files. In all XSL files controlling the rendering to HTML of NRS templates, you have a block of code called drawlogo. This function renders the logo at the top of the page. You could replace this with a new function that contains navigation back to your main site.

Original drawlogo code:


<xsl:template name="drawlogo">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#7C8C93"><img alt="" src="/dot.gif" width="1" height="116"/></td>
<td><img alt="logo" src="/logo.gif" width="128" height="116"/></td>
</tr>
</table>
</xsl:template>

Create a new file and place a new drawlogo function in it:

<xsl:template name="drawlogo">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#7C8C93"><img alt="" src="/dot.gif" width="1" height="116"/></td>
<td><img alt="logo" src="http://www.mysite.com/mylogo.gif"/></td>
</tr>
</table>
</xsl:template>

NRS offers two ways to specify new XSL files. A file such as the one you just made contains one or more functions only and will then just override the original XSL file with the new functions. If the XSL file contained a full XSL declaration with:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no" encoding="UTF-8"/>
<xsl:param name="outputmode">all</xsl:param>
...
</xsl:stylesheet>

then the XSL file would replace the original.
To apply the new XSL file you will either want to change the XSL of the default templates so that the changes apply to all templates or you can apply the XSL file to just the templates you want to change. To change the default templates, upload your XSL file on each template under Templates|Default template settings. To apply your XSL file to individual templates, edit the templates in question and upload the XSL file using the 'Load new template from file' option. Alternatively the XSL file can be applied to multiple templates at the same time using the group set option found under Templates|Default template settings.

Proxying NRS with Apache

Apache server has a module that enables proxying other sites and including them in the same URL namespace. Also Apache lets you setup virtual hosts using 1 IP only, so if you only have 1 IP and you want NRS and Apache to run side by side you can proxy NRS through Apache as a virtual host.

Here is an example using Apache 2.0 with mod_proxy and proxy_http compiled in. The following is placed in the httpd.conf file:


NameVirtualHost *

<VirtualHost * >
ServerName nrs.mysite.com
ProxyPreserveHost on
ProxyPass / http://nrs.mysite.com/
ProxyPassReverse / http://nrs.mysite.com/
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
</VirtualHost>

If you only have 1 IP you could make nrs.mysite.com resolve to a private IP.

Back to support



 
LoopIP search
Web search
Net Research Server
Net Research Server - demonstration website
visit Net Research Server - demonstration website
Demo Links
Web Search
Shopping Engine
Local Search
Directory
Metasearch
Enterprise
Wiki
Integration

Copyright © 2008 LoopIP LLC. All rights reserved | Terms | Privacy