FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Forum Styles » New forum style and functionality (Lots of tweaks)
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: New forum style and functionality [message #161076 is a reply to message #161067] Thu, 12 November 2009 22:25 Go to previous messageGo to previous message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma:
Senior Member
Sure, but it's rather ugly hehe.

What I did was that I created a special forum called "Site Content" - I hid this forum from the users, so they can read it, but its not visible.

I then checked what ID that forum had.

Then I just added IF statements in the template system, to draw the messages in that specific forum differently from all the others.

So in drawmsg.tmpl it would look like this under the message_entry field:

{SECTION: message_entry}
{IF: ($obj->forum_id == 118 || $obj->forum_id == 119)}
{TEMPLATE: dmsg_news_post}
{ELSE}
{IF: ($obj->forum_id == 124)}
{TEMPLATE: dmsg_downloads_post}
{ELSE}
{TEMPLATE: dmsg_regular_post}
{END}
{SECTION: END}

Then I just added sub templates which contains the layouts.


In the downloads section, I wanted the first post to look different than the rest of the posts in the topic - simple IF statement again and shabaam, Stylized first post, with simple styled comments to the main thing:

{SECTION: dmsg_downloads_post}
{IF: ($obj->root_msg_id == $obj->id && $obj->forum_id == 124)}
<tr><td></td><td>
<div style="padding: 3px; margin: 0px 2px; border: 0px solid #aaaaaa; background: none;">
<span style="float: right;">{TEMPLATE-DATA: edit_link} {IF: $perms & 32}[ <a href="{TEMPLATE: dmsg_delete_link_lnk}">Delete</a> ]{ENDIFI}</span>
{IF: $obj->icon}<div class="img_shadow"><img src="images/message_icons/{VAR: obj->icon}" alt="{VAR: r[3]}" align="left" style="padding: 0px;"/></div>{ENDIF}
{TEMPLATE-DATA: drawmsg_file_attachments}
<div style="clear: both;"></div>
<div style="position: relative; left: 71px;clear: right;" class="img_shadow">
<div class="img_shadow_div" style="width: 506px; padding: 10px 5px; background-color:#FCFCFC; background-image:url({THEME_IMAGE_ROOT}/content_bg.jpg); background-position:right top; background-repeat:no-repeat;">{TEMPLATE-DATA: msg_body}</div></div>
<div style="clear: both;"></div>
<div style="position: relative; width: 630px;">
<!-- <span style="color: #666666;font-size: 9pt;">Written by {VAR: user_login} {TEMPLATE: dmsg_post_date}</span>
<br> -->
</div>
</div></td><td>
</td></tr>
{ELSE}
{TEMPLATE: dmsg_news_comment}
{END}
{SECTION: END}


Something like that. When I started all that, FUD didn't have the plugin system it has now, maybe it would have been possible to do something similair but much better with that.

Oh yeah, forgot to mention - In the news post thing, it has to be sorted in a reversed order, so you have to also edit the thread.php.t file I think and add an IF statement about the forum ID there aswell, to sort it reversed, I did it like this, on row 21 in my version of the forum:
if ($frm->id == 118 || $frm->id == 124) {
$sort_order = 't.id';
} ELSE { 
$sort_order = 'tv.seq';
} 

	$result = q('SELECT
		m.attach_cnt, m.poll_id, m.subject, m.icon, m.post_stamp,
		u.alias, u.id,
		u2.id, u2.alias,
		m2.id, m2.post_stamp,
		f.id, f.name,
		t.id, t.moved_to, t.root_msg_id, t.replies, t.rating, t.thread_opt, t.views, 
		r.last_view, t.n_rating, t.tdescr
		FROM {SQL_TABLE_PREFIX}tv_'.$frm_id.' tv
			INNER JOIN {SQL_TABLE_PREFIX}thread	t	ON tv.thread_id=t.id
			INNER JOIN {SQL_TABLE_PREFIX}msg	m	ON t.root_msg_id=m.id
			INNER JOIN {SQL_TABLE_PREFIX}msg	m2	ON m2.id=t.last_post_id
			LEFT JOIN {SQL_TABLE_PREFIX}users	u	ON u.id=m.poster_id
			LEFT JOIN {SQL_TABLE_PREFIX}users	u2	ON u2.id=m2.poster_id
			LEFT JOIN {SQL_TABLE_PREFIX}forum	f	ON f.id=t.moved_to
			LEFT JOIN {SQL_TABLE_PREFIX}read 	r	ON t.id=r.thread_id AND r.user_id='._uid.'
			WHERE tv.seq BETWEEN '.($lwi - ($cur_frm_page * $THREADS_PER_PAGE) + 1).' AND '.($lwi - (($cur_frm_page - 1) * $THREADS_PER_PAGE)).'
			ORDER BY ' . $sort_order . ' DESC');


[Message index]
 
Read Message
Read Message
Read Message icon14.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dark Orange
Next Topic: Wich is the best php editor
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 11:30:50 GMT 2024

Total time taken to generate the page: 0.03182 seconds