MyBB Community Forums

Full Version: Linear threaded view?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I am new to myBB and so I need some help getting pointed in the right direction in my customization needs.

I need to create a view of a thread and subsequent replies ordered by reply, (i.e. threaded order) rather than date. This is a linear view a thread, but where the order of replies in the thread list follows the threaded hierarchy. If you look at threaded view mode, the little threaded list is the order I need, but I need to see the full posts.

Structured discussions are extremely important in the areas of online education I am currently studying: higher order thinking skills. I need to create this view for a project in my studies, possibly leading to my dissertation.

(It would be very unfortunate for myBB developers to remove threaded mode for it value in education alone, even though the current threaded mode is not useful. A fully functioning theaded mode is necessary, and that is essentially what I will need to create.)

I've been hacking my way through what little documentation about how to modify myBB there is, and the code in the showthread.php file, but the logic of showthread.php and themes/templates is obfuscated. The documentation is not complete enough to be helpful at my level.

So where should I begin?
Do I create a template to do this? (what's the difference between a theme and a template? It looks like themes are just collections of templates...?)

In showthread.php I can see where the threaded tree is built for threaded view, and if I could get $post['message'] to show up in the showthread_threaded_bit template I would be 90% of the way to fulling my need, but that array element does not seem exist that template (looks like at the point that template is called $post is a local array that does not contain that key.)

Another option would be to take the code in showthread.php where the linear view is created, and apply the same logic that constructs the threaded tree list to create the linear view in threaded reply order. However, deciphering the linear view code is a hack and slash I'd like to short cut:

What is going on in the linear view code in showthread.php? It looks like it calls a function to populate the template... Does it read all of the threads in and then call the function?

Where is the actually thread message in the database, and where in the code is that loaded?

Does anyone have any advice, or a clue as to what the best way to go about this is? And answers to any of the above questions?

Thanks for any answer and help in advance,
Gordon
(2010-09-02, 05:33 AM)Gordon Wrote: [ -> ]In showthread.php I can see where the threaded tree is built for threaded view, and if I could get $post['message'] to show up in the showthread_threaded_bit template I would be 90% of the way to fulling my need, but that array element does not seem exist that template (looks like at the point that template is called $post is a local array that does not contain that key.)

OK I answered this part of my issue myself: the message field of the post table wasn't being loaded from the db. I fixed that and now it is, and I can use the logic of the threaded tree to show the post message for each in the order I want.

So back to my other questions, to how create new parts of a template and work them into the code?

in function buildtree you can found a line
eval("\$posts .= \"".$templates->get("showthread_threaded_bit")."\";");

that's actually answer to your question. eval() evaluates string as php-program.

"showthread_threaded_bit" is a template name, content you can found in Admin CP / Templates & Style / Templates, where you can also add your own template with your own name or modify existing.

When you take a close look into template, you will found that template is nothing more that a php string with variables embedded. eval() substitute these variables by their values.



Hey asmile, thank you so much. Actually, I'm getting a lot of this figured out, and what you wrote jibes with what I understand now. I have a lot of the strategy of my project whipped and have a working prototype and am chopping down moutains as I write this.

In my prototype I have had to edit showthread.php in order to get the linear view in thread reply order, and I don't see away around that - I'd rather that be a plugin, but I don't see how that can be done: the logic of getting each post and parsing the reply order is in showthread.php and not anywhere near any of the plugin hooks.

So, am I screwed then as far as being compatible with everyone else? (yes) I mean it doesn't matter to me as far as my studies go - this will run on a server integrated with out LMS, but it would be nice to share and not break under future releases of myBB...