02-03-2011, 10:45 AM
Requirement: XThreads
Last Updated: 7 October 2012
We will try to create a very simple Football Fixtures. We will use EPL fixtures only as example fixtures.
Here is a simple example to do that:
Create or edit a forum with these settings:
Create a Custom Thread Fields with these settings:
AdminCP -> Configuration -> Custom Thread Fields
Create new templates in Global Template:
AdminCP -> Templates & Style -> Templates -> Global Templates
Additional Info:
Please tell me if there is something wrong with the code above. I'm still learning
Screenshots:
Showthread - Threadlist
[attachment=414] [attachment=413]
Live Demo: http://www.14.mynie.co.cc/forumdisplay.php?fid=44
Because I really love football, so, I make it based on the actual fixtures (not finished yet)
Last Updated: 7 October 2012
We will try to create a very simple Football Fixtures. We will use EPL fixtures only as example fixtures.
Here is a simple example to do that:
Create or edit a forum with these settings:
- Template Prefix: xtff_
- Show first post on every showthread page: Yes
- Settings Overrides:
- Setting: Showthread Options -> Post Layout
Value: horizontal
Code:postlayout=horizontal
- Setting: Showthread Options -> Post Layout
- Custom WOL Text:
- Forum Display:
HTML Code
Viewing <a href="{1}">{2}</a>
- New Thread:
HTML Code
Submitting a new match
- New Reply:
HTML Code
Commenting <a href="{1}">{2}</a> match
- Show Thread:
HTML Code
Viewing <a href="{1}">{2}</a> match
- Forum Display:
Create a Custom Thread Fields with these settings:
AdminCP -> Configuration -> Custom Thread Fields
- Listbox for Home Team
- Title: Home Team
- Key: xtff_ht
- Applicable Forums: 'select our Football Fixtures forum.'
- Input Field Type: Listbox
- Input Field Type: 1
- Values List:
Code:Arsenal Aston Villa Birmingham City Blackburn Rovers Blackpool Bolton Wanderers Chelsea Everton Fulham Liverpool Manchester City Manchester United Newcastle United Stoke City Sunderland Tottenham Hotspur West Bromwich Albion West Ham United Wigan Athletic Wolverhampton Wanderers
Should enough for EPL 2010/2011
- Editable by / Required Field?: Everyone (required)
- Allow Filtering: Yes
- Display Format:
Code:<setvar img_ht>'<img src="images/club_logo/'.str_replace(' ','',{VALUE}).'.jpg" title="'.{VALUE}.'" alt="'.{VALUE}.'" />'</setvar><setvar text_ht>{VALUE}</setvar><setvar img_htp>'<img src="images/club_logo/'.str_replace(' ','',{VALUE}).'_b.jpg" title="'.{VALUE}.'" alt="'.{VALUE}.'" />'</setvar>
- Listbox for Away Team
The Value List of this custom thread fields is the same as the custom thread fields above.- Title: Away Team
- Key: xtff_at
- Applicable Forums: 'select our Football Fixtures forum.'
- Input Field Type: Listbox
- Input Field Type: 2
- Values List:
Code:Arsenal Aston Villa Birmingham City Blackburn Rovers Blackpool Bolton Wanderers Chelsea Everton Fulham Liverpool Manchester City Manchester United Newcastle United Stoke City Sunderland Tottenham Hotspur West Bromwich Albion West Ham United Wigan Athletic Wolverhampton Wanderers
- Editable by / Required Field?: Everyone (required)
- Allow Filtering: Yes
- Display Format:
Code:<setvar img_at>'<img src="images/club_logo/'.str_replace(' ','',{VALUE}).'.jpg" title="'.{VALUE}.'" alt="'.{VALUE}.'" />'</setvar><setvar text_at>{VALUE}</setvar><setvar img_atp>'<img src="images/club_logo/'.str_replace(' ','',{VALUE}).'_b.jpg" title="'.{VALUE}.'" alt="'.{VALUE}.'" />'</setvar>
- Textbox for Match Day / Date of The Match
- Title: Match Day
- Key: xtff_md
- Applicable Forums: 'select our Football Fixtures forum.'
- Input Field Type: Texbox
- Maximum Text Length: 10
- Field Input Width: 10
- Editable by / Required Field?: Everyone (required)
- Text Mask Filter: Date (mm/dd/yyyy)
- Textbox for Score Home Team (Full Time)
- Title: Score Home Team (FT)
- Key: xtff_hft
- Applicable Forums: 'select our Football Fixtures forum.'
- Input Field Type: Texbox
- Maximum Text Length: 2
- Field Input Width: 2
Max score: 99 - Editable by / Required Field?: Everyone
We make this not a required field, because we should be able to add the next fixtures.
Later, after the game played, we need to edit the thread, and put the result. - Blank Replacement Value:
HTML Code
<strong>–</strong>
- Display Format:
HTML Code
<strong>{VALUE}</strong>
- Text Mask Filter: Digits
- Textbox for Score Away Team (Full Time)
This custom thread fields is very similar like the custom thread fields above.- Title: Score Away Team (FT)
- Key: xtff_aft
- Applicable Forums: 'select our Football Fixtures forum.'
- Input Field Type: Texbox
- Maximum Text Length: 2
- Field Input Width: 2
- Editable by / Required Field?: Everyone
- Blank Replacement Value:
HTML Code
<strong>–</strong>
- Display Format:
HTML Code
<strong>{VALUE}</strong>
- Text Mask Filter: Digits
Create new templates in Global Template:
AdminCP -> Templates & Style -> Templates -> Global Templates
- xtff_editpost_first
HTML Code<html> <head> <title>{$mybb->settings['bbname']} - {$lang->edit_post}</title> {$headerinclude} <script type="text/javascript" src="jscripts/post.js?ver=1400"></script> </head> <body> {$header} {$preview} {$post_errors} {$attacherror} <form action="editpost.php" method="post" name="editpost"> <input type="hidden" name="my_post_key" value="{$mybb->post_code}" /> <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder"> <tr> <td class="thead" colspan="3"><strong>{$lang->delete_post}</strong></td> </tr> <tr> <td class="trow1" style="white-space: nowrap"><input type="checkbox" class="checkbox" name="delete" value="1" tabindex="9" /> <strong>{$lang->delete_q}</strong></td> <td class="trow1" width="100%">{$lang->delete_1}<br /><span class="smalltext">{$lang->delete_2}</span></td> <td class="trow1"><input type="submit" class="button" name="submit" value="{$lang->delete_now}" tabindex="10" /></td> </tr> </table> <input type="hidden" name="action" value="deletepost" /> <input type="hidden" name="pid" value="{$pid}" /> </form> <br /> <form action="editpost.php?pid={$pid}&processed=1" method="post" enctype="multipart/form-data" name="input"> <input type="hidden" name="my_post_key" value="{$mybb->post_code}" /> <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder"> <tr> <td class="thead largetext" colspan="2" align="center"><strong>Edit Match</strong></td> </tr> <tr> <td class="tcat" align="center" width="1"><strong>Match Review</strong></td> <td class="tcat" align="center"><strong>Match Info</strong></td> </tr> <tr> <td class="trow2" align="center" valign="top"> <textarea name="message" id="message" rows="20" cols="70" tabindex="3">{$message}</textarea> {$codebuttons} </td> <td class="trow2" align="center" valign="top"> <table border="0" width="100%"> <tr> <td class="trow2"> <div><strong>Match Title:</strong></div> {$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /> </td> </tr> {$extra_threadfields} </table> </td> </tr> {$pollbox} </table> {$attachbox} <br /> <div align="center"><input type="submit" class="button" name="submit" value="{$lang->update_post}" tabindex="3" accesskey="s" /> <input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="4" /></div> <input type="hidden" name="action" value="do_editpost" /> <input type="hidden" name="posthash" value="{$posthash}" /> <input type="hidden" name="attachmentaid" value="" /> <input type="hidden" name="attachmentact" value="" /> </form> {$footer} </body> </html>
- xtff_forumdisplay_thread
HTML Code<tr> <td class="{$bgcolor}{$thread_type_class}" style="text-align: center;"><a href="{$thread['threadlink']}" title="{$thread['subject']}">{$GLOBALS['threadfields']['xtff_md']}</a></td> <td class="{$bgcolor}{$thread_type_class}" style="text-align: center;">{$tplvars['img_ht']}</td> <td class="{$bgcolor}{$thread_type_class}" style="text-align: center;"> <a href="{$forumurl_q}filtertf_xtff_ht={$tplvars['text_ht']}"><strong>{$tplvars['text_ht']}</strong></a> </td> <td class="{$bgcolor}{$thread_type_class}" style="text-align: center;"> <a href="{$forumurl_q}filtertf_xtff_ht={$tplvars['text_ht']}&filtertf_xtff_at={$tplvars['text_at']}" title="History"> <span style="margin-right: 3px;"><strong>{$GLOBALS['threadfields']['xtff_hft']}</strong></span> <span class="largetext"><strong>:</strong></span> <span style="margin-left: 3px;"><strong>{$GLOBALS['threadfields']['xtff_aft']}</strong></span> </a> </td> <td class="{$bgcolor}{$thread_type_class}" style="text-align: center;"> <a href="{$forumurl_q}filtertf_xtff_at={$tplvars['text_at']}"><strong>{$tplvars['text_at']}</strong></a> </td> <td class="{$bgcolor}{$thread_type_class}" style="text-align: center;">{$tplvars['img_at']}</td> {$modbit} </tr>
- xtff_forumdisplay_threadlist
HTML Code<div class="float_left"> {$multipage} </div> <div class="float_right"> {$newthread} </div> <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" style="clear: both; width: 100%;"> <tr> <td valign="top"> <table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder"> <tr> <td class="thead" colspan="{$colspan}"> <div> <a href="{$forumurl}"><strong>{$foruminfo['name']}</strong></a> </div> </td> </tr> <tr> <td class="tcat smalltext" width="100" style="text-align: center;"><strong>Date</strong></td> <td class="tcat smalltext" width="1"> </td> <td class="tcat smalltext" style="text-align: center;"><strong>Home Team</strong></td> <td class="tcat smalltext" width="100" style="text-align: center;"><strong>Score</strong></td> <td class="tcat smalltext" style="text-align: center;"><strong>Away Team</strong></td> <td class="tcat smalltext" width="1"> </td> {$inlinemodcol} </tr> {$threads}{$nullthreads} </table> </td> </tr> </table> <div class="float_left"> {$multipage} </div> <div class="float_right" style="margin-top: 4px;"> {$newthread} </div> <br style="clear: both;" /> <br /> <div class="float_right" style="text-align: right;"> {$inlinemod} {$searchforum} {$forumjump} </div> <br style="clear: both" /> {$inline_edit_js}
- xtff_newthread
HTML Code<html> <head> <title>{$lang->newthread_in}</title> {$headerinclude} <script type="text/javascript" src="jscripts/post.js?ver=1400"></script> </head> <body> {$header} {$preview} {$thread_errors} {$attacherror} <form action="newthread.php?fid={$fid}&processed=1" method="post" enctype="multipart/form-data" name="input"> <input type="hidden" name="my_post_key" value="{$mybb->post_code}" /> <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder"> <tr> <td class="thead largetext" colspan="2" align="center"><strong>New Match</strong></td> </tr> <tr> <td class="tcat" align="center" width="1"><strong>Match Review</strong></td> <td class="tcat" align="center"><strong>Match Info</strong></td> </tr> <tr> <td class="trow2" align="center" valign="top"> <textarea name="message" id="message" rows="20" cols="70" tabindex="2">{$message}</textarea> {$codebuttons} {$multiquote_external} </td> <td class="trow2" align="center" valign="top"> <table border="0" width="100%"> <tr> <td class="trow2"> <div><strong>Match Title:</strong></div> {$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /> </td> </tr> {$extra_threadfields} </table> </td> </tr> {$modoptions} {$pollbox} {$captcha} </table> {$attachbox} <br /> <div style="text-align:center"><input type="submit" class="button" name="submit" value="{$lang->post_thread}" tabindex="4" accesskey="s" /> <input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="5" />{$savedraftbutton}</div> <input type="hidden" name="action" value="do_newthread" /> <input type="hidden" name="posthash" value="{$posthash}" /> <input type="hidden" name="attachmentaid" value="" /> <input type="hidden" name="attachmentact" value="" /> <input type="hidden" name="quoted_ids" value="{$quoted_ids}" /> <input type="hidden" name="tid" value="{$tid}" /> {$editdraftpid} </form> {$forumrules} {$footer} </body> </html>
- xtff_postbit
HTML Code{$ignore_bit} <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a> <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}"> <tbody> <tr> <td class="trow2 post_content {$unapproved_shade}"> {$post['posturl']} <div class="smalltext"> Comment by: <a href="{$post['profilelink_plain']}" id="profile_{$post['pid']}">{$post['username_formatted']}</a> </div> <div class="smalltext"> Submitted: {$post['postdate']}, {$post['posttime']} </div> <div><span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span></div> <div id="profile_{$post['pid']}_popup" class="popup_menu" style="display: none;"> <div class="popup_item_container"> <table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder"> <tr> <td class="trow1" valign="top" align="center"> <div><strong>{$post['profilelink']}</strong></div> <div class="smalltext">{$post['useravatar']}</div> <div class="smalltext">{$post['usertitle']}</div> <div class="smalltext">{$post['userstars']}</div> <div class="smalltext">{$post['groupimage']}</div> <div class="smalltext">{$post['user_details']}</div> </td> </tr> <tr> <td class="tcat" align="center"> {$post['button_email']} {$post['button_pm']} {$post['button_www']} {$post['button_find']} {$post['button_rep']} </td> </tr> </table> </div> </div> <div class="post_body" id="pid_{$post['pid']}"> {$post['message']} </div> <div class="post_meta" id="post_meta_{$post['pid']}"> {$post['iplogged']} </div> <div class="post_management_buttons float_right clear"> {$post['button_edit']} {$post['button_quickdelete']} {$post['button_quote']} {$post['button_multiquote']} {$post['button_report']} {$post['button_warn']} </div> </td> </tr> </tbody> </table> <script type="text/javascript"> // <!-- if(use_xmlhttprequest == "1") { new PopupMenu("profile_{$post['pid']}"); } // --> </script>
- xtff_postbit_first
HTML Code{$ignore_bit} <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a> <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}"> <tbody> <tr> <td class="trow2 post_content {$unapproved_shade}"> <div class="largetext">Match Day: {$GLOBALS['threadfields']['xtff_md']}</div> <br /> <table width="100%" border="0"> <tr> <td class="trow2 {$unapproved_shade}" style="text-align: center;" width="300"> <div>{$GLOBALS['tplvars']['img_htp']}</div> <div class="largetext"><strong>{$GLOBALS['tplvars']['text_ht']}</strong></div> </td> <td class="trow2 largetext {$unapproved_shade}" style="text-align: center;"> <span style="margin-right: 3px;"><strong>{$GLOBALS['threadfields']['xtff_hft']}</strong></span> <span class="largetext"><strong>:</strong></span> <span style="margin-left: 3px;"><strong>{$GLOBALS['threadfields']['xtff_aft']}</strong></span> </td> <td class="trow2 {$unapproved_shade}" style="text-align: center;" width="300"> <div>{$GLOBALS['tplvars']['img_atp']}</div> <div class="largetext"><strong>{$GLOBALS['tplvars']['text_at']}</strong></div> </td> </tr> </table> <br class="clear" /> {$post['posturl']} <div><strong>{$post['subject']} {$post['subject_extra']}</strong></div> <div class="smalltext"> Match Review by: <a href="{$post['profilelink_plain']}" id="profile_{$post['pid']}">{$post['username_formatted']}</a> </div> <div class="smalltext"> Submitted: {$post['postdate']}, {$post['posttime']} </div> <div><span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span></div> <div id="profile_{$post['pid']}_popup" class="popup_menu" style="display: none;"> <div class="popup_item_container"> <table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder"> <tr> <td class="trow1" valign="top" align="center"> <div><strong>{$post['profilelink']}</strong></div> <div class="smalltext">{$post['useravatar']}</div> <div class="smalltext">{$post['usertitle']}</div> <div class="smalltext">{$post['userstars']}</div> <div class="smalltext">{$post['groupimage']}</div> <div class="smalltext">{$post['user_details']}</div> </td> </tr> <tr> <td class="tcat" align="center"> {$post['button_email']} {$post['button_pm']} {$post['button_www']} {$post['button_find']} {$post['button_rep']} </td> </tr> </table> </div> </div> <br class="clear" /> <div class="post_body" id="pid_{$post['pid']}"> {$post['message']} </div> <div class="post_meta" id="post_meta_{$post['pid']}"> {$post['iplogged']} </div> <div class="post_management_buttons float_right clear"> {$post['button_edit']} {$post['button_quickdelete']} {$post['button_quote']} {$post['button_multiquote']} {$post['button_report']} {$post['button_warn']} </div> </td> </tr> </tbody> </table> <script type="text/javascript"> // <!-- if(use_xmlhttprequest == "1") { new PopupMenu("profile_{$post['pid']}"); } // --> </script>
- xtff_postbit_first_posturl
HTML Code<div style="float: right; width: auto; vertical-align: top"><span class="smalltext">{$post['inlinecheck']}</span></div>
- xtff_postbit_posturl
HTML Code<div style="float: right; width: auto; vertical-align: top"><span class="smalltext"><strong><a href="{$post['postlink']}#pid{$post['pid']}">#{$postcounter}</a></strong>{$post['inlinecheck']}</span></div>
- xtff_showthread
HTML Code<html> <head> <title>{$thread['subject']}</title> {$headerinclude} <script type="text/javascript"> <!-- var quickdelete_confirm = "{$lang->quickdelete_confirm}"; // --> </script> <script type="text/javascript" src="jscripts/thread.js?ver=1600"></script> </head> <body> {$header} {$pollbox} <div> {$first_post} </div> <br class="clear" /> <div style="text-align: center;"> <strong>« <a href="{$next_oldest_link}">{$lang->next_oldest}</a> | <a href="{$next_newest_link}">{$lang->next_newest}</a> »</strong> </div> <br class="clear" /> <div class="largetext float_right">Match Comments</div> <div id="posts" class="clear"> {$posts} </div> <div class="float_left"> {$multipage} </div> <div style="padding-top: 4px;" class="float_right"> {$newreply} </div> <br style="clear: both;" /> {$quickreply} {$threadexbox} {$similarthreads} <br /> <div class="float_left"> <ul class="thread_tools"> <li class="printable"><a href="printthread.php?tid={$tid}">{$lang->view_printable}</a></li> <li class="sendthread"><a href="sendthread.php?tid={$tid}">{$lang->send_thread}</a></li> <li class="subscription_{$add_remove_subscription}"><a href="usercp2.php?action={$add_remove_subscription}subscription&tid={$tid}&my_post_key={$mybb->post_code}">{$add_remove_subscription_text}</a></li> </ul> </div> <div class="float_right" style="text-align: right;"> {$moderationoptions} {$forumjump} </div> <br style="clear: both;" /> {$usersbrowsing} {$footer} </body> </html>
- xtff_showthread_noreplies
HTML Code<table border="0" cellspacing="{$GLOBALS['theme']['borderwidth']}" cellpadding="{$GLOBALS['theme']['tablespace']}" class="tborder" id="xthreads_noreplies"> <tr> <td class="trow2" style="text-align: center;"> <div style="padding: 5px;">There is no comment in this match.</div> </td> </tr> </table>
- xtff_threadfields_inputrow
HTML Code<tr> <td class="{$altbg}"> <div><strong>{$tf['title']}</strong></div> {$inputfield}<small style="display: block;">{$tf['desc']}</small> </td> </tr>
Additional Info:
- We need two images for each clubs, small image (for threadlist) and big image (for showthread).
Example:
1. Club: Liverpool - Small Image: Liverpool.jpg - Big Image: Liverpool_b.jpg
2. Club: Manchester United - Small Image: ManchesterUnited.jpg - Big Image: ManchesterUnited_b.jpg
Upload the images to our images/club_logo folder. - The example above is a very simple example. It is only for the basic system, like club match history as home/away team and head to head story as home/away team. There are some aspects can be expanded with more custom thread fields, like adding Half Time Score, Season, League, and etc. It will make this forum doesn't have ending story
- We can use MyBB Polling as Users Prediction for each match. Or, use the polling as Users Prediction just for Big Match.
- The templates above based on MyBB 1.6 template.
Please tell me if there is something wrong with the code above. I'm still learning
Screenshots:
Showthread - Threadlist
[attachment=414] [attachment=413]
Live Demo: http://www.14.mynie.co.cc/forumdisplay.php?fid=44
Because I really love football, so, I make it based on the actual fixtures (not finished yet)