Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Rounding a template var.
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #5
RE: Rounding a template var.
The simpler expression is working, but the one in the forumdisplay thread template is not. I tested by deactivating XThreads and then using the simpler expression you provided in the header. I got the output blah.

This is my code from the forumdisplay_thread, all threadfields values at 4:

Code:
1
2
3
4
5
6
7
8
9
<li><label>Author's Rating: </label><setvar r>$GLOBALS['threadfields']['pfrating1']+$GLOBALS['threadfields']['pfrating2']+$GLOBALS['threadfields']['pfrating2']</setvar>
<setvar q>$tplvars['r']/3</setvar>

{$tplvars['q']}
{$tplvars['r']}
123<?=substr("987654321", 3)?>
<?=round($tplvars['q']*2)/2?>

</li>


The output is:

4 (correct)
12 (correct)
123 - NOT correct
blank

I am not sure how to use globals instead, but as the example from the first post in the Template Conditionals download failed then I am stumped. I am using XThreads custom fields in a prefixed template.

I tested this expression 123<?=substr("987654321", 3)?>  in the header - and it returned 123.



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 04-21-2013 08:23 PM by leefish.)
04-21-2013 08:19 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Rounding a template var. - leefish - 04-21-2013, 04:42 AM
RE: Rounding a template var. - ZiNgA BuRgA - 04-21-2013, 04:58 PM
RE: Rounding a template var. - leefish - 04-21-2013, 06:17 PM
RE: Rounding a template var. - ZiNgA BuRgA - 04-21-2013, 07:30 PM
RE: Rounding a template var. - leefish - 04-21-2013 08:19 PM
RE: Rounding a template var. - ZiNgA BuRgA - 04-21-2013, 09:39 PM
RE: Rounding a template var. - leefish - 04-21-2013, 09:47 PM
RE: Rounding a template var. - leefish - 05-05-2013, 02:20 AM
RE: Rounding a template var. - ZiNgA BuRgA - 05-05-2013, 10:09 PM
RE: Rounding a template var. - leefish - 05-10-2013, 02:36 AM
RE: Rounding a template var. - ZiNgA BuRgA - 05-10-2013, 09:37 AM
RE: Rounding a template var. - leefish - 05-10-2013, 06:04 PM
RE: Rounding a template var. - ZiNgA BuRgA - 05-12-2013, 11:04 AM
RE: Rounding a template var. - leefish - 05-12-2013, 11:48 PM
RE: Rounding a template var. - ZiNgA BuRgA - 05-13-2013, 02:11 PM
RE: Rounding a template var. - leefish - 05-13-2013, 09:25 PM
RE: Rounding a template var. - ZiNgA BuRgA - 05-14-2013, 09:34 AM
RE: Rounding a template var. - leefish - 05-14-2013, 06:48 PM

 Standard Tools
Forum Jump: