Thread Rating:
  • 2 Votes - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Product Review
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #17
RE: Product Review
I have an idea, and I think I can use this example application for this purpose.

In the next XThreads version, v 1.4, XThreads supports language prefix. It means, if we want to change some default words to make it suitable for our application, we don't need to type it manually in our template. It will make XThreads more flexible and dynamic, especially if we have a non English forum, or, we want to change some custom thread fields from one of our XThreads application to other purpose. So, I think it is better if we make the custom thread fields title more "dynamic" too.

Right now, using this example applications as sample, I have an idea like this:

We need to edit these custom thread fields:
  1. Textbox for Product Name:
    Display Format:

    Code:
    <setvar pfname>htmlspecialchars_uni($GLOBALS['threadfield_cache']['pfname']['title'])</setvar>
    {VALUE}

    For displaying this custom thread field title, we need to put {$GLOBALS['tplvars']['pfname']} variable in our template.
    With this way, when we change the title of this field via Custom Thread Fields Edit Page, we don't need to change it in our template. The variable will "update" it automatically.

    We will do the same thing with other custom thread fields.

  2. Textbox for Developer:
    Display Format:

    Code:
    <setvar pfdev>htmlspecialchars_uni($GLOBALS['threadfield_cache']['pfdev']['title'])</setvar>
    {VALUE}

    For displaying this custom thread field title, we need to put {$GLOBALS['tplvars']['pfdev']} variable in our template.

  3. Textbox for Product Version:
    Display Format:

    Code:
    <setvar pfversion>htmlspecialchars_uni($GLOBALS['threadfield_cache']['pfversion']['title'])</setvar>
    {VALUE}

    For displaying this custom thread field title, we need to put {$GLOBALS['tplvars']['pfversion']} variable in our template.

  4. Textbox for Release (Year):
    Display Format:

    Code:
    <setvar pfrealese>htmlspecialchars_uni($GLOBALS['threadfield_cache']['pfrealese']['title'])</setvar>
    {VALUE}

    For displaying this custom thread field title, we need to put {$GLOBALS['tplvars']['pfrealese']} variable in our template.

  5. Multiline Textbox for Product Description:
    Display Format:

    Code:
    <setvar pfdesc>htmlspecialchars_uni($GLOBALS['threadfield_cache']['pfdesc']['title'])</setvar>
    {VALUE}

    For displaying this custom thread field title, we need to put {$GLOBALS['tplvars']['pfdesc']} variable in our template.

  6. Listbox for Categories:
    Display Format:

    Code:
    <setvar pfcat>htmlspecialchars_uni($GLOBALS['threadfield_cache']['pfcat']['title'])</setvar>
    {VALUE}

    For displaying this custom thread field title, we need to put {$GLOBALS['tplvars']['pfcat']} variable in our template.



