Never mind. I’d just woken up when I posted the above.
Declaring some gloabl variables is getting me a lot further. I’d just forgotten globals existed at midnight last night
Thanks again, will keep folks posted
UPDATE
Well that seemed to do the trick. I can now tap into MyBB’s functions and my own custom functions so the following info can be used in MODx snippets for MyBB:
* Last X forum topics (useful for grabing news - parses smilies and images etc)
* Your member data - unread posts and topics, unread PM’s, your name etc
* Last X posts (in the form of topic title, date and a link)
* Next X events (grabbed from the calendar - the next X upcoming events)
I’ve still got a lot of work to do with regards to templating, but I’m confident that once I get this one out the door, MyTopix won’t be far behind and then I can tackle the tricky one - IPB 2.x. I think that’s my lot after that - I don’t like phpBB or vB enough to even go there I’m afraid
The down-side to this is that I have no idea how many extra queries are being run. However, if you don’t use a function, that’s a few less queries
The up-side is that because I’m only initialising the forum’s core and using it’s functions for tha majority of the above, unless they do a major rewrite I won’t need to update my code for each minor patch they release.
I also intend to try something quite creative with the news grabbing - getting the news content and dumping the output as regular HTML straight into a MODx page, then when someone views the page, checking the page creation date against the database for new news before doing it again. This way the news page can be cached and save on a pretty complex query, though it does admittedly have to do a quick simple one to check for new news. In the long run it could save a lot of wear and tear on the server.
At least this way visitors will be viewing a cached news page the majority of the time... if I get it to work alright
Another Update
You’ll also be able to call on the snippet multiple times on the same page/in the same template without initialising the MyBB code more than once. Since my website mentioned earlier calls on this set of functions four times on the homepage alone, this is quite a good thing.
Can anyone tell I’m getting excited now?