News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SMF 2.0RC1 with SQLite and board_order (sorting of the unsorted boards)

Started by stomic, February 09, 2009, 11:48:35 AM

Previous topic - Next topic

stomic

Hi!

I have upgraded from SMF 1.1.8 to 2.0RC1 with MySQL and then ported the database to SQLite. This wasn't an easy task, and I still hope it all went well.

Anyway, what I noted is that my boards are not sorted according to the order that is setup in the configuration (admin section). This sorting order is preserved in the database but wasn't respected when the board index is shown.

I found a solution, which I hope is good enough. I'm writing here to share the solution with you, in case that somebody else encounters the same problem.

So, I edited the file Sources/Subs-BoardIndex.php and on line 74-77 I replaced:

AND b.child_level >= {int:child_level}') : '
AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)),
array(


with

AND b.child_level >= {int:child_level}') : '
AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)) . ' ORDER BY b.board_order',
array(



stomic

Do you think the solution is good enough?

And I haven't tested it with other database engines...

karlbenson

That would work.

Usually smf re-orders the boards inside the db so that the order by is not required.
Your porting to sqlite (which won't do it) from mysql (which will do it)

It might be caused by your porting or it could be an sqlite bug.
I will check this out.



feline

Seems like this bug is not fixed in 2.02 ..
I don't see a ORDER BY ... in the file Sources/Subs-BoardIndex.php as described above.
So I wonder me why the issue have status resolved ...

Ensiferous

Confirmed. I just ran into this bug and had to fix it with ORDER by as well.
My Latest Blog Post: Debugging Nginx Errors

FragaCampos

Sorry to unearth this topic, but I'm doing some tests on localhost and I updated my SMF from 1.7 to 2.03 and I ran into this same problem. Although the boards are correctly set on admin panel, the index of the forum shows them differently. Is stomic's solution the correct and best one?

Advertisement: