Topic: Changeset 969 - topics => first_post_id

I was just wondering if somebody could talk a bit about Changeset 969:

http://dev.punbb.org/changeset/969

Added a new column to the topics table, first_post_id. As the name suggests, topics now store the ID of their first post. News scripts and such should benefit greatly from this change.

What are "news scripts" and why would they benefit from this?

I'm not opposed to the change or anything - just curious smile

Thanks!

Re: Changeset 969 - topics => first_post_id

News scripts are scripts like those on the front page of punbb.org. With this change, you'd be able to make a 'simple' join, like so:

SELECT p.message, t.subject FROM topics AS t INNER JOIN posts AS p ON t.first_post_id = p.id

This would fetch the first post in a topic and the subject of the topic.

Re: Changeset 969 - topics => first_post_id

Exactly.
Lots of syndication scripts want to grab the first post of the topic (for posting on the front page, etc) but before, there was no easy/efficent way to do that simply given the topic. Now, since the first post ID is stored on the topics table, you can easily access the first post of the topic (as Bekko demonstrated).

Re: Changeset 969 - topics => first_post_id

That's along the lines that I was thinking. I just figured it was worth asking. Thanks!

Re: Changeset 969 - topics => first_post_id

Is there an "easy" way to know what database changes have been made for PunBB 1.3? Perhaps there's a wiki page somewhere, or maybe one of the developers knows offhand...? I can look through the databases myself, no problem, but I thought I'd try and save myself the hassle smile Thanks!

Re: Changeset 969 - topics => first_post_id

Look through db_update.php, it'll perform all the updates to a 1.2 database, so it can pretty much tell you the changes wink

7 (edited by trevor 2007-06-27 19:03)

Re: Changeset 969 - topics => first_post_id

Thanks, elbekko.

I'm not trying to ask this question as a "when is PunBB 1.3 coming out" sort of thing, because I know the answer to that smile

However, I was wondering if there are any more likely candidates for PunBB 1.3 database changes. I completely understand if there's no good answer for this, but I figure it's worth asking if you developers are considering anything else at this point in time.

The reason I'm asking is because I'm working on an open-source Rails forum, and I'll be importing from an existing PunBB database. I was thinking of running the 1.3 database converter on my 1.2.15 database to bring it up to 1.3 (roughly, at this point, I know) before importing into my app, and I'm trying to figure out if that's a silly idea. If the database conversion stuff is _mostly_ done, though, perhaps it would make sense. That way, I could be making an import feature that won't be out of date when 1.3 comes out. Plus, I would love to take advantage of the UTF8 stuff that you guys have been working on, just to pick one interesting item.

If anyone who happens to be reading this is interested in Rails and PunBB, then please have a look at my little project: http://eldorado.googlecode.com/svn/trunk/ - This project was born out of my desire to learn Ruby/Rails, and I hope it doesn't seem like I'm trying to poo-poo PunBB. I think it's a fantastic app, and I couldn't have possibly gotten so far with my project without PunBB and the PunBB-inspired Beast forum in Rails (http://svn.techno-weenie.net/projects/beast/).

Re: Changeset 969 - topics => first_post_id

I'd say the database changes are mostly done for 1.3.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Changeset 969 - topics => first_post_id

Thanks very much for your reply, Rickard. I think I'm going to try importing into my app from a PunBB 1.3 database, even thought I know things aren't 100% finalized yet. I'll give the update script a try (http://blog.punbb.org/2007/03/13/the-new-update-script/) and post some feedback in the forums specifically about that.

10

Re: Changeset 969 - topics => first_post_id

Actually I rather like Beast. It somehow manages a really simplistic design which also looks elegant. I'm very tempted to port the look for a minimal 1.3 style.

11

Re: Changeset 969 - topics => first_post_id

I agree that the look-and-feel of Beast is quite nice. Personally, I prefer the way PunBB looks, though, which is why I've ported that look over to my Rails app. Actually it's a mix of K2 and PunBB styles, but I think it works quite nicely.

I have a testing version live here: http://newathens.org:8000/forum - I haven't tested with IE at all, though, and the way I'm doing the threads is table-based, which really really really needs some fixing.

If anybody who happens to read this happens to know their way around the PunBB-way of doing thread displays and also happens to want to help me out, I'd sure appreciate it! smile

12

Re: Changeset 969 - topics => first_post_id

Is that running on a Slice (if you are the same Trevor as posts in the Slicehost forum).

As for the thread display, wait a little while until the 1.3 thread markup has been fully tested and then I'm sure we can come up with a proper port or even a way of fixing a tabled version. I see you are suffering from the "Inconsiderate Bastard Posting Big Images" syndrome at the moment.

13

Re: Changeset 969 - topics => first_post_id

Hey Paul, yeah - I'm the same Trevor as on Slicehost, and that's running on a Slice. Sorry if you've been subjected to my whining questions on 2 forums now!

That site is running an import of a PunBB install that I'm running for my friends, which is on 1.2.15. I was thinking of trying to upgrade that PunBB install to 1.3 and then importing from that, mainly for the UTF stuff. I haven't looked at what else is different in the database just yet, but there's the first_post_id at least.

I didn't directly port the PunBB css over, I just eyeballed it and wrote new stuff. I'm a fan of really short css files, so I tried to be as sparse as possible in that sense.

Yeah, and Inconsiderate Bastard Posting Big Images, or IBPBI, has been plaguing me for years smile

I'm hoping to use that attachment_fu plugin to automatically re-size images for posting in the forum, but I also see that you guys at PunBB have figured out how to restrict image sizes with some CSS trickery, which might work just fine as well. Otherwise, I don't know what max width I would set. I've got basic css-only theme support, so people could widen out the page and then complain about having their images restricted to whatever I chose.

14

Re: Changeset 969 - topics => first_post_id

The trouble with sparse css is that there is an inverse relationship between the complexity of the markup and the complexity of the stylesheet i.e. lean and mean semantic markup usually results in complex css.

Restricting image size is really quite simple. You just use max-width which will automatically shrink the image in all browsers apart from IE6 (which requires javascript). It does however degrade the image very badly. The other alternative is to scroll posts so a wide image will just generate a horizontal scrollbar just like a code box. The final solution would be to use something like lightbox to pop up a full size image. Personally I'm beginning to favour a javascript solution as being the only truly slick way of doing it.

15

Re: Changeset 969 - topics => first_post_id

Could you use some fancy javascript to automatically set the img width & height, then? That would be ideal, I guess, because you could restrict the width in the same way that max-width does, but you could preserve the image quality if you also adjusted the height.