Now, we need to edit some template, replacing the previous manual typed thread fields title with the variable above:
  1. pf_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
    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
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" width="100%">
    	<tr>
    		<td>
    			<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both;">
    				<tr>
    					<td class="thead" align="center" colspan="{$colspan}">
    						<div><strong><a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a></strong></div>
    					</td>
    				</tr>
    				<tr>
    					<td class="{$bgcolor}" width="1">
    						<div align="center">
    							<img src="{$GLOBALS['threadfields']['pfpic']['url']}/thumb320x240" alt="{$thread['subject']} Screenshot" title="{$thread['subject']} Screenshot" width="{$GLOBALS['threadfields']['pfpic']['thumbs']['320x240']['w']}" height="{$GLOBALS['threadfields']['pfpic']['thumbs']['320x240']['h']}" />
    						</div>
    					</td>
    					<td class="{$bgcolor}" width="100%">
    						<table border="0" width="100%">
    							<tr>
    								<td valign="top" width="120">{$GLOBALS['tplvars']['pfname']}</td>
    								<td width="1" valign="top">:</td>
    								<td valign="top">{$GLOBALS['GLOBALS['tplvars']']['pfname']}</td>
    							</tr>
    							<tr>
    								<td valign="top">{$GLOBALS['tplvars']['pfdev']}</td>
    								<td width="1" valign="top">:</td>
    								<td valign="top"><a href="{$GLOBALS['threadfields']['pfdevurl']}">{$GLOBALS['threadfields']['pfdev']}</a></td>
    							</tr>
    							<tr>
    								<td valign="top">{$GLOBALS['tplvars']['pfversion']}</td>
    								<td width="1" valign="top">:</td>
    								<td valign="top">{$GLOBALS['threadfields']['pfversion']}</td>
    							</tr>
    							<tr>
    								<td valign="top">{$GLOBALS['tplvars']['pfrealese']}</td>
    								<td width="1" valign="top">:</td>
    								<td valign="top">{$GLOBALS['threadfields']['pfrealese']}</td>
    							</tr>
    							<tr>
    								<td valign="top">{$GLOBALS['tplvars']['pfcat']}</td>
    								<td width="1" valign="top">:</td>
    								<td valign="top">{$GLOBALS['threadfields']['pfcat']}</td>
    							</tr>
    							{$rating}
    							<tr>
    								<td valign="top">{$lang->author}</td>
    								<td width="1" valign="top">:</td>
    								<td valign="top">{$thread['profilelink']}</td>
    							</tr>
    							<tr>
    								<td valign="top">{$lang->views}</td>
    								<td width="1" valign="top">:</td>
    								<td valign="top">{$thread['views']}</td>
    							</tr>
    							<tr>
    								<td valign="top">{$lang->replies}</td>
    								<td width="1" valign="top">:</td>
    								<td valign="top"><a href="javascript:MyBB.whoPosted({$thread['tid']});">{$thread['replies']}</a>{$unapproved_posts}</td>
    							</tr>
    						</table>
    					</td>
    					{$modbit}
    				</tr>
    			</table>
    		</td>
    		<td>&nbsp;</td>
    		<td valign="top" width="30%">
    			<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both;">
    				<tr>
    					<td class="thead" align="center" colspan="{$colspan}">
    						<div><strong>{$GLOBALS['tplvars']['pfdesc']}</strong></div>
    					</td>
    				</tr>
    				<tr>
    					<td valign="top" class="{$bgcolor}" width="300">
    						<div style="text-align: justify; padding: 3px;">
    							<span class="float_left" style="margin: 5px 5px 0px 0px;">
    								<img src="{$GLOBALS['threadfields']['pfpic']['url']}/thumb88x66" alt="{$thread['subject']} Screenshot" title="{$thread['subject']} Screenshot" width="{$GLOBALS['threadfields']['pfpic']['thumbs']['88x66']['w']}" height="{$GLOBALS['threadfields']['pfpic']['thumbs']['88x66']['h']}" />
    							</span>
    							{$GLOBALS['threadfields']['pfdesc']}
    						</div>
    						<br class="clear" />
    						<span class="float_right smalltext">
    							<em><a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>:
    							{$lastposterlink}, {$lastpostdate} {$lastposttime}</em>
    						</span>
    						<br class="clear" />
    						<span class="float_right smalltext">
    							<img src="{$theme['imgdir']}/{$folder}.gif" alt="{$folder_label}" title="{$folder_label}" />
    							{$icon}{$prefix}{$gotounread}
    						</span>
    					</td>
    				</tr>
    			</table>
    		</td>
    	</tr>
    </table>
    <br />

  2. pf_postbit_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
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    {$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="tcat">
    				<div class="float_left smalltext">
    					{$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span>
    				</div>
    				{$post['posturl']}
    			</td>
    		</tr>
    
    		<tr>
    			<td class="trow1 {$unapproved_shade}">
    				<table cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
    					<tr>
    						<td class="post_avatar" width="1" style="{$post['avatar_padding']}">
    							<img src="{$GLOBALS['threadfields']['pfpic']['url']}/thumb160x120" alt="" title="{$GLOBALS['threadfields']['pfname']}" />
    						</td>
    						<td class="post_author">
    							<table border="0" width="100%" class="smalltext">
    								<tr>
    									<td valign="top">{$GLOBALS['tplvars']['pfname']}</td>
    									<td width="1" valign="top">:</td>
    									<td valign="top">{$GLOBALS['threadfields']['pfname']}</td>
    								</tr>
    								<tr>
    									<td valign="top">{$GLOBALS['tplvars']['pfdev']}</td>
    									<td width="1" valign="top">:</td>
    									<td valign="top"><a href="{$GLOBALS['threadfields']['pfdevurl']}">{$GLOBALS['threadfields']['pfdev']}</a></td>
    								</tr>
    								<tr>
    									<td valign="top">{$GLOBALS['tplvars']['pfversion']}</td>
    									<td width="1" valign="top">:</td>
    									<td valign="top">{$GLOBALS['threadfields']['pfversion']}</td>
    								</tr>
    								<tr>
    									<td valign="top">{$GLOBALS['tplvars']['pfrealese']}</td>
    									<td width="1" valign="top">:</td>
    									<td valign="top">{$GLOBALS['threadfields']['pfrealese']}</td>
    								</tr>
    								<tr>
    									<td valign="top">{$GLOBALS['tplvars']['pfcat']}</td>
    									<td width="1" valign="top">:</td>
    									<td valign="top">{$GLOBALS['threadfields']['pfcat']}</td>
    								</tr>
    								<tr>
    									<td valign="top">Posted By</td>
    									<td width="1" valign="top">:</td>
    									<td valign="top">{$post['profilelink']}</td>
    								</tr>
    							</table>
    						</td>
    					</tr>
    				</table>
    			</td>
    		</tr>
    
    		<tr>
    			<td class="trow2 post_content {$unapproved_shade}">
    				<div class="largetext" align="center"><strong>{$post['subject']}</strong></div>
    
    				<div class="post_body" id="pid_{$post['pid']}">
    					{$post['message']}
    				</div>
    				{$post['attachments']}
    				{$post['signature']}
    
    				<div class="post_meta" id="post_meta_{$post['pid']}">
    				{$post['iplogged']}
    				</div>
    			</td>
    		</tr>
    
    		<tr>
    			<td class="trow1 post_buttons {$unapproved_shade}">
    				<div class="author_buttons float_left">
    					{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}
    				</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>



I didn't update the first post, because I need to know whether it is OK or not to use it Biggrin
The Live Demo for this application already use the code above.

12-02-2010 08:22 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Product Review - RateU - 05-15-2010, 02:16 AM
RE: Product Review - Pirata Nervo - 05-15-2010, 04:34 AM
RE: Product Review - leefish - 05-15-2010, 07:52 AM
RE: Product Review - ZiNgA BuRgA - 05-15-2010, 10:01 AM
RE: Product Review - RateU - 05-16-2010, 02:55 AM
RE: Product Review - leefish - 05-27-2010, 09:56 AM
RE: Product Review - RateU - 05-27-2010, 10:33 AM
RE: Product Review - leefish - 06-01-2010, 10:08 AM
RE: Product Review - RateU - 06-01-2010, 10:37 AM
RE: Product Review - leefish - 06-02-2010, 05:02 AM
RE: Product Review - ZiNgA BuRgA - 06-02-2010, 10:32 AM
RE: Product Review - RateU - 06-02-2010, 02:54 PM
RE: Product Review - leefish - 06-02-2010, 08:59 PM
RE: Product Review - ZiNgA BuRgA - 06-02-2010, 09:06 PM
RE: Product Review - RateU - 06-03-2010, 06:42 AM
RE: Product Review - RateU - 11-09-2010, 05:04 AM
RE: Product Review - bxx - 06-21-2011, 05:45 AM
RE: Product Review - RateU - 12-02-2010 08:22 AM
RE: Product Review - Glas - 03-23-2012, 10:47 AM
RE: Product Review - ZiNgA BuRgA - 12-08-2010, 04:06 PM
RE: Product Review - sanjananb - 02-16-2011, 03:42 AM
RE: Product Review - ZiNgA BuRgA - 06-21-2011, 07:29 AM
RE: Product Review - bxx - 06-21-2011, 04:59 PM
RE: Product Review - RateU - 10-23-2011, 05:13 AM
RE: Product Review - Shemo - 11-18-2011, 04:25 PM
RE: Product Review - ZiNgA BuRgA - 11-18-2011, 07:50 PM
RE: Product Review - Shemo - 11-19-2011, 03:04 AM
RE: Product Review - RocketFoot - 11-19-2011, 08:53 AM
RE: Product Review - RateU - 11-20-2011, 03:37 AM
RE: Product Review - Shemo - 11-20-2011, 10:26 AM
RE: Product Review - RateU - 11-21-2011, 04:02 AM
RE: Product Review - Shemo - 11-21-2011, 04:36 PM
RE: Product Review - RateU - 11-22-2011, 06:33 AM
RE: Product Review - Shemo - 12-19-2011, 05:01 PM
RE: Product Review - RocketFoot - 11-24-2011, 03:04 AM
RE: Product Review - RateU - 11-24-2011, 04:33 AM
RE: Product Review - RocketFoot - 11-24-2011, 04:39 AM
RE: Product Review - RateU - 11-24-2011, 05:01 AM
RE: Product Review - RocketFoot - 11-24-2011, 05:02 AM
RE: Product Review - RateU - 11-24-2011, 05:04 AM
RE: Product Review - RocketFoot - 11-24-2011, 05:08 AM
RE: Product Review - RateU - 11-24-2011, 05:17 AM
RE: Product Review - RocketFoot - 11-24-2011, 05:25 AM
RE: Product Review - RocketFoot - 11-24-2011, 06:02 AM
RE: Product Review - RocketFoot - 11-24-2011, 07:04 AM
RE: Product Review - RateU - 11-24-2011, 07:23 AM
RE: Product Review - RocketFoot - 11-24-2011, 08:36 AM
RE: Product Review - Shemo - 12-05-2011, 06:53 AM
RE: Product Review - RateU - 12-20-2011, 04:59 AM
RE: Product Review - Shemo - 12-21-2011, 04:14 PM
RE: Product Review - Glas - 03-23-2012, 11:50 AM
RE: Product Review - ZiNgA BuRgA - 03-23-2012, 12:07 PM
RE: Product Review - Glas - 03-23-2012, 12:19 PM
RE: Product Review - RateU - 03-24-2012, 04:57 AM
RE: Product Review - Glas - 03-24-2012, 06:57 AM
RE: Product Review - Divvy - 03-27-2012, 10:25 AM
RE: Product Review - Sama34 - 03-27-2012, 01:45 PM
RE: Product Review - ZiNgA BuRgA - 03-27-2012, 03:42 PM
RE: Product Review - TrailerReview - 05-10-2012, 03:54 AM
RE: Product Review - RateU - 05-10-2012, 04:17 AM
RE: Product Review - TrailerReview - 05-10-2012, 04:50 AM
RE: Product Review - TrailerReview - 05-10-2012, 05:25 AM
RE: Product Review - RateU - 05-10-2012, 05:05 AM
RE: Product Review - TrailerReview - 05-10-2012, 05:12 AM
RE: Product Review - RateU - 05-10-2012, 05:23 AM
RE: Product Review - RateU - 05-10-2012, 05:53 AM
RE: Product Review - TrailerReview - 05-10-2012, 06:02 AM
RE: Product Review - RateU - 05-10-2012, 06:17 AM
RE: Product Review - TrailerReview - 05-10-2012, 06:31 AM
RE: Product Review - RateU - 05-10-2012, 06:46 AM
RE: Product Review - TrailerReview - 05-10-2012, 07:00 AM
RE: Product Review - ZiNgA BuRgA - 05-10-2012, 10:44 AM
RE: Product Review - TrailerReview - 05-11-2012, 01:55 AM
RE: Product Review - RateU - 05-11-2012, 03:29 AM
RE: Product Review - TrailerReview - 05-11-2012, 03:52 AM
RE: Product Review - RateU - 05-11-2012, 03:56 AM
RE: Product Review - TrailerReview - 05-11-2012, 04:14 AM
RE: Product Review - RateU - 05-11-2012, 04:46 AM
RE: Product Review - TrailerReview - 05-11-2012, 04:59 AM
RE: Product Review - TrailerReview - 05-11-2012, 05:17 AM
RE: Product Review - RateU - 05-11-2012, 05:14 AM
RE: Product Review - RateU - 05-11-2012, 05:25 AM
RE: Product Review - TrailerReview - 05-11-2012, 05:32 AM
RE: Product Review - RateU - 05-11-2012, 05:40 AM
RE: Product Review - TrailerReview - 05-11-2012, 05:46 AM
RE: Product Review - cichociemny - 06-28-2012, 01:19 AM
RE: Product Review - RateU - 06-28-2012, 03:49 AM
RE: Product Review - cichociemny - 06-29-2012, 02:33 AM
RE: Product Review - RateU - 06-29-2012, 02:54 AM
RE: Product Review - Glas - 07-26-2012, 11:13 AM
RE: Product Review - Glas - 07-27-2012, 12:49 AM
RE: Product Review - RateU - 07-27-2012, 01:20 AM
RE: Product Review - Glas - 07-27-2012, 01:48 AM
RE: Product Review - RateU - 07-27-2012, 03:03 AM
RE: Product Review - Glas - 07-27-2012, 04:14 AM
RE: Product Review - glhowe1 - 09-15-2012, 04:34 AM
RE: Product Review - ZiNgA BuRgA - 09-15-2012, 09:37 AM
RE: Product Review - glhowe1 - 09-15-2012, 09:59 AM
RE: Product Review - glhowe1 - 09-15-2012, 10:54 AM
RE: Product Review - glhowe1 - 09-15-2012, 01:21 PM
RE: Product Review - ZiNgA BuRgA - 09-15-2012, 03:56 PM
RE: Product Review - glhowe1 - 09-15-2012, 10:21 PM
RE: Product Review - RateU - 10-08-2012, 02:36 AM
RE: Product Review - nier3 - 10-18-2012, 11:59 PM
RE: Product Review - RateU - 10-20-2012, 01:07 AM
RE: Product Review - Glas - 11-23-2012, 02:20 AM
RE: Product Review - RateU - 12-12-2012, 06:20 AM
RE: Product Review - RateU - 01-03-2013, 03:10 AM
RE: Product Review - Shemo - 02-19-2013, 04:55 AM
RE: Product Review - ZiNgA BuRgA - 02-19-2013, 09:53 AM
RE: Product Review - Shemo - 02-19-2013, 02:36 PM
RE: Product Review - RateU - 02-20-2013, 02:38 AM
RE: Product Review - Shemo - 02-20-2013, 03:04 AM
RE: Product Review - RateU - 02-20-2013, 04:58 AM
RE: Product Review - Matteo Russo - 04-01-2013, 09:34 AM
RE: Product Review - ZiNgA BuRgA - 04-01-2013, 10:35 AM
RE: Product Review - Matteo Russo - 04-01-2013, 09:08 PM
RE: Product Review - ZiNgA BuRgA - 04-01-2013, 10:58 PM
RE: Product Review - Shemo - 04-10-2013, 01:12 AM
RE: Product Review - RateU - 04-10-2013, 05:22 AM
RE: Product Review - Shemo - 04-10-2013, 05:33 AM
RE: Product Review - Glas - 01-27-2014, 02:53 PM
RE: Product Review - ZiNgA BuRgA - 01-27-2014, 03:49 PM
RE: Product Review - Glas - 01-28-2014, 05:23 AM
RE: Product Review - Glas - 02-22-2014, 11:22 AM
RE: Product Review - ZiNgA BuRgA - 02-22-2014, 01:42 PM
RE: Product Review - Glas - 02-23-2014, 02:43 AM
RE: Product Review - jason07 - 02-18-2015, 11:28 PM
RE: Product Review - ZiNgA BuRgA - 02-23-2015, 05:10 PM
RE: Product Review - jason07 - 02-28-2015, 11:53 PM
RE: Product Review - ZiNgA BuRgA - 03-01-2015, 05:20 PM
RE: Product Review - adsol93 - 05-07-2015, 10:37 PM
RE: Product Review - adsol93 - 05-07-2015, 11:50 AM
RE: Product Review - ZiNgA BuRgA - 05-07-2015, 01:42 PM
RE: Product Review - beartest - 06-27-2015, 11:52 PM
RE: Product Review - ZiNgA BuRgA - 06-28-2015, 01:22 PM
RE: Product Review - beartest - 06-29-2015, 12:24 PM
RE: Product Review - Marisa - 03-11-2016, 07:02 PM
RE: Product Review - habbla - 03-12-2016, 01:14 AM
RE: Product Review - ZiNgA BuRgA - 03-12-2016, 08:01 AM
RE: Product Review - Marisa - 03-13-2016, 09:49 AM
RE: Product Review - ZiNgA BuRgA - 03-14-2016, 05:44 PM
RE: Product Review - Marisa - 03-14-2016, 07:53 PM
RE: Product Review - ZiNgA BuRgA - 03-15-2016, 09:56 AM
RE: Product Review - Marisa - 03-15-2016, 10:14 PM
RE: Product Review - nolie - 12-31-2016, 11:19 PM
RE: Product Review - crow - 03-06-2018, 07:28 AM
RE: Product Review - ZiNgA BuRgA - 03-06-2018, 10:05 AM
RE: Product Review - crow - 03-06-2018, 10:40 AM
RE: Product Review - RateU - 03-06-2018, 10:20 PM
RE: Product Review - glaukos - 04-12-2019, 07:27 PM
RE: Product Review - RateU - 04-13-2019, 01:35 AM

 Standard Tools
Forum Jump: