vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Add PHP code in navbar template (https://vborg.vbsupport.ru/showthread.php?t=314723)

dabvastur 10-05-2014 09:27 PM

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:
https://vborg.vbsupport.ru/external/2014/10/17.png

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

kh99 10-05-2014 09:38 PM

Try using hook location parse_templates instead.

dabvastur 10-05-2014 09:59 PM

I tried, but not work.

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

Thanks.

kh99 10-06-2014 10:31 AM

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");

dabvastur 10-06-2014 12:44 PM

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.

kh99 10-06-2014 01:20 PM

Quote:

Originally Posted by dabvastur (Post 2517869)
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.

tbworld 10-06-2014 05:47 PM

@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. :)

kh99 10-06-2014 07:44 PM

Quote:

Originally Posted by tbworld (Post 2517912)
@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.

dabvastur 10-06-2014 09:30 PM

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

dabvastur 10-08-2014 04:04 PM

Not is my intention pressure for obtain answer more faster or double post, but please don't forget help me with my problem. Thanks.


All times are GMT. The time now is 08:12 AM.

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.01699 seconds
  • Memory Usage 1,746KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete