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 10-05-2014, 09:27 PM
dabvastur dabvastur is offline
 
Join Date: Nov 2013
Location: Santiago, Chile.
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Add PHP code in navbar template

Dears members of this community

I need help. I tried load php code in navbar template directly inserting code in template, to see that did not work, I started investigating.

When he was investigating, has led me to do the following:


and this is content of mostrarusers.php
PHP Code:
<?php

        
require_once("samp_query.php");
    
define(SERVER_IP"188.165.129.157");
    
define(SERVER_PORT7777);

$rQuery = new QueryServer(SERVER_IPSERVER_PORT);

        
$ainfo  $rQuery->GetInfo();
        
$aServerRules  $rQuery->GetRules();
        
$aBasicPlayer  $rQuery->GetPlayers();
        
$aTotalPlayers $rQuery->GetDetailedPlayers();
        
$playerlist $aTotalPlayers;
        echo 
"' . $aInformation['Players'] . '";
        
$rQuery->Close( );
        
?>
Regards and thanks
Reply With Quote
  #2  
Old 10-05-2014, 09:38 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try using hook location parse_templates instead.
Reply With Quote
  #3  
Old 10-05-2014, 09:59 PM
dabvastur dabvastur is offline
 
Join Date: Nov 2013
Location: Santiago, Chile.
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried, but not work.

I forgot mention that when I do, the forum shows white.

Thanks.
Reply With Quote
  #4  
Old 10-06-2014, 10:31 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do you also have a file called samp_query.php on your server? The code you posted tries to include that file. It looks like it's trying to get it from the same directory as the main script, so you might have to change the line in mostrarusers.php to something like:
Code:
require_once($_SERVER['DOCUMENT_ROOT'] . "/foro/samp_query.php");
Reply With Quote
  #5  
Old 10-06-2014, 12:44 PM
dabvastur dabvastur is offline
 
Join Date: Nov 2013
Location: Santiago, Chile.
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I upload samp_query.php in /forum/ but I don't add [document root] in requiere_once on mostrarusers.php.

I will comment when I get home.

Thanks.
Reply With Quote
  #6  
Old 10-06-2014, 01:20 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dabvastur View Post
I upload samp_query.php in /forum/ ...
That could be the right place, I'm not sure. If you add the path as above, then you'd want it in /foro, of course.
Reply With Quote
  #7  
Old 10-06-2014, 05:47 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

@Kh99, I do not want to interfere with your operation here, but this looks like "team speak" code (if you wanted to know) -- not that it directly relates to the problem being resolved. I leave him in your capable hands.
Reply With Quote
  #8  
Old 10-06-2014, 07:44 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tbworld View Post
@Kh99, I do not want to interfere with your operation here, but this looks like "team speak" code (if you wanted to know) -- not that it directly relates to the problem being resolved. I leave him in your capable hands.
No, please help if you can.
Reply With Quote
  #9  
Old 10-06-2014, 09:30 PM
dabvastur dabvastur is offline
 
Join Date: Nov 2013
Location: Santiago, Chile.
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I tried was said by @KH99 but does not work, the forum show white as before.

Content of mostrarusers.php
PHP Code:
<?php

    
require_once("samp_query.php");

    
define(SERVER_IP"188.165.129.157");
    
define(SERVER_PORT7777);

$rQuery = new QueryServer(SERVER_IPSERVER_PORT);

        
$ainfo  $rQuery->GetInfo();
        
$aServerRules  $rQuery->GetRules();
        
$aBasicPlayer  $rQuery->GetPlayers();
        
$aTotalPlayers $rQuery->GetDetailedPlayers();
        
$playerlist $aTotalPlayers;
        echo 
"' . $ainfo['Players'] . '";
        
$rQuery->Close( );
        
?>
Regards and thanks
Reply With Quote
  #10  
Old 10-08-2014, 04:04 PM
dabvastur dabvastur is offline
 
Join Date: Nov 2013
Location: Santiago, Chile.
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not is my intention pressure for obtain answer more faster or double post, but please don't forget help me with my problem. Thanks.
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:12 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06923 seconds
  • Memory Usage 2,266KB
  • Queries Executed 13 (?)
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
  • (1)bbcode_code
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete