vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Create your own vBulletin page (https://vborg.vbsupport.ru/showthread.php?t=228112)

kh99 12-08-2011 03:12 AM

I guess it wasn't cookies then - it was just a thought.

Rocket2009 12-08-2011 03:46 PM

Thanks for the try:

As Lynne suggested, I tried adding:

Code:

<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
near the top of my template. When the page is rendered and I view the page source it gets implemented as:

Code:

<input type="hidden" name="securitytoken" value="guest" />
And consistent with not being properly logged in on this page I see the following in the page source.

Code:

<script type="text/javascript">
<!--
        var SESSIONURL = "";
        var SECURITYTOKEN = "guest";
        var IMGDIR_MISC = "images/misc";
        var IMGDIR_BUTTON = "images/buttons";
        var vb_disable_ajax = parseInt("0", 10);
        var SIMPLEVERSION = "418";
        var BBURL = "http://www.touringmotorgliders.org";
        var LOGGEDIN = 0 > 0 ? true : false;
        var THIS_SCRIPT = "knowledgebase";
        var RELPATH = "kb/knowledgebase.php";
        var PATHS = {
                forum : "",
                cms  : "",
                blog  : ""
        };
        var AJAXBASEURL = "http://www.touringmotorgliders.org/kb/";
// -->
</script>

I am still looking for that command to put into the code (index.php of KBPublisher, knowledgebase.php, or my template) to get me logged into the vBulletin system.

Lynne 12-08-2011 04:16 PM

If it isn't recognizing you, then the global.php file isn't getting called/included correctly.

Rocket2009 12-08-2011 05:11 PM

Yes, I agree that I am having trouble getting global.php called correctly through this rendering system.

I have tried adding

Code:

chdir ('/home/touring7/public_html/');
require_once('./global.php');

to /kb/index.php
to /kb/knowledgebase.php
and directly to the template in my style called KBPublisher (if you are following my earlier post)

and I have had no luck.

If I just load knowledgebase.php at the browser, I am logged in fine.

As you recall from earlier post, kb/index.php calls /kb/knowledgebase.php as a kb template which then calls the vB template KBPublisher. Everything displays as expected but I am not logged in.

I even tried defining a tag called {global_load} to try and insert an additional call to global.php by inserting the php code to no avail.

Two ideas:

(1) Do I need to 'register' a page such as /kb/index.php?

(2) Perhaps I could call global.php at /kb/index.php to define security tokens and etc and then pass that code via a tag to the vbulletin template via the /kb/index.php rendering system. Suggestions for what form that code should take?

Please help me get the global.php called and working correctly.

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

I am continuing to experiment and I might be close, if I can get some help:

In the /kb/input.php I place the following code:

Code:

$curdir = getcwd ();
chdir('/home/touring7/public_html/');
require_once('./global.php');
chdir ($curdir);
.
.
.

$page->assign('global_load',$vbulletin->userinfo['securitytoken']);

I have a tag I created in my template called {global_load} which renders the page correctly but on top of the page it prints out the security token obtained from the global call /kb/index.php. So this verifies that I can pass a global variable (security token) through the rendering process.

Can someone suggest a way I can get that rendered page to accept the security token so it will see me as logged in?

Thanks.

Easy5s.net 12-12-2011 07:44 AM

PHP Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT''premade');

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

?>

and error:

Unable to add cookies, header already sent.
File: premade.php
Line: 1

:confused:

Lynne 12-12-2011 04:46 PM

Quote:

Originally Posted by Easy5s.net (Post 2277007)
PHP Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT''premade');

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

?>

and error:

Unable to add cookies, header already sent.
File: premade.php
Line: 1

:confused:

That isn't going to work. You need to follow the tutorial.

JimxJNM 12-21-2011 07:18 AM

This is Great man Thanks for the Lynne :D i will try this out,

Papa Bear 12-24-2011 11:19 PM

Excellent..Works great.

Okuma Steve 12-30-2011 03:32 AM

I am having a small problem and want to see if anyone can assist me.

I am trying to create a list with HTML and it isn't recognizing it, any ideas?

Here is a sample of what I am putting in:

<ul>
<li> item name </li>
<li> item name </li>
</ul>

I used the same code in making a new faq item and it worked fine, but not working in this form.

Link to faq item:

http://www.theoutdoorstrader.com/faq.php?faq=supporter

Link to new form:

http://www.theoutdoorstrader.com/supporter.php

HMBeaty 12-30-2011 04:10 AM

You need to make the css for ul and li ;)

Okuma Steve 12-30-2011 04:56 AM

Quote:

Originally Posted by HMBeaty (Post 2282098)
You need to make the css for ul and li ;)

Could you translate that into "idiot" for me? :D

HMBeaty 12-30-2011 05:06 AM

Hmm....I stand corrected.... Looking back on a few of my custom pages, I have them working just fine using what you have above. Do you mind posting what you have in your entire template?

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

Also, your php file so we can make sure everything is correct in there :)

Okuma Steve 12-30-2011 05:37 AM

Here is my php file:

PHP Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT''supporter');
define('CSRF_PROTECTION'true);  
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('supporter',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits construct_navbits(array('' => 'Supporter Info'));
$navbar render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle 'Become a Supporter!';

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater vB_Template::create('supporter');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle'$pagetitle);
print_output($templater->render());

?>

--------------- Added 29 Dec 2011 at 22:39 ---------------

And here is my template:

(Please pardon my first grade understanding of html!)

HTML Code:

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
  <head>
    <title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
    {vb:raw headinclude}
    {vb:raw headinclude_bottom}
  </head>
  <body>
   
    {vb:raw header}
   
    {vb:raw navbar}
   
    <div id="pagetitle">
      <h1>{vb:raw pagetitle}</h1>
    </div>
   
    <h2 class="blockhead">Supporter Info</h2>
    <div class="blockbody">
      <div class="blockrow">
<p>Become a Supporter! </p>
<br />
<font size="2"><p><b>What is a Supporter? </b></p></font>
<br />
<p>A supporter is someone who donates to the site to help keep it up and running. Currently the majority of revenue for the site is generated from the little bit of advertising we allow and donations from our users. </p>
<br />
<br />
<font size="2"><p><b>How much is it?</b> </p></font>
<br />
<p>The current cost to become a supporter: </p>
<br />
<ul>
<li><p>1 year - $15</p></li>
<br />
<li><p>2 years - $30</p></li>
<br />
<li><p>5 years - $50</p></li>
<br />
<li><p>15 years - $100</p></li>
</ul>
<br />
<br />
<font size="2"><p><b>What’s in it for me? </b></p></font>
<br />
<p>We do have additional benefits for anyone that becomes a supporter, and may add more in the future. The benefits only last as long as your subscription length, but you can re-up anytime.</p>
<br />
<p>The current upgrades are: </p>
<br />
<ul>
<li>Larger Private Message inbox! Supporter’s inboxes can hold up to 1,000 messages! </li><br />

<li>A new icon to go under your user name when you post. It looks like this: </li> <br />

<img src=http://www.theoutdoorstrader.com/images/ranks/supporter1.png width="130" height="30"/>
</ul>
<br />
<br />
<br />
<font size="2"><p><b>Sign me up!</b></p></font>

<br />
<p>If you would like to become a supporter you can click the banner below and it will take you to your “paid subscriptions” page in your profile. </p>
<br />
<p>Once there, just select a subscription length in the dropdown box and click “order.” Then it will take you to a screen where you will select your payment method. Currently the only method accepted is paypal. You do not have to have an account with paypal to use it. </p>
<br />
<p>If you would prefer to send a check or money order, you can mail it to the address listed at the bottom of this article. Please be sure to include your username with your check so we know which account to credit the donation to. </p>
<br />
<a href=http://www.theoutdoorstrader.com/payments.php > <img src=http://www.theoutdoorstrader.com/images/donate.png /> </a>
<br />
<br />
<p><b> Mailing Address for Donations:</b> </p>
<br />
<p>The Outdoors Trader
<br />PO Box 813669
<br />Smyrna, GA 30081 </p>
<br />
<p></p>
<br />
<font size="2"><p><b>What if I am already a supporter and want to donate? </b></p></font>
<br />
<p>Well, that’s awesome! We appreciate it very much! </p>
<br />
<p>If you are already a supporter and would like to donate more, you can do so by clicking the paypal link below and entering whatever amount you would like to donate. </p>
<br />
<p>Again, thank you very much! </p>
<br />
<br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="PVCDABEX7X7TA">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
   
      </div>
    </div>
   
    {vb:raw footer}
  </body>
</html>


Lynne 12-30-2011 05:00 PM

Quote:

Originally Posted by Okuma Steve (Post 2282094)
I am having a small problem and want to see if anyone can assist me.

I am trying to create a list with HTML and it isn't recognizing it, any ideas?

Here is a sample of what I am putting in:

<ul>
<li> item name </li>
<li> item name </li>
</ul>

I used the same code in making a new faq item and it worked fine, but not working in this form.

Link to faq item:

http://www.theoutdoorstrader.com/faq.php?faq=supporter

Link to new form:

http://www.theoutdoorstrader.com/supporter.php

This has already been covered in this thread. Here's one of the posts - https://vborg.vbsupport.ru/showpost....&postcount=150 You can go backwards to read the whole conversation.

Okuma Steve 12-30-2011 07:00 PM

I think I understand now, but I still can't get it to work.

I pasted the style code into the header of my template, is that right?

Here is my current template:

HTML Code:


{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
  <head>
    <title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
    {vb:raw headinclude}
    {vb:raw headinclude_bottom}


<style type="text/css">
strong {font-weight:bold;}
ul.unordered li {list-style-type: disc;list-style-position:inside; display: list-item; margin-left: 2.5em; padding-left: 0;}

ul.unordered ul li {list-style-type: circle; display: list-item;margin-left: 2.5em; padding-left: 0;}
</style>


  </head>
  <body>
   
    {vb:raw header}
   
    {vb:raw navbar}
   
    <div id="pagetitle">
      <h1>{vb:raw pagetitle}</h1>
    </div>
   
    <h2 class="blockhead">Supporter Info</h2>
    <div class="blockbody">
      <div class="blockrow">

<p>Become a Supporter! </p>
<br />
<font size="2"><p><b>What is a Supporter? </b></p></font>
<br />
<p>A supporter is someone who donates to the site to help keep it up and running. Currently the majority of revenue for the site is generated from the little bit of advertising we allow and donations from our users. </p>
<br />
<br />
<font size="2"><p><b>How much is it?</b> </p></font>
<br />
<p>The current cost to become a supporter: </p>
<br />
<ul>
<li><li><p>1 year - $15</p></li>
<br />
<li><p>2 years - $30</p></li>
<br />
<li><p>5 years - $50</p></li>
<br />
<li><p>15 years - $100</p></li>
</ul></il>
<br />
<br />
<font size="2"><p><b>What?s in it for me? </b></p></font>
<br />
<p>We do have additional benefits for anyone that becomes a supporter, and may add more in the future. The benefits only last as long as your subscription length, but you can re-up anytime.</p>
<br />
<p>The current upgrades are: </p>
<br />
<li><ul>
<li>Larger Private Message inbox! Supporter?s inboxes can hold up to 1,000 messages! </li><br />

<li>A new icon to go under your user name when you post. It looks like this: </li> <br />

<img src=http://www.theoutdoorstrader.com/images/ranks/supporter1.png width="130" height="30"/>
</ul></li>


rabeel 12-30-2011 07:38 PM

Looking great. But i am new and it take time for me to do this kind of experements on online forum. i guess should try on localhost.

Lynne 12-30-2011 11:38 PM

If you copy paste some code, you need to understand what it means. "ul.unordered" means a <ul> tag of class "unordered". I would guess you did not assign a class to your <ul> tag. (I cannot get to your page to see if that is the case.)

Okuma Steve 12-31-2011 01:20 AM

I wouldn't get anything done if I understood all of it before I did it! :D

What page can you not get to? I posted links in my earlier post and in my last post I included the HTML from my template.

Is there something else I need to link to or post here?

Lynne 12-31-2011 01:41 AM

If you want to use that css, then:
<ul class="unordered">

You'll want to get rid of the <p> around the items in the <li> tags also.

Okuma Steve 12-31-2011 04:04 AM

Quote:

Originally Posted by Lynne (Post 2282410)
If you want to use that css, then:
<ul class="unordered">

You'll want to get rid of the <p> around the items in the <li> tags also.

Thanks! Works great now.

GossipAll 01-01-2012 06:52 PM

How do I remove the meta description and meta keywords from the static page? It inserts the default "Home" meta descriptions and keywords on the static page.

So how do I remove this? Or add custom meta description and keywords on the static page?

Lynne 01-01-2012 09:04 PM

Did you try just adding them into the template after the headininclude template is called?

HTML Code:

<meta name="keywords" content="xxxx" />
<meta name="description" content="yyyy" />

and then change the condition in the headinclude template to not show those for your page:
HTML Code:

<vb:if condition="$show['threadinfo'] OR Your Condition">

<vb:elseif condition="$show['foruminfo']" />
other stuff....
        <meta name="keywords" content="{vb:raw vboptions.keywords}" />
        <meta name="description" content="{vb:raw vboptions.description}" />
</vb:if>


TheSupportForum 01-04-2012 04:52 PM

i need some help with this template using the information from 1st page

Code:

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
  <head>
    <title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
    {vb:raw headinclude}
    {vb:raw headinclude_bottom}
  </head>
  <body>
   
    {vb:raw header}
   
    {vb:raw navbar}
   
    <div class="blockbody">
      <div class="blockrow">

<vb:if condition="$vboptions['policy_active']">
<ol id="forums" class="floatcontainer">
    </div>
    </div>
<li class="forumbit_nopost L1" id="cat1">
                           
<div id="section1_a" class="block collapse">
    <h2 class="blockhead">
        <span class="forumtitle"><a href="">{vb:raw vboptions.policy_title}</a></span>
        <span class="forumlastpost"></span>
        <a class="collapse" id="collapse_section1" href="{vb:raw relpath}#top"><img src="{vb:stylevar imgdir_button}/collapse{vb:raw vbcollapse.collapseimg_cel_dummy_img}_40b.png" alt="{vb:rawphrase collapse_this_category}" /></a>
    </h2>
    <div class="forumrowdata"  id="section1">
        <p class="subforumdescription">{vb:raw vboptions.policy_content}</p>
    </div>
</div>

<div>
<div>
<vb:else />           
        <div class="foruminfo td">
            <img src="{vb:stylevar imgdir_button}/kural.gif" class="forumicon" id="forum_statusicon_2" alt="" />
            <div class="forumdata">
                <div class="datacontainer">
                    <div class="titleline">
                        <h2 class="forumtitle">{vb:raw vboptions.policy_closedreason}</h2>
</div>
                    <p class="forumdescription"></p>       
 
</vb:if>

      </div>
    </div>
   
    {vb:raw footer}
  </body>
</html>

i get a white space but and need to remove it as shown in the screenshot, can anyone help

http://img651.imageshack.us/img651/1876/whitedv.jpg

kh99 01-04-2012 10:50 PM

I'm not really an html person, but I'm thinking maybe <div ... followed by <p ... is creating a blank line?

Lynne 01-05-2012 05:14 PM

Just taking a quick look, this is totally not correct:
HTML Code:

    <div class="blockbody">
      <div class="blockrow">

<vb:if condition="$vboptions['policy_active']">
<ol id="forums" class="floatcontainer">
    </div>
    </div>
<li class="forumbit_nopost L1" id="cat1">

You can't open an <ol> in the middle of the divs and then have the list continue after you close the divs. Any tag you open must be closed before you may close a tag then encloses it.

TheSupportForum 01-06-2012 04:15 PM

Quote:

Originally Posted by Lynne (Post 2284191)
Just taking a quick look, this is totally not correct:
HTML Code:

    <div class="blockbody">
      <div class="blockrow">

<vb:if condition="$vboptions['policy_active']">
<ol id="forums" class="floatcontainer">
    </div>
    </div>
<li class="forumbit_nopost L1" id="cat1">

You can't open an <ol> in the middle of the divs and then have the list continue after you close the divs. Any tag you open must be closed before you may close a tag then encloses it.

how do i correct it, i tried removing parts of the code to get rid of that white space
the reason it looks not correct was due to me removing some of the original code this from this point of it

Code:

<div class="blockbody">
      <div class="blockrow">


Lynne 01-06-2012 05:26 PM

I don't know how that code should be since I didn't write it. I actually see no reason for any of the code I quoted to be in that page as it doesn't seem to do anything.

Davidinh 01-07-2012 08:42 PM

i created a custom page it just show an object (etc. picture)
i want to interage the forum (by forumid) into my custom page
can all of you guide me which template that i need to concern for it

any adviced or suggestion will be appriciated

Lynne 01-08-2012 02:30 AM

Quote:

Originally Posted by Davidinh (Post 2284949)
i created a custom page it just show an object (etc. picture)
i want to interage the forum (by forumid) into my custom page
can all of you guide me which template that i need to concern for it

any adviced or suggestion will be appriciated

If you have a custom page and you want to do something, then you would edit the template for your custom page.

thenamesgould 01-13-2012 05:28 AM

Works great for my 404 page! Thanks!!! :D

SavSin 01-16-2012 06:50 AM

The page should look like this.
http://www.xvgaming.com/games/stats/bfstats.php
And here is the (second page) using this article to create the template
http://www.xvgaming.com/bfstatsbynam...M_0:0:21788544

Here is the php file (standalone) that makes it like bfstats.php

PHP Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>
    <LINK REL=StyleSheet HREF="bfstats.css" TYPE="text/css">
</head>

<body>

<div id="wrapper">

<div id="branding">
    <a href="http://www.xvgaming.com/">
        <img src="http://www.xvgaming.com/images/xvgaming/xvgaming_logo2.png" alt="Logo">
    </a>    
</div>

<div id="navbar">
    <ul>
        <li class="homeborder"><a href="http://www.xvgaming.com/">Home</a></li>
        <li class="selected"><a href="http://www.xvgaming.com/forum.php">Forum</a></li>
        <li><a href="http://shop.xvgaming.com/">Shop</a></li>
    </ul>
</div>

<div id="lowerbranding">
&nbsp;
</div>

<div id="container">

    <div id="navlinks">

        <a href="http://www.xvgaming.com"><img src="http://www.xvgaming.com/images/xvgaming/images/misc/navbit-home.png"></a>&nbsp;
        <a href="#">Stats</a>&nbsp;
        <img src="http://www.xvgaming.com/images/xvgaming/images/misc/navbit-arrow-right.png">&nbsp;
        <a href="http://www.xvgaming.com/games/stats/bfstats.php">Battlefield</a>
        
    </div>

    <div id="content">
        
        <?php
            $host
="localhost";
            
$user="wanderzo_savsin";
            
$password="savsin3";
            
$database="wanderzo_battlefield";
            
            
mysql_connect($host$user$password);
            
            @
mysql_select_db($database) or die("Unable To select database");
            
            
$query "SELECT * FROM XpTable WHERE (player_total_xp > 75) ORDER BY player_total_xp DESC";
            
            
$result mysql_query($query);
            
            
$num mysql_numrows($result);
            
            
mysql_close();
        
?>
        
        <div id="topbar">
    
            <div id="prevlink">
            
                <?php
                $incriment 
$_GET['nextpage'];
                
$startid $incriment 0;
                
$statsperpage 15;
                
                    if(
$startid 0)
                    {
                
?>
                        <a class="button" href="http://www.xvgaming.com/games/stats/bfstats.php?nextpage=<?php echo $incriment-$statsperpage?>"> &laquo; Back </a>
                <?php
                    
}
                    else
                    {
                
?>
                        <a class="button" href="#">&laquo; Back </a>  
                <?php
                    
}
                
?>
            
            </div>
        
            <div id="steamform">
            
                <form method="get" action="bfstatsbyname.php">
                <label>Enter Your SteamID:</label>
                <input type="text" maxlength="20" name="SteamID" value="STEAM_0:1:23456789" onFocus="if(value == 'STEAM_0:1:23456789') {value=''}" onBlur="if(value=='') {value='STEAM_0:1:23456789'}"/>
                <button type="submit">Submit</button>
                <div class="spacer"></div>
                </form>
                
            </div>
            
            <div id="nextlink">
                
                <?php                
                    
if($startid $statsperpage $num)
                    {
                    
?>
                    <a class="button" href="http://www.xvgaming.com/games/stats/bfstats.php?nextpage=<?php echo $incriment $statsperpage?>">Next &raquo;</a>
                    <?php
                    
}
                    else
                    {
                    
?>
                    <a class="button" href="#">Next &raquo; </a>  
                    <?php
                    
}
                
?>
            
            </div>
            
            <div class="spacer"></div>
        
        </div>
        
        <table class="stats">
            <tr>
                <th class="stats">Rank</th>
                <th class="stats">Name</th>
                <th class="stats">XP</th>
                <th class="stats">Assault</th>
                <th class="stats">Special Ops</th>
                <th class="stats">Sniper</th>
                <th class="stats">Engineer</th>
                <th class="stats">Medic</th>
                <th class="stats">Support</th>
            </tr>
        <?php
        $i 
$startid;
        
$RankNumber $startid 1;
        
            while(
$i $num)
            {
                
$player_id=mysql_result($result$i"player_id");
                
$player_name=mysql_result($result,$i,"player_name");
                
$player_total_xp=mysql_result($result,$i,"player_total_xp");
                
$player_class_assault_xp=mysql_result($result,$i,"player_class_assault_xp");
                
$player_class_specops_xp=mysql_result($result,$i,"player_class_specops_xp");
                
$player_class_sniper_xp=mysql_result($result,$i,"player_class_sniper_xp");
                
$player_class_engineer_xp=mysql_result($result,$i,"player_class_engineer_xp");
                
$player_class_medic_xp=mysql_result($result,$i,"player_class_medic_xp");
                
$player_class_support_xp=mysql_result($result,$i,"player_class_support_xp");
                
                if(
$i < ($startid $statsperpage))
                {
        
?>
                    <tr>
                        <td class="stats"><?php echo $RankNumber?></td>
                        <td class="stats"><a href="http://www.xvgaming.com/games/stats/bfstatsbyname.php?SteamID=<?php echo $player_id?>&Rank=<?php echo $RankNumber?>"><?php echo $player_name?></a></td>
                        <td class="stats"><?php echo $player_total_xp?></td>
                        <td class="stats"><?php echo $player_class_assault_xp?></td>
                        <td class="stats"><?php echo $player_class_specops_xp?></td>
                        <td class="stats"><?php echo $player_class_sniper_xp?></td>
                        <td class="stats"><?php echo $player_class_engineer_xp?></td>
                        <td class="stats"><?php echo $player_class_medic_xp?></td>
                        <td class="stats"><?php echo $player_class_support_xp?></td>
                    </tr>
            
        <?php
                    $i
++;
                    
$RankNumber++;
                }
                else
                {                    
                    break;
                }
            }
        
?>
        </table>
        
    </div>
    
    <div class="spacer"></div>
    
    <div id="footer">
        
        <div id="footerprevlink">
        
            <?php
            $incriment 
$_GET['nextpage'];
            
$startid $incriment 0;
            
$statsperpage 15;
            
                if(
$startid 0)
                {
            
?>
                    <a class="button" href="http://www.xvgaming.com/games/stats/bfstats.php?nextpage=<?php echo $incriment-$statsperpage?>"> &laquo; Back </a>
            <?php
                
}
                else
                {
            
?>
                    <a class="button" href="#">&laquo; Back </a>  
            <?php
                
}
            
?>
        
        </div>
        
        <div id="footernextlink">
            
            <?php
                $incriment 
$_GET['nextpage'];
                
$startid $incriment 0;
                
                if(
$startid $statsperpage $num)
                {
                
?>
                <a class="button" href="http://www.xvgaming.com/games/stats/bfstats.php?nextpage=<?php echo $incriment $statsperpage?>">Next &raquo;</a>
                <?php
                
}
                else
                {
                
?>
                <a class="button" href="#">Next &raquo; </a>  
                <?php
                
}
            
?>
        
        </div>
        
        <div class="spacer"></div>
        
    </div>

    <div class="spacer"></div>
    
</div>

</div>

</body>

</html>

Here is a link to what it looks like when i do the stuff for the template. I think the issue is that when it loops to create the table rows. There is only one set of variables which get changed each loop. So I think i need to create seperate variables for each row(while it loops and register them all in the loop)

Atleast thats what i think is wrong with it. Here is the link and the php/template files

http://www.xvgaming.com/bfstats.php

PHP Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT''bfstats');
define('CSRF_PROTECTION'true);  
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('BfStats',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits construct_navbits(array('' => 'Battlefield'));
$navbar render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle 'Battlefield Stats';

$host="localhost";
$user="wanderzo_savsin";
$password="savsin3";
$database="wanderzo_battlefield";

mysql_connect($host$user$password);

@
mysql_select_db($database) or die("Unable To select database");

$query "SELECT * FROM XpTable WHERE (player_total_xp > 75) ORDER BY player_total_xp DESC";

$result mysql_query($query);

$num mysql_numrows($result);

mysql_close();

$incriment $_GET['nextpage'];
$startid $incriment 0;
$statsperpage 15;

if(
$startid 0)
{
    
$prevstatspage $incriment-$statsperpage;
    
$prevlink '<a class="button" href="http://www.xvgaming.com/bfstats.php?nextpage=';
    
$prevlink2 '"> &laquo; Back </a>';
}
else
{
    
$prevlink '<a class="button" href="http://www.xvgaming.com/bfstats.php#">&laquo; Back </a>';
}
            
if(
$startid $statsperpage $num)
{
    
$nextstatspage = ($incriment $statsperpage);
    
$nextlink '<a class="button" href="http://www.xvgaming.com/bfstats.php?nextpage=';
    
$nextlink2 '">Next &raquo;</a>';
}
else
{
    
$nextlink '<a class="button" href="http://www.xvgaming.com/bfstats.php#">Next &raquo; </a>';
}

$i $startid;
$RankNumber $startid 1;

while(
$i $num)
{
    
$player_id=mysql_result($result$i"player_id");
    
$player_name=mysql_result($result,$i,"player_name");
    
$player_total_xp=mysql_result($result,$i,"player_total_xp");
    
$player_class_assault_xp=mysql_result($result,$i,"player_class_assault_xp");
    
$player_class_specops_xp=mysql_result($result,$i,"player_class_specops_xp");
    
$player_class_sniper_xp=mysql_result($result,$i,"player_class_sniper_xp");
    
$player_class_engineer_xp=mysql_result($result,$i,"player_class_engineer_xp");
    
$player_class_medic_xp=mysql_result($result,$i,"player_class_medic_xp");
    
$player_class_support_xp=mysql_result($result,$i,"player_class_support_xp");
    
    if(
$i < ($startid $statsperpage))
    {
        
$starttablerow '<tr>';
            
$starttablecell1 '<td class="stats">';
            
$endtablecell1 '</td>';
            
            
$starttablecell2 '<td class="stats"><a href="http://www.xvgaming.com/bfstatsbyname.php?SteamID=';
            
$tablecell2center '">';
            
$endtablecell2 '</a></td>';
            
            
$starttablecell3 '<td class="stats">';
            
$endtablecell3 '</td>';
            
            
$starttablecell4 '<td class="stats">';
            
$endtablecell4 '</td>';
            
            
$starttablecell5 '<td class="stats">';
            
$endtablecell5 '</td>';
            
            
$starttablecell6 '<td class="stats">';
            
$endtablecell6 '</td>';
            
            
$starttablecell7 '<td class="stats">';
            
$endtablecell7 '</td>';
            
            
$starttablecell8 '<td class="stats">';
            
$endtablecell8 '</td>';
            
            
$starttablecell9 '<td class="stats">';
            
$endtablecell9 '</td>';
            
        
$endtablerow '</tr>';
        
        
$i++;
        
$RankNumber++;
    }
    else
    {                    
        break;
    }
}


// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater vB_Template::create('BfStats');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle'$pagetitle);


$templater->register('prevstatspage'$prevstatspage);
$templater->register('prevlink'$prevlink);
$templater->register('prevlink2'$prevlink2);

$templater->register('nextstatspage'$nextstatspage);
$templater->register('nextlink'$nextlink);
$templater->register('nextlink2'$nextlink2);

//Rank Info
$templater->register('RankNumber'$RankNumber);
$templater->register('player_id'$player_id);
$templater->register('player_name'$player_name);
$templater->register('player_total_xp'$player_total_xp);
$templater->register('player_class_assault_xp'$player_class_assault_xp);
$templater->register('player_class_specops_xp'$player_class_specops_xp);
$templater->register('player_class_sniper_xp'$player_class_sniper_xp);
$templater->register('player_class_engineer_xp'$player_class_engineer_xp);
$templater->register('player_class_medic_xp'$player_class_medic_xp);
$templater->register('player_class_support_xp'$player_class_support_xp);

//Start Table
$templater->register('starttablerow'$starttablerow);

//Open Table Rows
$templater->register('starttablecell1'$starttablecell1);
$templater->register('starttablecell2'$starttablecell2);
$templater->register('starttablecell3'$starttablecell3);
$templater->register('starttablecell4'$starttablecell4);
$templater->register('starttablecell5'$starttablecell5);
$templater->register('starttablecell6'$starttablecell6);
$templater->register('starttablecell7'$starttablecell7);
$templater->register('starttablecell8'$starttablecell8);
$templater->register('starttablecell9'$starttablecell9);

//Cell Centers
$templater->register('tablecell2center'$tablecell2center);

//End the table rows
$templater->register('endtablecell1'$endtablecell1);
$templater->register('endtablecell2'$endtablecell2);
$templater->register('endtablecell3'$endtablecell3);
$templater->register('endtablecell4'$endtablecell4);
$templater->register('endtablecell5'$endtablecell5);
$templater->register('endtablecell6'$endtablecell6);
$templater->register('endtablecell7'$endtablecell7);
$templater->register('endtablecell8'$endtablecell8);
$templater->register('endtablecell9'$endtablecell9);

//End table
$templater->register('endtablerow'$endtablerow);

print_output($templater->render());
?>

Code:

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml"<vb:if condition="$vboptions['enablefacebookconnect']"> xmlns:fb="http://www.facebook.com/2008/fbml"</vb:if>  dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
       
        <LINK REL=StyleSheet HREF="games/stats/player_stats.css" TYPE="text/css">
               
        {vb:raw headinclude}
        <title>{vb:raw pagetitle}</title>

        <vb:if condition="$includecss">
                <vb:if condition="$vboptions['storecssasfile']">
                        <vb:each from="includecss" value="file">
                                {vb:cssfile {vb:raw file}}
                        </vb:each>
                <vb:else />
                        {vb:cssfile {vb:raw includecss}}
                </vb:if>
        </vb:if>
        {vb:raw headinclude_bottom}
</head>
<body>

        {vb:raw header}
       
        {vb:raw navbar}
       
        <div id="content">
               
                <div id="topbar">
       
                        <div id="prevlink">
                       
                                {vb:raw prevlink}{vb:raw prevstatspage}{vb:raw prevlink2}
                       
                        </div>
               
                        <div id="steamform">
                       
                                <form method="get" action="http://www.xvgaming.com/bfstatsbyname.php">
                                <label>Enter Your SteamID:</label>
                                <input type="text" maxlength="20" name="SteamID" value="STEAM_0:1:23456789" onFocus="if(value == 'STEAM_0:1:23456789') {value=''}" onBlur="if(value=='') {value='STEAM_0:1:23456789'}"/>
                                <button type="submit">Submit</button>
                                <div class="spacer"></div>
                                </form>
                               
                        </div>
                       
                        <div id="nextlink">
                               
                                {vb:raw nextlink}{vb:raw nextstatspage}{vb:raw nextlink2}
                       
                        </div>
                       
                        <div class="spacer"></div>
               
                </div>
               
                <table class="stats">
                        <tr>
                                <th class="stats">Rank</th>
                                <th class="stats">Name</th>
                                <th class="stats">XP</th>
                                <th class="stats">Assault</th>
                                <th class="stats">Special Ops</th>
                                <th class="stats">Sniper</th>
                                <th class="stats">Engineer</th>
                                <th class="stats">Medic</th>
                                <th class="stats">Support</th>
                        </tr>
                       
                        {vb:raw starttablerow}
                                {vb:raw starttablecell1}{vb:raw RankNumber}{vb:raw endtablecell1}
                                {vb:raw starttablecell2}{vb:raw player_id}{vb:raw tablecell2center}{vb:raw player_name}{vb:raw endtablecell2}
                                {vb:raw starttablecell3}{vb:raw player_total_xp}{vb:raw endtablecell3}
                                {vb:raw starttablecell4}{vb:raw player_class_assault_xp}{vb:raw endtablecell4}
                                {vb:raw starttablecell5}{vb:raw player_class_specops_xp}{vb:raw startendtablecell5}
                                {vb:raw starttablecell6}{vb:raw player_class_sniper_xp}{vb:raw endtablecell6}
                                {vb:raw starttablecell7}{vb:raw player_class_engineer_xp}{vb:raw endtablecell7}
                                {vb:raw starttablecell8}{vb:raw player_class_medic_xp}{vb:raw endtablecell8}
                                {vb:raw starttablecell9}{vb:raw $player_class_support_xp}{vb:raw endtablecell9}
                        {vb:raw endtablerow}
                </table>
                <div class="spacer">&nbsp;</div>
        </div>
        <div class="spacer"></div>
        {vb:raw footer}
       
</body>
</html>

So how would I be able to make the second bit of code using the templates to create the table rows like in the first standalone bfstats.php.

Thanks abunch in advanced.

Lynne 01-16-2012 09:51 PM

Why are you doing all these start and stop table rows? Why not just:

PHP Code:

while($i $num)
{
    
$player_id=mysql_result($result$i"player_id");
    
$player_name=mysql_result($result,$i,"player_name");
    
$player_total_xp=mysql_result($result,$i,"player_total_xp");
    
$player_class_assault_xp=mysql_result($result,$i,"player_class_assault_xp");
    
$player_class_specops_xp=mysql_result($result,$i,"player_class_specops_xp");
    
$player_class_sniper_xp=mysql_result($result,$i,"player_class_sniper_xp");
    
$player_class_engineer_xp=mysql_result($result,$i,"player_class_engineer_xp");
    
$player_class_medic_xp=mysql_result($result,$i,"player_class_medic_xp");
    
$player_class_support_xp=mysql_result($result,$i,"player_class_support_xp");
    
    
$output.='<tr><td class="stats">' .$RankNumber'</td>
        <td class="stats">' 
.$player_id'</td>
        <td class="stats">' 
.$player_total_xp'</td>
        etc
        </tr>'
;


Then make sure to register $output and then in the template in place of:
HTML Code:

                        {vb:raw starttablecell1}{vb:raw RankNumber}{vb:raw endtablecell1}
                                {vb:raw starttablecell2}{vb:raw player_id}{vb:raw tablecell2center}{vb:raw player_name}{vb:raw endtablecell2}
....
                                {vb:raw starttablecell9}{vb:raw $player_class_support_xp}{vb:raw endtablecell9}

HTML Code:

{vb:raw output}

SavSin 01-17-2012 12:35 AM

That worked perfectly. And to answer your question This was my first dabble in PHP and MySql. Im trying to teach it to my self and work on different things. So THANKS a ton.

I have a friend that wants to make a chrome widget that will alert him to new PM's and thread subscriptions on a VB forum so im learning some things about php and vb.

ClErK1991 01-22-2012 05:59 PM

thanks i like this

Rocket2009 01-24-2012 02:15 AM

I am still hoping for help. I have implemented dozens and dozens of pages using this process with lots of customization. Thanks Lyne. I have embedded newsfeeds, slideshows, spreadsheets, and etc. So I am fairly familiar with the method.

I am having trouble with one implementation. It looks beautiful, but it doesn't recognize me as logged in user.

I call the test.php (using the demo model terminology from the original post in this article) from another page, let's call that index.php (really a complex application). If I require_once global.php on test.php, it doesn't work (printing variables shows me as a guest). I can require_once global.php on index.php and it works and shows me as logged in. I can pass the security token obtained from index.php to either test.php via an assign function in that application has very similar to the templater register used by VB for test.php. I have seen the security value on the test.php (printing variables) and have rendered the security value into the template html output.

The result is that whenever I render an html page from this system (index.php calls test.php which uses template TEST to create an html page) it shows me as not logged in and the page source shows me as a guest. If I navigate to another forum page, I am still logged in.

So here are some questions and hopefully I can get some help for further study:

(1) If I can get a security token in the world of index.php such as

PHP Code:

<?php
$curdir 
getcwd ();
chdir('/home/touring7/public_html/forum/');
require_once(
'./global.php');
chdir ($curdir);

//Can pass these values to the html page or the external php page
$tokenkb $vbulletin->userinfo['securitytoken'];
//$uidkb = $vbulletin->userinfo['userid'];

I have tried assigned it to the html template (TEST) as:

HTML Code:

<input type="hidden" name="securitytoken" value="{tokenkb}" />
Note it has a slightly different format from an assign from test as it doesn't have vb:raw. But even though I see the value in the page source, it doesn't unlock the page and still shows me as a guest.

One of two options, in my mind. I am either doing something wrong with passing the security token in terms of the input statement. Do I need to pass more than the security token? -or- index.php is disabling or clearing the session so the security token doesn't log me into the system. Interestingly, remember that if I navigate to another forum page I am still logged in and everything is fine.

Does anyone have a suggestion on how to pass the security token. Does the syntax look OK. I have never unlocked a page in this manner.

Or is there a command or series of command I can search through in the world of index.php that would disable (temporarily) the session so it can't recognize a user as logged in. I might be able to disable or adjust this function.

Any advice or suggestions would be much appreciated.

Lynne 01-24-2012 04:33 PM

Why are you focusing on passing the securitytoken? What about the userid - that is the variable you need.

Rocket2009 01-25-2012 01:00 AM

Quote:

Originally Posted by Lynne (Post 2291817)
Why are you focusing on passing the securitytoken? What about the userid - that is the variable you need.

Yes, I am sure I could pass userid to that page. My problem is that the Header and NavBar templates test to see if I am a member and since apparently I am not (security token is at guest), at this point, the header template prints out an empty login box and the navbar template puts a notice note on the page that says something like: "If this your first time on this site you may register ...".

My hack around this is to modify header to skip that assessment for this page (THIS_SCRIPT test) and not show anything in the upper right corner and to modify Navbar in the same manner to skip the messages for this page. So it's not elegant but it sort of works. The problem is that there are times that I get logged out after viewing this page (weird inconsistent behavior of tokens I think and browser caches).

My thought is that if I could log myself back in after going through this other application, which apparently tries to flush the session or some sort of thing, I would be golden and this page would work like the dozens of others and I wouldn't have to worry about being logged out.

So I thought if I used the security token I could log myself back in. This would be the cleanest approach forward. Any suggestions on how to do this, assuming you agree on the approach. I have seen some threads on remote login. Should I implement this on the test.php? Suggested thread for VB4 to help me do this? My security token notes were related to a post that Lynne made on this thread to use <input ...>.

If I can't get this to work, my latest brainstorm is to experiment with merging index.php (the launch code for the other application) and test.php (the code for rendering VB pages via the tutorial Lynne pulled together). I don't like this approach since it will be difficult to maintain through updates of the other application, even assuming I can get it to work. The other application renders global variables into templates as well. I think it was already a miracle that I could get the other application to call test.php and have them both render things into the TEST template.

Suggestions on approaches to stay logged in would be appreciated!

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

Additionally, does anyone have any idea of what types of php commands in the other application might be logging me off the vbulletin system? I might be able to search for those and circumvent them.

Thanks.

nerbert 01-27-2012 09:02 PM

I've recently built a new page and want to put in ad locations. There's something about the variable "$ad_location" that won't let me do it. "$bad_location" works though. Is there some special handling you have to do to use that variable name?

kh99 01-28-2012 12:45 AM

Quote:

Originally Posted by nerbert (Post 2293218)
I've recently built a new page and want to put in ad locations. There's something about the variable "$ad_location" that won't let me do it. "$bad_location" works though. Is there some special handling you have to do to use that variable name?

What do you mean by "won't let you do it"? Where are you trying to use that variable?

nerbert 01-28-2012 01:14 AM

Well, the problem I'm having is that I don't use ads on my own forum but I'm working on a new page for someone else who does. So I don't know much about how to place ads, and it's hard to design a page that uses them and get a new set of locations in the adminCP. Anyway I'm fumbling my way through this by trial and error.

"$ad_location" seems to be reserved by vBulletin so you can't just use it any way you want. But as I said, I'm figuring this out.

I wish you could search for "ad location" but "ad" is too short!!!!!!

If I ever get this working maybe I should write an article.


All times are GMT. The time now is 12:06 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.03114 seconds
  • Memory Usage 2,187KB
  • 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
  • (8)bbcode_code_printable
  • (9)bbcode_html_printable
  • (7)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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