Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-29-2004, 05:28 AM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Moving php embedded html to template and php file

Hi,

Ive got a php file with embedded html and I'm trying to convert this to work with the vb templates and files.

I'm trying to edit the member.php file and the memberinfo template to include this information.

I've added queries to the member.php file as follows:
Code:
$Con01=$DB_site->query("SELECT COUNT(*) as count FROM buster,usrbuster where buster.atoCon=usrcbuster.intCon and usrbuster.chrqualify ='Y' and buster.intCat in(1,2,3) and usrbuster.intplace=1 and usrbuster.strUsrId='$userinfo[username]'");
$num=$Con01['count'];
											
$Con02=$DB_site->query("SELECT COUNT(*) as count FROM buster,usrbuster where buster.atoCon=usrcbuster.intCon and usrbuster.chrqualify ='Y' and buster.intCat in(1,2,3) and usrbuster.intplace=2 and usrbuster.strUsrId='$userinfo[username]'");
$num2=$Con02['count'];
					
$Con03=$DB_site->query("select COUNT(*) as count from usrbuster where strusrid = '$userinfo[username]' and intPlace=3 order by intPlace ");
$num3=$Con02['count'];
					
$Con04=$DB_site->query("SELECT COUNT(*) as count FROM buster,usrbuster where buster.atoCon=usrcbuster.intCon and usrbuster.chrqualify ='Y' and buster.intCat in(1,2,3) and usrbuster.intplace=1 and usrbuster.strUsrId='$userinfo[username]'");
$num4=$Con04['count'];
All these queries work as best as I can tell, yes I know the strUsrId=$userinfo[username] apears like a contradiction, but it isn't.

Here's the code I'd like to get working with the php file and template:
If it's possible to jsut wrap all this code in a container variable that I can call in the template, that would work.
Code:
<?for($i =1 ; $i <= $num; $i++){ ?>
				<img border="0" src="../bb/images/1st_badge.gif" width="14" height="14" alt="First" />
				<?} for($i =1 ; $i <= $num2; $i++){ ?>
				<img border="0" src="../bb/images/2nd_badge.gif" width="14" height="14" alt="Second" />
				<?} for($i =1 ; $i <= $num3; $i++){ ?>
				<img border="0" src="../bb/images/3rd_badge.gif" width="14" height="14" alt="Third" />
				<?} for($i =1 ; $i <= $num4; $i++){ ?>
				<img border="0" src="../bb/images/cm_badgeA.gif" width="14" height="14" alt="fourth" />
				<?}?>
This code works when embedded into a php file but, I can't see to get the for statements to work with some sort of variable I can place in the template. I've tried placint a variable in the for statements and then setting each variable, then calling the variable in the template but that doesn't work.

Any help would be really appreciated.
Reply With Quote
  #2  
Old 08-29-2004, 05:38 PM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oka how about a while statement?

I've got this
Code:
$i=1;
while ($i <= $num):
print "<img border=\"0\" src=\"images/1st_badge.gif\" width=\"14\" height=\"14\" alt=\"First\" />";
$i++;
endwhile;
And I need to be able to call it in the template in order to place it. Right now it just places the images in the upper left corner of the page.

How can I define a variable for the while statement? Or have some what of telling the statement where to place it's image.
Reply With Quote
  #3  
Old 08-30-2004, 09:38 AM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

for($i =1 ; $i <= $num; $i++)
{
$var .='<img border="0" src="../bb/images/1st_badge.gif" width="14" height="14" alt="First" />';
}

for($i =1 ; $i <= $num2; $i++)
{
$var .='<img border="0" src="../bb/images/2nd_badge.gif" width="14" height="14" alt="Second" />';
}

for($i =1 ; $i <= $num3; $i++)
{
$var .='<img border="0" src="../bb/images/3rd_badge.gif" width="14" height="14" alt="Third" />';
}

for($i =1 ; $i <= $num4; $i++)
{
$var .='<img border="0" src="../bb/images/cm_badgeA.gif" width="14" height="14" alt="fourth" />';
}

for the second one, you just replace print with $var = " ... ";
Reply With Quote
  #4  
Old 08-30-2004, 05:32 PM
Jolten Jolten is offline
 
Join Date: Mar 2004
Posts: 749
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you! thank you! thank you! I was pulling hair out over this.

it was that pesky .=

I really can't thank you enough for the help Alex. You've made an entire community happy. I owe you one.
Reply With Quote
  #5  
Old 08-30-2004, 06:56 PM
rake's Avatar
rake rake is offline
 
Join Date: Nov 2002
Posts: 311
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad i was able to help.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:03 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03500 seconds
  • Memory Usage 2,196KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete