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

Reply
 
Thread Tools Display Modes
  #1  
Old 12-28-2009, 11:15 PM
zanthor zanthor is offline
 
Join Date: Dec 2009
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Updating Mod to v4... while not iterating?

So I've gone through and fixed the template, and I've gone through the PHP and something isn't right...

Before:
PHP Code:
while ($player $db->fetch_array($res))
{
    
// code excluded

    
eval('$rosterbits .= "' fetch_template('gwr_roster_bit') . '";');

With this code it dumped out the full roster of my guild.

After:
PHP Code:
while ($player $db->fetch_array($res))
{
    
// Code Excluded

    
$templater vB_Template::create('gwr_roster_bit');
    
$templater->register_page_templates();
    
$templater->register('player'$player);
    
$templater->register('gwr_phrase'$gwr_phrase);
    
$templater->register('guild'$guild);
    
$templater->register('armory'$armory);
    
print_output($templater->render());

With this code it only dumps the first character.

I'm sure I'm doing something wrong, but I'm not sure what.
Reply With Quote
  #2  
Old 12-29-2009, 12:38 AM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What about trying the render line outside of the loop and changing the first line of your while loop to:

$templater .= vB_Template::create('gwr_roster_bit');

I'm not sure if that wold work exactly but I think that's closer to what you need. I think you just need the render line to be called once and that you jsut append to the $templater variable each loop.

i.e.

PHP Code:
while ($player $db->fetch_array($res))
{
    
// Code Excluded

    
$templater .= vB_Template::create('gwr_roster_bit');
    
$templater->register_page_templates();
    
$templater->register('player'$player);
    
$templater->register('gwr_phrase'$gwr_phrase);
    
$templater->register('guild'$guild);
    
$templater->register('armory'$armory);
}
print_output($templater->render()); 
Like I said though I'm not sure if that's exactly what you need or if you'll need to still register those variables in each loop. But it should at least be a step in the right direction.
Reply With Quote
  #3  
Old 12-29-2009, 12:50 AM
zanthor zanthor is offline
 
Join Date: Dec 2009
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This was the direction I took, and it's working quite well...

I'm in the middle of totally rewriting the template now in a consolidated template, but HTML is actually my weakness!

Anyhow in the php I setup a player_data array and added the players to it, registered that, etc... and called the render once.
Reply With Quote
  #4  
Old 12-29-2009, 12:54 AM
consolegaming consolegaming is offline
 
Join Date: Jan 2007
Posts: 168
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sounds cool, good luck with it. Hope it goes well.

BTW if you plan to release this updated mod once your done I'd check with the original coder of the mod (assuming you aren't the originator as you have no mods posted) before doing so.
Reply With Quote
  #5  
Old 12-29-2009, 02:12 AM
zanthor zanthor is offline
 
Join Date: Dec 2009
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by consolegaming View Post
Sounds cool, good luck with it. Hope it goes well.

BTW if you plan to release this updated mod once your done I'd check with the original coder of the mod (assuming you aren't the originator as you have no mods posted) before doing so.
Current plans are to e-mail the code back to him once I'm done... of course I like the idea better where he beats me to the punch and releases before me!
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 09:55 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.07838 seconds
  • Memory Usage 2,210KB
  • 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_php
  • (1)bbcode_quote
  • (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