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 12-21-2007, 11:15 PM
!!!cyr0n_k0r !!!cyr0n_k0r is offline
 
Join Date: Apr 2002
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default help with phrases.. what are {1} ??

Code:
There have been <b>{1}</b> post{7} and <b>{2}</b> thread{8} since your last visit at {3}.
The above is part of a phrase. I am trying to use on a non VB page. I have all the correct backend stuff, as everything shows up correctly when calling the phrase, however the things inside {1}, {7} which should be numbers aren't being displayed.

What are these things?
I'm new to coding in VB 3.5.x and have been out of the loop for several years.
Reply With Quote
  #2  
Old 12-21-2007, 11:22 PM
Guest190829
Guest
 
Posts: n/a
Default

It's a wrapper for the sprintf function, basically those are the inputted variables that are inserted into the phrase. The number inside the {} is based on the order of the parameters of the vbphrase function. (Which I can't remember off the top of my head)

construct_phrase() maybe...
Reply With Quote
  #3  
Old 12-21-2007, 11:48 PM
!!!cyr0n_k0r !!!cyr0n_k0r is offline
 
Join Date: Apr 2002
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

and where can I find these sprintf functions? Where can they be edited?

Also, why aren't they showing up on a non-VB page when everything else VB related does. I can call for templates and phrases, but these wrappers don't work.
Reply With Quote
  #4  
Old 12-22-2007, 12:02 AM
Guest190829
Guest
 
Posts: n/a
Default

Here is the info:

Quote:
construct_phrase (line 2107)
Construct Phrase
this function is actually just a wrapper for sprintf but makes identification of phrase code easier and will not error if there are no additional arguments. The first parameter is the phrase text, and the (unlimited number of) following parameters are the variables to be parsed into that phrase.
  • return: The parsed phrase
string construct_phrase (string 0, mixed 1, mixed 2)
  • string 0: Text of the phrase
  • mixed 1: First variable to be inserted
  • mixed 2: Nth variable to be inserted
You need to call that and add the appropriate values with PHP (A plugin or inside the php file you are using)
Reply With Quote
  #5  
Old 12-22-2007, 12:25 AM
!!!cyr0n_k0r !!!cyr0n_k0r is offline
 
Join Date: Apr 2002
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!

For people ever having the same issues this is the fix.

Code:
<phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
Notice the 1="blah blah"

That would be what is filled into {1}

and so on.

--------------- Added [DATE]1198292190[/DATE] at [TIME]1198292190[/TIME] ---------------

Well, it seems some work and some don't. Can anyone shed light as to why the second group of wrappers aren't working?

PHP Code:
<phrase 1="{$bbuserinfo['posts']}">$vbphrase[kor_comments]</phrase><br><br>
<
phrase 1="{$numbermembers}2="$totalthreads3="$totalposts">$vbphrase[kor_forum_stats]</phrase
The first phrase works fine, the one that calls for $bbuserinfo[posts]

But the second group of stats aren't working. $totalposts, etc.

I have installed the "Welcome Panel Rewrite" hack and the stats work on the index.php, but on my own custom page, they numbers aren't showing up, just the text.
Reply With Quote
  #6  
Old 12-22-2007, 01:58 AM
Guest190829
Guest
 
Posts: n/a
Default

The are not working because they only have scope within the plugins of the Member Rewrite modifications. You are either going to have to duplicate code or create your own variation of it.
Reply With Quote
  #7  
Old 12-22-2007, 03:04 AM
!!!cyr0n_k0r !!!cyr0n_k0r is offline
 
Join Date: Apr 2002
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The hack doesn't modify PHP files or templates though. So how is it that it will work in index.php, but not my page?

What needs to be called to allows those phrases to work?

--------------- Added [DATE]1198300451[/DATE] at [TIME]1198300451[/TIME] ---------------

Also, it can't be the hack, because there is a built in vbulletin variable for total number of members registered.

$numbermembers


However, even when I call that it still isn't working.
Reply With Quote
  #8  
Old 12-22-2007, 03:16 AM
Guest190829
Guest
 
Posts: n/a
Default

Okay, even it they are default vBulletin variables, they are out of scope with your custom script.
Reply With Quote
  #9  
Old 12-22-2007, 04:13 AM
!!!cyr0n_k0r !!!cyr0n_k0r is offline
 
Join Date: Apr 2002
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

correct

Here is the solution for anyone searching.

PHP Code:
// ### BOARD STATISTICS #################################################

// get total threads & posts from the forumcache
$totalthreads 0;
$totalposts 0;
if (
is_array($vbulletin->forumcache))
{
    foreach (
$vbulletin->forumcache AS $forum)
    {
        
$totalthreads += $forum['threadcount'];
        
$totalposts += $forum['replycount'];
    }
}
$totalthreads vb_number_format($totalthreads);
$totalposts vb_number_format($totalposts);

// get total members and newest member from template
$numbermembers vb_number_format($vbulletin->userstats['numbermembers']);
// ### BOARD STATISTICS ################################################# 
Add this code to your custom PHP file.

Also include this:
PHP Code:
require_once(DIR '/includes/functions_forumlist.php');
cache_ordered_forums(1); 
Add that below require global.
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 07:58 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.05448 seconds
  • Memory Usage 2,242KB
  • 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
  • (2)bbcode_code
  • (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
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (5)postbit_onlinestatus
  • (9)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