Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Frequently Asked Question (FAQ)
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Frequently Asked Question (FAQ)
Requirement: XThreads

Based on the Thread Descriptions example application, we will try to create a simple Frequently Asked Question (FAQ) forum using XThreads.

Create/edit a forum:
AdminCP -> Forums & Posts -> Forum Management:
  • Template Prefix: faq_
  • Language File Prefix:

    Code:
    <if THIS_SCRIPT == 'newthread.php' then>faqae_,</if>faq_

  • Show first post on every showthread page: Yes
  • Enable XThreads' Inline Forum Search: Yes
  • Allow Blank Post Message: Yes
Maybe we need to set the forum permissions so only Admin and Moderators can create threads in this forum.

Create a Custom Thread Fields:
AdminCP -> Configuration -> Custom Thread Fields
  • Title: Answer
    Modify it as our needs
  • Key: faq_answer
  • Applicable Forums: select our FAQ forum
  • Input Field Type: Multiline Textbox
  • Editable by / Required Field?: Moderators
    Modify it as our needs (depends on the FAQ forum permissions to create a thread)
  • Display Parsing: Use MyBB Parser (MyCode)
  • MyBB Parser Options: check the following options:
    • Allow newlines
    • Filter Badwords
    • Allow MyCode
    Modify it as our needs.

Create new templates in Global Templates:
AdminCP -> Templates & Style -> Templates -> Global Templates
  1. faq_editpost_first

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    <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?pid={$pid}&amp;processed=1" method="post" enctype="multipart/form-data" name="input">
    <input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
    <div style="width: 60%; margin: auto auto;">
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
    <tr>
    <td class="thead" colspan="2"><strong>{$lang->xtfaq_edit_faq}</strong></td>
    </tr>
    <tr>
    <td class="trow2"><strong>{$lang->xtfaq_question}</strong></td>
    <td class="trow2">{$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>
    </tr>
    {$extra_threadfields}
    <tr style="display: none;">
    <td class="trow2" valign="top"><strong>{$lang->your_message}:</strong><br /><div style="text-align: center;">{$smilieinserter}</div></td>
    <td class="trow2">
    <textarea name="message" id="message" rows="20" cols="70" tabindex="3">{$message}</textarea>
    {$codebuttons}
    </td>
    </tr>
    <tr style="display: none;">
    <td class="trow1" valign="top"><strong>{$lang->post_options}</strong></td>
    <td class="trow1"><span class="smalltext">
    <label><input type="checkbox" class="checkbox" name="postoptions[signature]" value="1" tabindex="6"{$postoptionschecked['signature']} /> {$lang->options_sig}</label>
    {$disablesmilies}</span>
    </td>
    </tr>
    </table>
    </div>
    {$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>
    <br />
    <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>
    {$footer}
    </body>
    </html>

  2. faq_forumdisplay_searchforum_inline

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <form action="forumdisplay.php" method="get">
    	<span class="smalltext"><strong>{$lang->search_forum}</strong></span>
    	<input type="text" class="textbox" name="search" value="{$searchval}" /> {$gobutton}
    	<input type="hidden" name="fid" value="{$fid}" />
    	<input type="hidden" name="sortby" value="{$sortby}" />
    	<input type="hidden" name="order" value="{$sortordernow}" />
    	<input type="hidden" name="datecut" value="{$datecut}" />
    	{$xthreads_forum_filter_form}
    </form>

  3. faq_forumdisplay_sticky_sep

    HTML Code
    <tr>
    <td colspan="{$colspan}"><strong>{$lang->xtfaq_ifaq}</strong></td>
    </tr>

  4. faq_forumdisplay_thread

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    <tr>
    	{$modbit}
    	<td style="width: 100%;">
    		<div>
    			<span>{$thread['threadprefix']}<strong>{$lang->xtfaq_q} <a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}" onclick="$('faq_answer_{$thread['tid']}').toggle(); return false;">{$thread['subject']}</a></strong></span>
    			<br class="clear" />
    			<div id="faq_answer_{$thread['tid']}">
    				<div class="float_left" style="display: block;"><strong>{$lang->xtfaq_a}</strong></div>
    				<div style="margin-left: 20px;">{$threadfields['faq_answer']}</div>
    				<div class="clear" style="margin: 5px 0px 9px 20px;">
    					{$gotounread}<a href="{$thread['threadlink']}"><em>{$lang->xtfaq_moreinfo}</em></a>
    					{$thread['multipage']}<br />
    					<span class="smalltext">
    						<a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>: {$lastposterlink}{$lang->comma}
    						{$lastpostdate} {$lastposttime}
    					</span>
    				</div>
    			</div>
    			<script type="text/javascript">
    			<!--
    				$('faq_answer_{$thread['tid']}').style.display = 'none';
    			// -->
    			</script>
    		</div>
    	</td>
    </tr>

  5. faq_forumdisplay_threadlist

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    <div class="float_right">
    	{$newthread}
    </div>
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" style="clear: both; width: 80%; margin: auto auto;">
    	<tr>
    		<td colspan="{$colspan}">
    			<div style="text-align: center;" class="largetext">
    				<strong>{$foruminfo['name']}</strong>
    			</div>
    		</td>
    	</tr>
    	{$selectall}
    	{$threads}{$nullthreads}
    </table>
    <br class="clear" />
    <div style="text-align: center;">
    	{$multipage}
    </div>
    <br class="clear" />
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
    	<tr>
    		{$inlinemodcol}
    		<td class="thead">
    			<div class="float_right">{$searchforum}</div>
    			{$forumjump}
    		</td>
    	</tr>
    </table>
    <div class="float_left" style="margin-top: 4px;">
    	{$inlinemod}
    </div>
    <div class="float_right" style="margin-top: 4px;">
    	{$newthread}
    </div>
    <br style="clear: both;" />
    <br />
    <div class="smalltext" style="text-align: center;">
    	{$foruminfo['name']}<br />
    	Powered by: <a href="http://mybbhacks.zingaburga.com/showthread.php?tid=288">XThreads</a> &ndash; <a href="http://mybbhacks.zingaburga.com">MyBB Hacks</a>
    </div>
    <br style="clear: both" />
    {$inline_edit_js}

  6. faq_forumdisplay_threads_sep

    HTML Code
    <tr>
    <td colspan="{$colspan}"><strong>{$lang->xtfaq_gfaq}</strong></td>
    </tr>

  7. faq_forumdisplay_thread_modbit

    HTML Code
    <td align="center" style="white-space: nowrap; vertical-align: top"><input type="checkbox" class="checkbox" name="inlinemod_{$multitid}" id="inlinemod_{$multitid}" value="1" {$inlinecheck}  /></td>

  8. faq_newthread

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    <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}&amp;processed=1" method="post" enctype="multipart/form-data" name="input">
    <input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
    <div style="width: 60%; margin: auto auto;">
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
    <tr>
    <td class="thead" colspan="2"><strong>{$lang->xtfaq_new_faq}</strong></td>
    </tr>
    <tr>
    <td class="trow2" width="20%"><strong>{$lang->xtfaq_question}</strong></td>
    <td class="trow2">{$prefixselect}<input type="text" class="textbox" name="subject" size="49" maxlength="85" value="{$subject}" tabindex="1" /></td>
    </tr>
    {$extra_threadfields}
    <tr style="display: none;">
    <td class="trow2" valign="top"><strong>{$lang->your_message}</strong>{$smilieinserter}</td>
    <td class="trow2">
    <textarea name="message" id="message" rows="20" cols="70" tabindex="2">{$message}</textarea>
    {$codebuttons}
    {$multiquote_external}
    </td>
    </tr>
    <tr style="display: none;">
    <td class="trow1" valign="top"><strong>{$lang->post_options}</strong></td>
    <td class="trow1"><span class="smalltext">
    <label><input type="checkbox" class="checkbox" name="postoptions[signature]" value="1" tabindex="7"{$postoptionschecked['signature']} /> {$lang->options_sig}</label>
    {$disablesmilies}</span></td>
    </tr>
    {$modoptions}
    {$captcha}
    </table>
    </div>
    {$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>

  9. faq_postbit_first & faq_postbit_first_classic

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    {$ignore_bit}
    <a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" style="width: 80%; margin: auto auto;{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
    	<tbody>
    		<tr>
    			<td class="post_content {$unapproved_shade}">
    				<div class="post_body" id="pid_{$post['pid']}">
    					{$post['posturl']}
    					<div><strong>{$lang->xtfaq_q} {$post['subject']} {$post['subject_extra']}</strong></div>
    					<br class="clear" />
    					<div class="float_left" style="display: block;"><strong>{$lang->xtfaq_a}</strong></div>
    					<div style="margin-left: 20px;">{$GLOBALS['threadfields']['faq_answer']}</div>
    					{$post['message']}
    					<br class="clear" />
    					<span id="edited_by_{$post['pid']}" class="float_right">{$post['editedmsg']}</span>
    					<strong>{$post['profilelink']}</strong> {$post['onlinestatus']}<br />
    					<span class="smalltext">{$post['postdate']}, {$post['posttime']}</span>
    				</div>
    				{$post['attachments']}
    				<div class="post_meta" id="post_meta_{$post['pid']}">{$post['iplogged']}</div>
    				<br class="clear" />
    				<div class="author_buttons float_left">
    					{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}{$post['button_rep']}
    				</div>
    				<div class="post_management_buttons float_right">{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
    				</div>
    			</td>
    		</tr>
    	</tbody>
    </table>

  10. faq_showthread

    HTML Code
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    <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=1603"></script>
    </head>
    <body>
    {$header}
    {$pollbox}
    <br class="clear" />
    <div>
    	{$first_post}
    </div>
    <br class="clear" />
    <div class="float_left">{$multipage}</div>
    <div class="float_right">{$newreply}</div>
    {$ratethread}
    <br class="clear" />
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both; border-bottom-width: 0; margin-bottom: -7px;">
    	<tr>
    		<td class="thead" colspan="2">
    			<div style="float: right;">
    				<span class="smalltext"><strong><a href="showthread.php?mode=threaded&amp;tid={$tid}&amp;pid={$pid}#pid{$pid}">{$lang->threaded}</a> | <a href="showthread.php?mode=linear&amp;tid={$tid}&amp;pid={$pid}#pid{$pid}">{$lang->linear}</a></strong></span>
    			</div>
    			<div>
    				<strong>{$thread['threadprefix']}{$thread['subject']}</strong>
    			</div>
    		</td>
    	</tr>
    	{$classic_header}
    </table>
    <div id="posts">
    	{$posts}
    </div>
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="border-top-width: 0;">
    	<tr>
    		<td colspan="2" class="tfoot">
    			{$search_thread}
    			<div>
    				<strong>&laquo; <a href="{$next_oldest_link}">{$lang->next_oldest}</a> | <a href="{$next_newest_link}">{$lang->next_newest}</a> &raquo;</strong>
    			</div>
    		</td>
    	</tr>
    </table>
    <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&amp;tid={$tid}&amp;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>

  11. faq_showthread_noreplies

    HTML Code
    <div id="xthreads_noreplies"><table border="0" cellspacing="{$GLOBALS['theme']['borderwidth']}" cellpadding="{$GLOBALS['theme']['tablespace']}" class="tborder" style="margin-top: 7px;"><tr><td class="trow2">{$GLOBALS['lang']->xtfaq_noreplies}</td></tr></table></div>


We use language prefix for that (attached). Upload it to our inc/languages/*our language* folder.

Scr:
Threadlist:
   

Shothread:
   

Newthread/Editpost:
   

Live Demo:
http://mybbhacks.zingaburga.com/forumdisplay.php?fid=37
(the Important FAQ are sticky threads, and the General FAQ are normal threads).


Attached File(s)
.7z  faq.7z (Size: 499 bytes / Downloads: 676)

(This post was last modified: 03-16-2012 05:04 AM by RateU.)
03-16-2012 04:40 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Frequently Asked Question (FAQ) - RateU - 03-16-2012 04:40 AM
RE: Frequently Asked Question (FAQ) - Glas - 03-23-2012, 03:56 AM
RE: Frequently Asked Question (FAQ) - Glas - 06-02-2012, 06:47 AM
RE: Frequently Asked Question (FAQ) - Glas - 06-04-2012, 04:15 AM
RE: Frequently Asked Question (FAQ) - Glas - 06-04-2012, 11:09 PM
RE: Frequently Asked Question (FAQ) - Yoda - 06-19-2018, 01:42 PM

 Standard Tools
Forum Jump: