Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Thread Prefix
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Thread Prefix
With XThreads, we can create thread prefix. More than that, we can filter the threads based on their prefix.

Here is a simple way to do that:

1. Create a Custom Thread Fields with this settings:
  • Title: Prefix
  • Key: prefix
  • Applicable Forums: 'select a forum that we want the prefix to be applied'
  • Input Field Type: Listbox
  • Field Input Height: 1
    If we want multi prefix for a single thread, fill the Field Input Height with a value that greater than 1.
  • Values List:

    Code:
    Prefix 1
    Prefix 2
    Prefix 3

    Name it as our need.

  • Editable by / Required Field?: Everyone (Required)
  • Allow Filtering: Yes
  • Display Format:

    Code:
    [{VALUE}]

    If we want multi prefix, this will be the "main" display format.

  • Allow multiple values for this field: No
    If we want multi prefix for a single threads, choose Yes
  • Multiple Value Delimiter:

    Code:
    , 

    The Multiple Value Delimiter setting will be displayed if we choose Yes in Allow multiple values for this field setting. This is separator for each prefix.

  • Display Item Format:

    Code:
    {VALUE}

    The Display Item Format setting will be displayed if we choose Yes in Allow multiple values for this field setting. This is the display format for each prefix.

  • Formatting Map List:

    Code:
    Prefix 1{|}<a href="{$forumurl?}filtertf_prefix=Prefix 1"><span style="color: red;">Prefix 1</span></a>
    Prefix 2{|}<a href="{$forumurl?}filtertf_prefix=Prefix 2"><span style="color: green;">Prefix 2</span></a>
    Prefix 3{|}<a href="{$forumurl?}filtertf_prefix=Prefix 3"><span style="color: blue;">Prefix 3</span></a>


2. We need to edit our forumdisplay_thread template. The basic concept for this edit process is, adding {$GLOBALS['threadfields']['prefix']} variable into the forumdisplay_thread template. The prefix will be displayed wherever we put the variable in the template.

In this example, we will put the prefix before Thread Subject:
We can find this code in our forumdisplay_thread template (based on the default template):

HTML Code
<span>{$prefix} {$gotounread}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>


Then, add the {$GLOBALS['threadfields']['prefix']} variable. So, the code will be like this:

HTML Code
{$GLOBALS['threadfields']['prefix']} <span>{$prefix} {$gotounread}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>



Additional info:

  • The filtering url has a general structure:
    Quote:{$forumurl?}filtertf_Key_for_the_field=Name of each prefix
    In the example above:
    Key_for_the_field = prefix
    Name of each prefix = Prefix1, Prefix 2, and Prefix 3.

    So, the filtering URL will be like this:
    Quote:{$forumurl?}filtertf_prefix=Prefix 1
    {$forumurl?}filtertf_prefix=Prefix 2
    {$forumurl?}filtertf_prefix=Prefix 3
  • We can do some experiment with these three settings if we want multi prefix: Display Format, Multiple Value Delimiter and Display Item Format.

    Example 1:
    Display Format = [{VALUE}]
    Multiple Value Delimiter = , (plus one space)
    Display Item Format = {VALUE}
    Result:
    Quote:[Prefix 1, Prefix 2, Prefix 3] Thread Title

    Example 2:
    Display Format = {VALUE}
    Multiple Value Delimiter = one space
    Display Item Format = [{VALUE}]
    Result:
    Quote:[Prefix 1] [Prefix 2] [Prefix 3] Thread Title

    Example 3:
    Display Format = {VALUE}
    Multiple Value Delimiter = one space|one space
    Display Item Format = {VALUE}
    Result:
    Quote:Prefix 1 | Prefix 2 | Prefix 3 Thread Title
  • We can use image for the output of each prefix.
    Display Format = {VALUE}
    Multiple Value Delimiter = one space
    Display Item Format = {VALUE}
    Formatting Map List:

    Code:
    Prefix 1{|}<a href="{$forumurl?}filtertf_prefix=Prefix 1"><img src="image_url_for_prefix_1" alt="Prefix 1" title="Display Prefix 1 Only" /></a>
    Prefix 2{|}<a href="{$forumurl?}filtertf_prefix=Prefix 2"><img src="image_url_for_prefix_2" alt="Prefix 2" title="Display Prefix 2 Only" /></a>
    Prefix 3{|}<a href="{$forumurl?}filtertf_prefix=Prefix 3"><img src="image_url_for_prefix_3" alt="Prefix 3" title="Display Prefix 3 Only" /></a>

  • We can use the Prefix Filtering system as category for our XThreads application.

(This post was last modified: 08-20-2010 02:11 AM by RateU.)
04-27-2010 07:51 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Thread Prefix - RateU - 04-27-2010 07:51 AM
RE: Thread Prefix - ZiNgA BuRgA - 04-27-2010, 02:28 PM
RE: Thread Prefix - RateU - 04-28-2010, 07:32 AM
RE: Thread Prefix - Gypaete - 08-20-2010, 12:03 AM
RE: Thread Prefix - RateU - 08-20-2010, 02:03 AM
RE: Thread Prefix - Gypaete - 08-20-2010, 03:34 AM
RE: Thread Prefix - RateU - 08-20-2010, 03:39 AM
RE: Thread Prefix - Gypaete - 08-20-2010, 03:40 AM
RE: Thread Prefix - RateU - 08-20-2010, 03:47 AM
RE: Thread Prefix - Gypaete - 08-20-2010, 03:49 AM
RE: Thread Prefix - Gypaete - 09-02-2010, 01:41 AM
RE: Thread Prefix - RateU - 08-20-2010, 03:53 AM
RE: Thread Prefix - Gypaete - 08-20-2010, 03:58 AM
RE: Thread Prefix - RateU - 08-20-2010, 04:02 AM
RE: Thread Prefix - Gypaete - 08-20-2010, 04:05 AM
RE: Thread Prefix - RateU - 08-20-2010, 04:07 AM
RE: Thread Prefix - Gypaete - 08-20-2010, 04:18 AM
RE: Thread Prefix - RateU - 08-20-2010, 04:20 AM
RE: Thread Prefix - Jumper - 09-01-2010, 01:49 AM
RE: Thread Prefix - RateU - 09-01-2010, 02:03 AM
RE: Thread Prefix - Jumper - 09-01-2010, 02:22 AM
RE: Thread Prefix - RateU - 09-01-2010, 02:28 AM
RE: Thread Prefix - Jumper - 09-01-2010, 02:48 AM
RE: Thread Prefix - RateU - 09-01-2010, 04:01 AM
RE: Thread Prefix - Jumper - 09-02-2010, 12:14 AM
RE: Thread Prefix - RateU - 09-02-2010, 02:29 AM
RE: Thread Prefix - Gypaete - 09-02-2010, 03:58 AM
RE: Thread Prefix - RateU - 09-02-2010, 04:18 AM
RE: Thread Prefix - ZiNgA BuRgA - 09-02-2010, 07:31 AM
RE: Thread Prefix - Jumper - 09-02-2010, 08:33 AM
RE: Thread Prefix - ZiNgA BuRgA - 09-02-2010, 08:47 AM
RE: Thread Prefix - Gypaete - 09-02-2010, 08:35 PM
RE: Thread Prefix - ZiNgA BuRgA - 09-02-2010, 08:38 PM
RE: Thread Prefix - Gypaete - 09-02-2010, 09:57 PM
RE: Thread Prefix - RateU - 09-03-2010, 05:35 AM
RE: Thread Prefix - Gypaete - 03-28-2011, 04:40 AM
RE: Thread Prefix - RateU - 03-28-2011, 06:39 AM
RE: Thread Prefix - duhol - 04-08-2011, 06:50 PM
RE: Thread Prefix - RateU - 04-09-2011, 02:04 AM
RE: Thread Prefix - duhol - 04-09-2011, 03:56 AM
RE: Thread Prefix - RateU - 04-09-2011, 06:28 AM
RE: Thread Prefix - ZiNgA BuRgA - 04-09-2011, 10:00 AM
RE: Thread Prefix - leefish - 07-18-2011, 08:29 PM
RE: Thread Prefix - RateU - 07-19-2011, 03:50 AM
RE: Thread Prefix - leefish - 07-19-2011, 11:55 AM
RE: Thread Prefix - RateU - 07-20-2011, 08:51 AM
RE: Thread Prefix - leefish - 07-20-2011, 04:07 PM
RE: Thread Prefix - RateU - 07-21-2011, 04:30 AM
RE: Thread Prefix - WhiteEagle - 10-06-2011, 05:15 AM
RE: Thread Prefix - leefish - 04-03-2012, 12:56 PM
RE: Thread Prefix - ZiNgA BuRgA - 04-03-2012, 03:53 PM
RE: Thread Prefix - leefish - 04-03-2012, 04:35 PM
RE: Thread Prefix - RateU - 04-04-2012, 04:12 AM
RE: Thread Prefix - leefish - 04-04-2012, 04:55 AM
RE: Thread Prefix - Kiero - 09-03-2013, 06:41 PM
RE: Thread Prefix - ZiNgA BuRgA - 09-04-2013, 11:37 AM
RE: Thread Prefix - rkrusty26 - 01-30-2014, 08:32 PM
RE: Thread Prefix - ZiNgA BuRgA - 01-31-2014, 09:35 AM
RE: Thread Prefix - PetesBonnie - 02-14-2017, 11:02 PM
RE: Thread Prefix - RateU - 02-15-2017, 02:53 AM

 Standard Tools
Forum Jump: