The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Adding a counter for template conditionals
Hi,
I have a simple script that lists the users with the highest reputation. I want to add the avatars of the top three results. I figure the best way was to use a template conditional like <if condition="count > 3">no avatar</else>avatar</if>. So can I accomplish this in this script: PHP Code:
|
#2
|
|||
|
|||
up.
|
#3
|
||||
|
||||
You probably need to grab more than the avatarvision in order to output the avatar.... unless you have the avatars in the file system - do you? Where are you wanting to put this condition?
Template: HTML Code:
<if condition="$count > 3"> whatever </if> PHP Code:
|
#4
|
|||
|
|||
Revisting an old thread here, and I will try and reword it better as my needs have changed slightly.
Basically I have some code outputs a list of users based on the column 'credits' in the 'user' table, ie: PHP Code:
1. exampleuserA 2. exampleuserB 3. exampleuserC So I can add some sort of variable to my template like $user[count]. I want to be able to user conditionals like <if condition="$user[count] == 1 <span class="bigusername">exampleuserA</span></if> I hope it makes more sense now. PHP Code:
|
#5
|
||||
|
||||
I'm not sure of exactly what you want, but maybe this is kinda it:
PHP Code:
|
#6
|
|||
|
|||
lynne it works perfectly, ty so much once again. if IB isnt paying you they should be and if they are you deserve a raise!
|
#7
|
|||
|
|||
Hi lynne,
revisting this thread once again. I have a different script but I ma trying to accomplish the same thing. What am I doing wrong here: Code:
<?php // ############# HASANN AND BLACKTHORN TOP REPUTATION MODULE ############ // // BLACKTHORN CODING // // vBA CMPS Module - vBulletin 4.0.X // // All rights reserved 2010 ? // // http://www.metalturkiye.com // // http://www.vBulletin-TR.com // // ############# HASANN AND BLACKTHORN TOP REPUTATION MODULE ############ // // ------------------------------------------------------------------------------ // Code written by Hasann. vB4 Convert and edited and updated by BlackThorn(c) 2009 // Copy and/or re-use of this code (or part of it) without authors approval in writing is forbidden. // BT - Top Reputation Display Module Core Codes Starting $limit = $mod_options['portal_top_reputation_count']; // BT - Top Reputation SQL Query start. $top_reputations = $db->query(" SELECT userid, username, posts, credits, usergroupid, IF(displaygroupid=0, usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "user AS user WHERE credits > 0 ORDER BY credits DESC LIMIT 0, $limit "); // BT - Top Reputation Module SQL Query the end. $bgclass = "alt2"; $count = 0; while($top_reputation = $db->fetch_array($top_reputations)){ $count++; $bgclass = exec_switch_bg(); $top_reputation[musername] = fetch_musername($top_reputation); // BT - Top Reputation Module Template Registers $templater = vB_Template::create('adv_portal_top_reputations_bit'); $templater->register('bgclass',$bgclass); $templater->register('mod_options',$mod_options); $templater->register('top_reputation',$top_reputation); $blackthorn_top_reputation_bit .= trim($templater->render()).' '; } $db->free_result($top_reputations); // BT - Top Reputation Module Template Registers and HOOK(s) $templater = vB_Template::create('adv_portal_top_reputations'); $templater->register('mod_options',$mod_options); $templater->register('top_reputations',$top_reputations); $templater->register('blackthorn_top_reputation_bit',$blackthorn_top_reputation_bit); $home["$mods[modid]"]['content'] = $templater->render(); // BT - Top Reputation module module core codes and UNSET. unset($top_reputation, $top_reputations, $blackthorn_top_reputation_bit, $limit, $mod_options); ?> |
#8
|
|||
|
|||
Bump. anybody help a brother out here?
|
#9
|
|||
|
|||
Another bump.
Someone has to know how I can do this, it seems so simple on the surface. I cant figure out why it works in the first script I posted but in the 2nd very similar script it doesnt. Can someone please have a look for me? |
#10
|
|||
|
|||
Well, for one thing the second script is for vB 4.0 (but maybe you know that?).
It might help if you said more about what it's doing and what's going wrong. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|