Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Country List
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Country List
Requirement: XThreads

We will try to create a simple country list with XThreads. Maybe we can use this just for a country database/list, or discussion based on user's country.

Yeah, I know that maybe this is useless. But I just want to share it Biggrin

Here is a simple way to do that:

  1. Forum settings:
    • Default Sort By: Thread subject
    • Default Sort Order: Ascending
    • Template Prefix: xtcl_
    • Thread Grouping: 3
    • Show first post on every showthread page: Yes
    • Enable XThreads' Inline Forum Search: Yes
    • Override Threads Per Page: 21
    • Hide Forum: Yes
      We need to put this forum URL manually in our template (eg: header template).
    • Don't include this forum's threads/posts in global forum statistics: Yes
    • Custom WOL Text:
      • Forum Display:

        Code:
        Browsing <a href="{1}">{2}</a>

      • New Thread: Adding a country to Country List
      • New Reply:

        Code:
        Discussion in <a href="{1}">{2}</a> country

      • Show Thread:

        Code:
        Viewing <a href="{1}">{2}</a> country

  2. Custom Thread Fields Setting:

    1. Textbox for Capital:
      • Title: Capital
      • Key: xtlc_cap
      • Applicable Forums: 'select our Country List forum'
      • Editable by / Required Field?: Everyone (required)
      • Display Format:

        HTML Code
        <tr>
        	<td class="trow1" width="99"><strong>Capital</strong></td>
        	<td class="trow1" width="1"><strong>:</strong></td>
        	<td class="trow1">{VALUE}</td>
        </tr>

    2. Textbox for Language:
      • Title: Language
      • Key: xtlc_lang
      • Applicable Forums: 'select our Country List forum'
      • Editable by / Required Field?: Everyone (required)
      • Display Order: 2
      • Display Format:

        HTML Code
        <tr>
        	<td class="trow1" width="99"><strong>Language</strong></td>
        	<td class="trow1" width="1"><strong>:</strong></td>
        	<td class="trow1">{VALUE}</td>
        </tr>

    3. Textbox for Currency:
      • Title: Currency
      • Key: xtlc_cur
      • Applicable Forums: 'select our Country List forum'
      • Editable by / Required Field?: Everyone (required)
      • Display Order: 3
      • Display Format:

        HTML Code
        <tr>
        	<td class="trow1" width="99"><strong>Currency</strong></td>
        	<td class="trow1" width="1"><strong>:</strong></td>
        	<td class="trow1">{VALUE}</td>
        </tr>

    4. Listbox for Continent:
      • Title: Continent
      • Key: xtlc_con
      • Applicable Forums: 'select our Country List forum'
      • Input Field Type: Listbox
      • Field Input Height: 1
      • Values List:

        Code:
        1
        2
        3
        4
        5
        6
        Asia
        Africa
        Europe
        North America
        Oceania
        South America

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

        HTML Code
        <tr>
        	<td class="trow1" width="99"><strong>Continent</strong></td>
        	<td class="trow1" width="1"><strong>:</strong></td>
        	<td class="trow1">{VALUE}</td>
        </tr>

    5. File input field type for Country Flag image:
      • Title: Country Flag
      • Key: xtlc_flag
      • Applicable Forums: 'select our Country List forum'
      • Input Field Type: File
      • Valid File Extensions: jpg|jpeg|gif|png
        Modify it as our needs. It is the extensions of image ext can be uploaded.
      • Maximum File Size: 1048576
        Modify it as our needs. It is a maximum file size (in bytes) that can be uploaded.
      • Editable by / Required Field?: Everyone (required)
      • Allow Filtering: Yes
      • Display Order: 5
      • Only Accept Image Files: Yes
      • Image Thumbnail Generation: 120x90|240x180
      • Display Format:

        HTML Code
        <if THIS_SCRIPT == 'forumdisplay.php' then>
        	<img src="{URL}/thumb120x90" alt="{$thread['subject']}" title="{$thread['subject']}" />
        <else>
        	<a href="{URL}" target="_blank"><img src="{URL}/thumb240x180" alt="{$thread['subject']}" title="{$thread['subject']}" /></a>
        </if>


  3. New templates in Global Template.
    Admin CP -> Templates & Style -> Templates -> Global Templates:
    1. xtcl_forumdisplay_group_sep

      HTML Code
      </tr><tr>

    2. xtcl_forumdisplay_nothreads

      HTML Code
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      <td>
      	<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
      		<tr>
      			<td class="thead">
      				<strong>No Country</strong>
      			</td>
      		</tr>
      		<tr>
      			<td align="center" class="trow1">
      				{$lang->nothreads}
      			</td>
      		</tr>
      	</table>
      </td>

    3. xtcl_forumdisplay_searchforum_inline

      HTML Code
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      <div class="largetext" style="text-align: center;">
      	<form action="forumdisplay.php" method="get">
      		Search Country
      		<input type="text" class="textbox" name="search" size="35" 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}" />
      	</form>
      </div>

    4. xtcl_forumdisplay_sticky_sep

      HTML Code
      <td colspan="{$colspan}" style="display: none;"></td>
      </tr>
      <tr>

      Well, we need the <td> part to pass validator.

    5. xtcl_forumdisplay_thread

      HTML Code
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      <td width="33%" valign="top">
      	<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
      		<tr>
      			<td class="thead" width="100%">
      				<div style="text-align: center;">
      					<strong><a href="{$thread['threadlink']}" class="{$inline_edit_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a></strong>
      				</div>
      			</td>
      			{$modbit}
      		</tr>
      		<tr>
      			<td class="trow1" align="center" valign="middle" colspan="{$colspan}">
      				<div>
      					<a href="{$thread['threadlink']}">{$GLOBALS['threadfields']['xtlc_flag']['value']}</a>
      				</div>
      			</td>
      		</tr>
      	</table>
      </td>

    6. xtcl_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
      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
      <table border="0" width="100%" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}">
      	<tr>
      		<td valign="top">
      			<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
      				<tr>
      					<td class="thead largetext">
      						<div style="text-align: center;"><a href="{$forumurl}"><strong>Continent</strong></a></div>
      					</td>
      					{$inlinemodcol}
      				</tr>
      				<tr>
      					<td class="trow1" colspan="2">
      						<table width="100%" border="0">
      							<tr>
      								<td class="trow1" style="text-align: center;">
      									<a href="{$forumurl_q}filtertf_xtlc_con=Asia"><strong>Asia</strong></a><br />
      									<a href="{$forumurl_q}filtertf_xtlc_con=Asia"><img src="images/asia.jpg" alt="" title="View Countries From Asia Continent" /></a>
      								</td>
      								<td class="trow1" style="text-align: center;">
      									<a href="{$forumurl_q}filtertf_xtlc_con=Africa"><strong>Africa</strong></a><br />
      									<a href="{$forumurl_q}filtertf_xtlc_con=Africa"><img src="images/africa.jpg" alt="" title="View Countries From Africa Continent" /></a>
      								</td>
      								<td class="trow1" style="text-align: center;">
      									<a href="{$forumurl_q}filtertf_xtlc_con=Europe"><strong>Europe</strong></a><br />
      									<a href="{$forumurl_q}filtertf_xtlc_con=Europe"><img src="images/europe.jpg" alt="" title="View Countries From Europe Continent" /></a>
      								</td>
      								<td class="trow1" style="text-align: center;">
      									<a href="{$forumurl_q}filtertf_xtlc_con=North America"><strong>North America</strong></a><br />
      									<a href="{$forumurl_q}filtertf_xtlc_con=North America"><img src="images/north_america.jpg" alt="" title="View Countries From North America Continent" /></a>
      								</td>
      								<td class="trow1" style="text-align: center;">
      									<a href="{$forumurl_q}filtertf_xtlc_con=Oceania"><strong>Oceania</strong></a><br />
      									<a href="{$forumurl_q}filtertf_xtlc_con=Oceania"><img src="images/oceania.jpg" alt="" title="View Countries From Oceania Continent" /></a>
      								</td>
      								<td class="trow1" style="text-align: center;">
      									<a href="{$forumurl_q}filtertf_xtlc_con=South America"><strong>South America</strong></a><br />
      									<a href="{$forumurl_q}filtertf_xtlc_con=South America"><img src="images/south_america.jpg" alt="" title="View Countries From South America Continent" /></a>
      								</td>
      							</tr>
      						</table>
      						{$searchforum}
      					</td>
      				</tr>
      			</table>
      			<br />
      		</td>
      	</tr>
      	<tr>
      		<td valign="top">
      			<table border="0" width="100%">
      				<tr>
      					{$threads}{$nullthreads}
      				</tr>
      			</table>
      			<div class="float_left">
      				{$multipage}
      			</div>
      			<div class="float_right">
      				{$newthread}
      			</div>
      		</td>
      	</tr>
      </table>
      <br style="clear: both;" />
      <br />
      <div class="float_right" style="text-align: right;">
      	{$inlinemod}
      </div>
      <br style="clear: both" />
      <div class="smalltext" align="center">
      	{$foruminfo['name']}<br />Powered By <a href="http://mybbhacks.zingaburga.com">XThreads</a> - <a href="http://mybbhacks.zingaburga.com">MyBB Hacks</a>
      </div>
      {$inline_edit_js}

      We put all continent filtering URL in this template. There is a img tag in each the continent filter. Modify the images URL and type as our needs.

    7. xtcl_forumdisplay_threads_sep

      HTML Code
      <td colspan="{$colspan}" style="display: none;"></td>
      </tr>
      <tr>

      Again, we need the <td> part to pass the validator, if there is a global announcement and there is no sticky thread in this forum.

    8. xtcl_forumdisplay_thread_null

      HTML Code
      <td width="33%" valign="top"></td>

    9. xtcl_postbit_first and xtcl_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
      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
      {$ignore_bit}
      <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" width="100%" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
      	<tr>
      		<td width="300" valign="top">
      			<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
      				<tr>
      					<td class="thead" valign="top" style="text-align: center;">
      						<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
      						<div class="largetext">{$post['subject']}</div>
      					</td>
      				</tr>
      				<tr>
      					<td class="trow1" valign="top" style="text-align: center;">
      						<div>{$GLOBALS['threadfields']['xtlc_flag']['value']}</div>
      					</td>
      				</tr>
      			</table>
      			<br />
      			<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
      				<tr>
      					<td class="thead" colspan="3" align="center">
      						<div class="largetext">Short Info</div>
      					</td>
      				</tr>
      				{$GLOBALS['threadfields']['xtlc_cap']}
      				{$GLOBALS['threadfields']['xtlc_cur']}
      				{$GLOBALS['threadfields']['xtlc_con']}
      				{$GLOBALS['threadfields']['xtlc_lang']}
      			</table>
      		</td>
      		<td valign="top">
      			<table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
      				<tr>
      					<td class="thead" colspan="3">
      						{$post['posturl']}
      						<span class="largetext">
      							<strong>Additional Info About {$post['subject']}</strong>
      						</span>
      					</td>
      				</tr>
      				<tr>
      					<td class="trow1" valign="top" colspan="3">
      						<div id="pid_{$post['pid']}" style="padding: 5px 0 5px 0;">
      							{$post['message']}
      						</div>
      						<div id="edited_by_{$post['pid']}">{$post['editedmsg']}</div>
      					</td>
      				</tr>
      				<tr valign="bottom">
      					<td align="right" class="tcat" colspan="3">
      						{$post['button_edit']}
      						{$post['button_quickdelete']}
      						{$post['button_quote']}
      						{$post['button_multiquote']}
      						{$post['button_report']}
      						{$post['button_warn']}
      					</td>
      				</tr>
      			</table>
      		</td>
      	</tr>
      </table>

    10. xtlyrics_forumdisplay_sticky_sep

      HTML Code
      <div><strong>Featured Songs</strong></div>

    11. xtcl_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
      <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=1400"></script>
      </head>
      <body>
      {$header}
      {$first_post}
      <br />
      <div align="center">
      	<strong>&laquo; <a href="{$next_oldest_link}">{$lang->next_oldest}</a> | <a href="{$next_newest_link}">{$lang->next_newest}</a> &raquo;</strong>
      </div>
      <br />
      <table border="0" cellspacing="0" cellpadding="{$theme['tablespace']}" class="tborder">
      	<tr>
      		<td class="thead largetext">
      			<div style="text-align: center;">
      				<strong>Discussions Of Users From {$thread['subject']}</strong>
      			</div>
      		</td>
      	</tr>
      	<tr>
      		<td class="trow1">
      			<div id="posts">
      				{$posts}
      			</div>
      		</td>
      	</tr>
      	<tr>
      		<td class="tfoot">
      			{$search_thread}
      		</td>
      	</tr>
      </table>
      <br class="clear" />
      <div class="float_left">
      	{$multipage}
      </div>
      <div style="padding-top: 4px;" class="float_right">
      	{$newreply}
      </div>
      <br style="clear: both;" />
      {$quickreply}
      <br />
      <div class="smalltext" align="center">
      	{$forum['name']}<br />Powered By <a href="http://mybbhacks.zingaburga.com">XThreads</a> - <a href="http://mybbhacks.zingaburga.com">MyBB Hacks</a>
      </div>
      <br class="clear" />
      <div class="float_right" style="text-align: right;">
      	{$moderationoptions}
      </div>
      <br style="clear: both;" />
      {$footer}
      </body>
      </html>

    12. xtcl_showthread_noreplies

      HTML Code
      <div id="xthreads_noreplies" style="text-align: center;">
      There is no discussions in this country
      </div>



Well, that is our simple Country List. Many information should be added to each country I think. But in this example, I only add Capital, Currency, Continent and Language.

Please tell me if I had made a mistake in the code above. I'm still learning Biggrin

Screenshot:

Showthread:
   

Threadlist:
   

Live Demo:
http://www.14.mynie.co.cc/forumdisplay.php?fid=47

(This post was last modified: 02-13-2011 03:21 AM by RateU.)
12-16-2010 12:53 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Country List - RateU - 12-16-2010 12:53 PM
RE: Country List - ZiNgA BuRgA - 12-16-2010, 12:58 PM
RE: Country List - RateU - 12-16-2010, 01:15 PM
RE: Country List - TriTop - 12-17-2010, 05:20 AM
RE: Country List - Imran - 12-17-2010, 07:04 AM
RE: Country List - Sector - 11-15-2012, 02:25 PM
RE: Country List - RateU - 11-16-2012, 04:33 AM
RE: Country List - Anil Gidwani - 07-22-2013, 02:37 AM
RE: Country List - ZiNgA BuRgA - 07-22-2013, 09:54 AM

 Standard Tools
Forum Jump: