PDA

View Full Version : VBThreads in XML-format


Mas*Mind
10-30-2001, 10:00 PM
For those that find it usefull and like to play around with XML and that kind of cool stuff, I've made a hack that returns a threadlist in XML format, sortable by lastpost, title, postusername, views, replycount or forumid; ascending or descending and on a limit of threads to be returned.

I'll try to create an XSL stylesheet for it later on.

It's only tested in v2.0.0 since I didn't upgraded yet, but I expect it to work in all latest versions (>= 2.0.0)

If you don't know what XML is about and what you can do with this hack, don't even bother to install it or go and search on the net to find out more about this matter.

Demo (http://feyenoord.messagebase.nl/fmbxmltracker.php?orderby=views&sortorder=asc&nr=15)

there are three variables that you can pass on in the URL: nr, sortorder and orderby

nr will specify how many threads should be returned and can contain any number between 0 and the number you specify in the $maximumThreads variable (currently 15)

orderby will specify against which database-field will be ordered and can contain: lastpost, title, postusername, views, replycount or forumid. If nothing specified or a unknown columns specified 'lastpost' will be used.

sortorder will specify if either ascending or descending will be ordered and can contain 'asc' or 'desc'

if you don't specify anything nr will default to 15 (can be changed in the variable $maximumThreads), orderby will default to 'lastpost' (can be changed in the variable $defaultOrder) and sortorder will default to 'desc'

Installation instructions:


download the attached vbxmltracker.php.txt
change these variables to reflect to your needs:

$defaultOrder (the database-field against which is ordered if no orderby field is specified)
$dateFormat (the dateformat, NOT the same as in your general settings more info (http://www.php.net/manual/en/function.strftime.php))
$forumsNotToInclude (the forumid's of the forums which you don't wanna include in the threadlist)
$maximumThreads (the maximum number of threads that can be requested)
$customError (a custom error-msg, on this moment not used)
$errmsg (the xml-string to be presented when a error occurs)
$xmlFormat (the xml-string for each thread)
$orderByOptions (the database fields against which the threadlist can be ordered)
$locale (the locale setting in order to change the date-format to your country's language and format, more info (http://www.php.net/manual/en/function.strftime.php)

If you don't understand any of these variables, I suggest you to leave them as is
rename the attached text file to a name with a .php or .php3 or any other php-executable extension and upload it to your vb root-folder
Do everything I forgot to mention :D
enjoy!

MrLister
10-31-2001, 01:44 PM
seems like a good idea. i'll try it out

Neo
10-31-2001, 02:39 PM
umm are you doing to add style sheets to it, to make it more graphic based?

MrLister
10-31-2001, 02:41 PM
style sheets i believe

Neo
10-31-2001, 02:47 PM
well its a good idea, i hope he does create style sheets cuz i am to lazy to do it myself, and am trying to learn MySQL in full X_X

Mas*Mind
11-01-2001, 05:16 AM
the thing is, the purpose is NOT to make it graphic based. The purpose is to deliver a threadlist in a uniform descriptive language: xml. This way every possible application can read the data as long as it understands xml. So you can plug it in that application and display the data however you like. Or plug it in another website. If you don't understand where this is for and what you can do with it: Don't use this hack, it will be useless. But if you know what you can do with it: possibilities are endless :)

Neo
11-01-2001, 05:53 AM
holy cr*p i just got what you are saying heh, you could do alot of things with this but the question is what would i use it for.. and how would i do it.. hm.. Java.... hmmm

merk
11-02-2001, 04:07 AM
The method of modifying the XML data so that it is readable in something, like Internet Explorer, you need to use XSLT, Extensible Style Sheets (or CSS, Cascading Style Sheets).

These files, are basically what you have seen before, something that would be in vBulletin is cp.css, or <style> tags at the top of each generated page.


With CSS, is where you define what the parser should do to each of the tags, for example, you specify that each author(with <author> around it) be centred and red.


XSLT is slightly different, where you define the layout of a page, therefore you can have the system that MAS*MIND has done, where authorid is after author, and still use authorid before author.

Its a bit hard to grasp the concept of it, and best method is actually Books ;)

Skeptical2
01-29-2002, 12:11 PM
This hack is an EXCELLENT idea! Now are you able to code in xml for everything that vB does or just the thread list? I'd like to have it be able to output XML in the home page, thread reply page, pm page, etc...

I'm interested in porting vB to other apps that can read it and make use of the data.

webForum
05-20-2002, 10:45 AM
We are planning to make an tray application for our forum and I just tested this great script. $datePosted = strftime($dateFormat, $timestamp); I think it should be $datePosted = strftime($dateFormat, $timestampPosted);
Anyway, I'm new to XML and wonder if anyone have made an XLS for this yet? Just want to se how it works and maybe learn something from it :)

Scott MacVicar
05-20-2002, 02:08 PM
I use XML to syndicate my site news, you just use a php script fo fetch the xml file and you can then parse it and format it the way you like.

Sketch
01-16-2003, 06:36 PM
Whoa.....oh my goodness. Great concept. I mean XML I've thought of. But a tray icon/app I haven't. I could even get my buddy to write a C# app - distributable to all our techs - to get new thread info popups, etc.

Aaron

Jeremy W.
01-16-2003, 08:08 PM
Yeah, you could easily tie a C# app in to check the XML datasheet for updates... Might go well with an upcoming article I'm writing for Microsoft :)