Custom / Special Modifcations
The general code we offer will not meet every need and we have provided suggestions to some requests for features that we have not incorporated into the general version of the script.
- Adding UTF-8 Support
- Limiting Feeds to a Domain
- Hyperlinks in Descriptions
- Remove Links to Items
Adding UTF-8 Support
I saw UTF-8 support at your build page and I need help about instaling it at my instalation of Feed2JS on my server. I need it because of language of feeds I intend to use.
As of March 28, 2005, this is now built into our distributions of Feed2JS.
Limiting Feeds to a Domain
I have installed Feed2JS on my own server, but I do not want others to use it to syndicate feeds form other sites. How can I restrict it to publish feeds from just my site?
As of version 2.21, this is built in feature (thanks for contributer tero p). Look in the
feed2js_config.php script for this section, which as the default, does not restrict any URLs
// Restrict RSS url to domain // Example: www.example.org => allows www.example.org and mywww.example.org // Example: .example.org => allows www.example.org and other.example.org // remove the comment here to activate url restriction //$restrict_url = ".example.org"; // comment out this line to activate url restriction unset($restrict_url);
Modify it to use the domain you want to limit it:
// Restrict RSS url to domain // Example: www.example.org => allows www.example.org and mywww.example.org // Example: .example.org => allows www.example.org and other.example.org // remove the comment here to activate url restriction $restrict_url = ".example.org"; // comment out this line to activate url restriction //unset($restrict_url);
For an alternative, and perhaps simpler approach, see D'Arcy Norman's method of restricting use of Feed2JS via checking the referring URL in an htaccess file.
As of April 6, 2006 this is built in to the current Feed2JS build a feed form.
Hyperlinks in Descriptions
Note: As of Dec 2004, this is now a feature of Feed2JS, the ability to set
html=a to force display of all HTML in feed items. The notes below are for older versions of our script.
You can do this by changing the line that reads:
$my_blurb = strip_tags ($item['summary']);
$my_blurb = $item['summary'];
which takes away the feature of stripping out html from the description. The problem with doing this on a wider scale is that there are all kinds of HTML thrown into feeds, and when I made the change with a sample provided, it ended up with an unclosed <i> tag that messed everything else up. But if you have a controlled set of feed outputs, you might be able to safely do this locally.
This can be done but the risk is for feeds that do not close tags (often feeds are truncated by the publishing software, so your mileage may vary.
Remove Links to Items
Change the line that reads:
$str.= "document.write('<li class=\"rss-item\"> <a class=\"rss-item\" href=\"" . trim($my_url) . "\" title=\"$title_str\"". $target_window . '>' . $my_title . "</a><br />');\n";
$str.= "document.write('<li class=\"rss-item\">" . $my_title);\n";
which removes the link tags.