Firefox PHP

Module: Threaded Tree View

Posted by Joe Curia 
Re: Module: Threaded Tree View
December 24, 2008 02:03AM
Quote
Diego
Only problem is when you have a superlong subject that breaks in two lines, there is a little break. I guess there is no way to avoid it, and I could live with it as it is not a big issue

FWIW, that was an issue in version 3 and the previous module. not a lot you can do about it.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Module: Threaded Tree View
December 31, 2008 03:16PM
Quote
Diego
I know, I am aware of many variables here, and this template is fixed width, so really long threads with many responses (many in my forum have +100 replies) make this even more unpredictable. But don´t worry about it, i consider it expected behaviour in the same way a two lines subject doubles the row size and nobody should complain.

I am working on a narrow template where issues like this need to be resolved. I am using the following code which is not perfect but does the job for most cases. Please note, to reduce processing load I am not looking at wide or narrow font characters, simple going with a preset string length. You could try making these changes to your template and letting me know if it helps. If so, I will add them to the template here.

Immediately before the subject span add these lines:
{VAR TMP->subject MESSAGES->subject}
{VAR TMP->indent_cnt MESSAGES->indent_cnt}
<?php 
    $max_length = 60 - ($PHORUM["DATA"]["TMP"]["indent_cnt"] / 4);
    if (strlen($PHORUM["DATA"]["TMP"]["subject"]) > $max_length)
        $PHORUM["DATA"]["TMP"]["subject"] = substr($PHORUM["DATA"]["TMP"]["subject"],0,($max_length-1))."...";
?>
Note, I have arbitrarily chosen a maximum string length of 60, you may want to adjust this.

Next, change the subject code to use our new subject:
<a href="{MESSAGES->URL->READ}">{MESSAGES->subject}</a>
becomes:
<a href="{MESSAGES->URL->READ}">{TMP->subject}</a>
Let me know if you have any questions or get this working and want it added to your template for this module. Thanks.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Threaded Tree View
January 09, 2009 06:37PM
Excellent module Joe, thank you! I hope you won't mind if I put this post in...

I've installed the User Avatar mod, and the Threaded Tree View doesn't support avatars (no criticism - there's no reason why it should, really!)

Anyway, taking "One message per page with threaded view" as an example, if you want to display avatars the following edit to read_threads.tpl seems to do the trick...

If you want an avatar in the one message you're reading, then after the lines:

<small>{MESSAGE->datestamp}</small>
</td>

insert:

<td style="padding-right:10px">
{IF MESSAGE->user_avatar}
<img src="{MESSAGE->user_avatar}" alt="avatar"
{IF MESSAGE->user_avatar_w}
style="width:{MESSAGE->user_avatar_w}px;
height:{MESSAGE->user_avatar_h}px"
{/IF} />
{/IF}
</td>

If you want an avatar in each of the threaded lines, then after the line:

<td width="15%" class="{altclass}" nowrap="nowrap">{MESSAGES->datestamp}</td>

insert:

<td style="padding-right:10px">
{IF MESSAGES->user_avatar}
<img src="{MESSAGES->user_avatar}" alt="avatar"
{IF MESSAGES->user_avatar_w}
style="width:{MESSAGES->user_avatar_w}px;
height:{MESSAGES->user_avatar_h}px"
{/IF} />
{/IF}
</td>

Best regards, Kronalias

PS I tried to post the above with the correct indents, but they've got lost somewhere...



Edited 1 time(s). Last edit at 01/09/2009 06:38PM by Kronalias.
Re: Module: Threaded Tree View
January 09, 2009 06:40PM
Thanks for posting this solution, Kronalias. I'm sure it will come in handy for many people.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Module: Threaded Tree View
January 14, 2009 09:46AM
Kronalias, what do you mean "threaded view doesn't support avatars"?
This has nothing to do with avatars, it depends on your template/design so you can show avatars or not, am I wrong?
Re: Module: Threaded Tree View
January 14, 2009 09:50AM
Quote
Joe Curia
I am working on a narrow template where issues like this need to be resolved.

Thanks for your last mod Joe
I will give it a try now, I am sure it works fine but I think the problem is not subjet's lenght but the multiple nested replies (at least on my forum), so if you have let's say 25 nested replies even the shortest subject will screw the template.

But again, I don't think this is really a problem
Users understand when you have multiple nested replies this might happen and is not a big issue for them

By the way my users love this mod, extremely useful when you have +500 replies per thread! :)
Re: Module: Threaded Tree View
January 26, 2009 06:14PM
Sorry Diego, you're absolutely right, and my apologies for not replying earlier.

I think I was suffering from over-excitement at getting this working as a Phorum newbie! Anyway, thanks for being so polite in pointing me gently in the right direction :)
Re: Module: Threaded Tree View
April 09, 2011 04:22AM
I have a bug report. I was discussing this with Maurice (phorum.org) and he suggested I file a bug report here.

My initial post:
I'm using emerald template and the tree-view module. When a closed topic is view, there is no reply box, or a box saying replies aren't allowed, etc. The following is the error report.

Phorum Template Error
phorum_get_template() was called with an empty page name.
This might indicate a template problem.
Here's a backtrace that might help finding the error:
#0 phorum_get_template() called at [/usr/local/apache2/vhosts/mysite.com/htdocs/boards/common.php:1599]
#1 phorum_output(Array ([0] => treeview::read_threads,[1] => )) called at [/usr/local/apache2/vhosts/mysite.com/htdocs/boards/mods/treeview/treeview.php:192]
#2 mod_treeview_end_output()
#3 call_user_func(mod_treeview_end_output) called at [/usr/local/apache2/vhosts/mysite.com/htdocs/boards/common.php:1887]
#4 phorum_hook(end_output) called at [/usr/local/apache2/vhosts/mysite.com/htdocs/boards/common.php:1706]
#5 phorum_output(Array ([0] => read_threads,[1] => message)) called at [/usr/local/apache2/vhosts/mysite.com/htdocs/boards/read.php:861]

I also get an error message if I leave a moved message when a post is moved. I imagine it's from the same error, but it moves to the topic too soon for me to copy the error message.


Maurice's suggestion:
I suspect the mods/treeview/treeview.php file, which contains this line:
Language: PHP$templates[] = $PHORUM["posting_template"];

The $PHORUM["posting_template"] variable is not always set. Try changing that line to:
Language: PHP$templates[] = 'posting';


My reply:
I've made the change and it kindof works.

It has a box that says the topic is closed. But then under that it has the start of a reply box. It has Author: then a box to fill in the subect.

then: "mod_tos_tpl_editor_before_textarea(): Can't determine whether we're editing a new message."
Sorry, only registered users may post in this forum.

Click here to login