Resource icon

XF2 GUIDE Adding forum topics into html page

I searched for the means to include snippets of forum topics into my homepage as a taster of what the visitor could find within the forums, an automatic means to have new content automatically added to a html homepage and I couldn't find any solutions that worked...

Here's mine....

Within xenForo 2. there is the means to create a RSS feed by adding /index.rss to the end of the forum link

eg https://xenforo.com/community/forums/xenforo-pre-sales-questions.5/index.rss



You should then be able to parse the RSS feed through a script to generate some javascript which could then be placed within your html file.



Rather than reinvent the wheel, such a script is available on GitHub
Link: https://github.com/cogdog/feed2js

This can be installed on your own webspace, however it will only work with PHP5.6 and lower, yet xenForo is recommended PHP7.0+ although will work on 5.6

To get around this create a new webspace using PHP5.6 and download the files into the root of this, follow the set up instructions, and secure the script so that the parsed javascript can only be used on your main domain, again as per the instructions.
You can also add password protection to the index.php and build.php files.

Once you've created your javascript you can also add css to format it using either the included options, or create your own, then it's simply a case of uploading the css to your webspace and adding the javascript and css links to your html file.

If you want to show snippets of several forums simply add further RSS feeds and include the javascript in your html file

One thing to bear in mind is that if your main site is secure (https) then you will need to ensure that the secondary webspace where the script is hosted is also secure (https) if you host the script remotely otherwise the feeds will not display in Firefox or Chrome browsers, or anywhere else that mixed content isn't allowed.

If you want to have a play with it you can see and use the script here: https://feed2js.org/
Although the outputted javascript on https://feed2js.org/ will work on your website I'd still recommend installing the software onto your own webspace.

I hope this helps a few people

A couple of screenshots (this page is still being worked on but it gives an idea of how FOUR RSS feeds look within the page)
sshot1.jpg

sshot2.jpg
Author
shimmer
Views
492
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from shimmer

Top