PDA

View Full Version : [HOW TO - vB4] Create your own vBulletin page


Pages : 1 2 3 [4] 5

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/bfstatsbyname.php?SteamID=STEAM_0:0:21788544

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


<!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

// ####################### 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());
?>



{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:

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:
{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}

{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
$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:

<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
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 1327535262 at 1327535262 ---------------

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
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.

CrumbDown
02-10-2012, 08:36 AM
Noob question.

I have created a terms.php file, but how to add words in that file. Well...I can add words but the formatting is not working such as <li> </li>. Is there something Im missing?

Rocket2009
02-10-2012, 01:27 PM
I have created a terms.php file, but how to add words in that file. Well...I can add words but the formatting is not working such as <li> </li>. Is there something Im missing?

If you are saying that the formatting does not look right in your editor while putting in code into terms.php, it shouldn't since the code is contained within a string variable that is passed to the template.

When I use this method to create external pages I will frequently develop the html within a separate file and test it prior to bringing to this template passing system.

CrumbDown
02-10-2012, 03:05 PM
Format looks perfect in DreamWeaver.

This does not work in the template:

<ul>
<li>blah blah</li>
</ul>


Nor:

<p>blah blah</p>

Rocket2009
02-10-2012, 07:47 PM
This does not work in the template:


Are you saying the code you developed doesn't work in the custom template you built (TEST according to the tutorial) or in the page (test.php according to this tutorial).

CrumbDown
02-11-2012, 10:49 AM
Are you saying the code you developed doesn't work in the custom template you built (TEST according to the tutorial) or in the page (test.php according to this tutorial).

What code? I have followed the above instructions to create a new template and a new .php file. All is ok. I got a new template: www.mywebsite.com/newpage.php. Perfect yes. But I need to add words/content on that page. By doing so I need to add it in the template which works perfect. But trying to get a paragraph or bullet points does not work. It's like viewing sentences in notepad without word wrap selected.

Regards

cellarius
02-11-2012, 11:51 AM
If you followed the tutorial, you created
1. a php file
2. a template in AdminCP.

Where do you add your html code, to 1 or 2? You need to add it to 2. It may be that you need to put a div-container around your html, since the formatting of unordered lists and the like will be reset by vB in order to format the page layout.

Do
<div class="mytext">
<ul>
<li>blah blah</li>
</ul>
</div>

Add, for example, this to additional.css:

.mytext ul {
whatever css formatting you want
}


But this really leads away from this tutorial.

CrumbDown
02-11-2012, 12:31 PM
Hi

I have added the first HTML code below:
<div class="block row">
and no bullet point.

And yes, I have edited the template.

Rocket2009
02-11-2012, 03:38 PM
I have created a terms.php file, but how to add words in that file. Well...I can add words but the formatting is not working such as <li> </li>. Is there something Im missing?

First of all, it works! So it's tough to help without seeing your code. I will show you my approach. I put all of the content into the .php page so I can have the smallest number of templates (2) for doing dozens of pages. Here is the php code with simple content similar to what you want to send:


// ###### YOUR CUSTOM CODE GOES HERE #####

$pagetitle = 'My Page Title';

$bartitle = 'Bar Sub-Title';

$linkcss = '';

$linksjava = '';

$pagescript = '';

$introstuff = '<div class="article cms_clear restore postcontainer">

<div style="padding-top: 6px; padding-bottom: 6px;">Upon joining the website each user shall be classified by their experience level as follows:</div>

<div style="line-height: 140%; margin-left: 30px;">
<ul>
<li style="margin-bottom:5px;">0 to 5 forum posts: New User</li>
<li style="margin-bottom:5px;">5 to 100 forum posts: Proficient User</li>
<li style="margin-bottom:5px;">More than 100 forum posts: Expert User</li>
</ul>
</div>
<br />
</div>';

$graphix = '<div style="text-align: center;" ><A HREF="/index.php">
<IMG SRC="/pics/under_construction_02.jpg" ALT="Under Construction"></A>
</div>';



As a reminder you need to put this content on the page such as:


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

$templater = vB_Template::create('TMGApage');
$templater->register_page_templates();

$templater->register('navbar', $navbar);

//$templater->register('pagetitle', $pagetitle);
//$templater->register('bartitle', $bartitle);

$templater->register('linkcss', $linkcss);
$templater->register('linksjava', $linksjava);
$templater->register('pagaescript', $pagescript);
$templater->register('introstuff', $introstuff);
$templater->register('graphix', $graphix);

print_output($templater->render());

MatiasCandy
02-15-2012, 04:46 AM
Okay I might have missed this in the sea of posts.

I created my basic page but now I want to include the Widgets on it so it will match the entire website.

How do I add the Widgets and be able to change with the layout manager?

Lynne
02-15-2012, 03:36 PM
Okay I might have missed this in the sea of posts.

I created my basic page but now I want to include the Widgets on it so it will match the entire website.

How do I add the Widgets and be able to change with the layout manager?
I don't think it has ever been discussed. There is another article in this forum about adding widgets to any page, so you should go read that one.

MatiasCandy
02-16-2012, 09:16 PM
I don't think it has ever been discussed. There is another article in this forum about adding widgets to any page, so you should go read that one.

searching cannot find it, do you have a link?

GameOverViper
02-17-2012, 11:10 PM
Hello, I'm starting on a project and I'm not exactly sure how to make it so in the bread crumbs, it shows another page that I made that is only viewable from the first created page.

I'm trying to make a few pages actually that will work off of others. I'm just curious as to how the bread crumbs work.

appsfinder
03-03-2012, 10:43 AM
works great

brishi
03-18-2012, 07:48 PM
OK, like a few other beginners have more than likely done I started out by using the coding from the vB3 posting which was pointed out to me by cellarius and I was getting a 3 line error. Now that I have switched over to this template I no longer get anything except a white page and if I vie the source code all I get is this :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>

I have looked through 154-20 pages of replies here and could not find an answer to correct myself, so need some help please. I am just using the basic 2 files used on the first page of this article and then will change the basic name to what I need when I know it is working properly.

NEVERMIND - Just kept checking and testing and found my silly error, I had the template as "Test" when it should have been "TEST"...Dohhhh!!! Great article btw Lynne and thanks for sharing!

Cheers,
BriShi

MacroPhotoPro
03-20-2012, 01:01 PM
I have a Paid Subscription website, where I am able to ascribe permissions to my forums as well as to my CMS articles. The only parties who can see these pages are me, the Administrator (User Group 6), as well as my Subscribed Members (User Group 9). With this in mind, I have a few questions that I would be grateful for some clarification on:

1. Are these pages considered CMS pages and, if so, are they manageable under the Content Manager of CMS control in the ACP?;
2. If not, will creating these new pages be manageable anywhere in the ACP?;
3. If not, is there some coding that can be done in the default template to where only User Groups 6 and 9 are able to view the constructed pages?

Thank you for your time and for creating this valuable tutorial!

Jack

Rocket2009
03-20-2012, 02:46 PM
I don't know about methods (1) and (2). As suggested elsewhere in this thread I effectively use a little code in the php page (not the vBulletin template). Mine looks like:

// ################################################## #####################

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

// ################################################## #####################

if (!is_member_of($vbulletin->userinfo, 6, 7, 5, 15, 13, 9, 11, 16, 12))
{
// give no permission unless in usergroup x, y, or z
print_no_permission();
}

$navbits = construct_navbits(array('' => 'TMGA Logos'));

$navbar = render_navbar_template($navbits);



// ###### YOUR CUSTOM CODE GOES HERE #####

Lynne
03-20-2012, 06:27 PM
I have a Paid Subscription website, where I am able to ascribe permissions to my forums as well as to my CMS articles. The only parties who can see these pages are me, the Administrator (User Group 6), as well as my Subscribed Members (User Group 9). With this in mind, I have a few questions that I would be grateful for some clarification on:

1. Are these pages considered CMS pages and, if so, are they manageable under the Content Manager of CMS control in the ACP?;
2. If not, will creating these new pages be manageable anywhere in the ACP?;
3. If not, is there some coding that can be done in the default template to where only User Groups 6 and 9 are able to view the constructed pages?

Thank you for your time and for creating this valuable tutorial!

Jack
1. No
2. They are manageable in the Style Manager where you may edit the templates.
3. See the post above this one.

MacroPhotoPro
03-21-2012, 01:35 PM
Thank you both for your time, I appreciate it.

slammz
03-24-2012, 04:52 AM
1. No
2. They are manageable in the Style Manager where you may edit the templates.
3. See the post above this one.

How can I put certain forums on this page?

Lynne
03-24-2012, 04:16 PM
How can I put certain forums on this page?
Just add the html in the template to link to the forums.

<a href="forumdisplay.php?f=xx">Form xx</a>

slammz
03-24-2012, 05:30 PM
Just add the html in the template to link to the forums.

<a href="forumdisplay.php?f=xx">Form xx</a>

No, I want to be able to display them like if I was on the homepage. How can I do that? I know it's possible somehow.

Lynne
03-24-2012, 09:24 PM
No, I want to be able to display them like if I was on the homepage. How can I do that? I know it's possible somehow.
Copy the php code from the forum.php file and copy the needed template/html from the FORUMHOME template into your custom template.

slammz
03-25-2012, 07:02 PM
Copy the php code from the forum.php file and copy the needed template/html from the FORUMHOME template into your custom template.

I don't want all the forums displayed though, only my VIP forums.

Lynne
03-26-2012, 03:21 PM
I don't want all the forums displayed though, only my VIP forums.
Then modify the php code to only show those forums.

SavSin
03-28-2012, 09:42 PM
So i have finally gotten the hang of working with this type of page haha.. Thanks Lynn.

My question is Is there away to use say a contact form created on a custom page to send a pm to a couple hard coded users and also to post in a specified section of the forums?

"Not the original Contact Us Form from VB"

Lynne
03-28-2012, 11:09 PM
So i have finally gotten the hang of working with this type of page haha.. Thanks Lynn.

My question is Is there away to use say a contact form created on a custom page to send a pm to a couple hard coded users and also to post in a specified section of the forums?

"Not the original Contact Us Form from VB"
Of course there is, but you have to code it yourself and I don't have that code handy to just copy/paste it for you. If you need help with that, you should post in the Programming forum with the code you have already written and the problem you are running into.

MacroPhotoPro
03-29-2012, 03:00 AM
This may have been covered, but will the Search (and Advanced Search) features work in these new pages?

If not, is there a way to configure this to have it work?

Lynne
03-29-2012, 03:18 AM
It will work as far as you may still search posts. But, the information on these pages will not be searchable unless you do something to make them so. (Not anything that is covered in this tutorial.)

MacroPhotoPro
03-29-2012, 03:31 AM
It will work as far as you may still search posts. But, the information on these pages will not be searchable unless you do something to make them so. (Not anything that is covered in this tutorial.)

Thanks for your response. What would that "something" be :)

If this is not the place for that, where would such a question be posted?

Lynne
03-29-2012, 02:16 PM
Thanks for your response. What would that "something" be :)

If this is not the place for that, where would such a question be posted?
That something would be to write some code to index the text in the search_core (and other) tables. You would probably need to create a new contenttype in the contenttype table in order to index it correctly. If you are unsure how to do this, then you should post in the main vB4 General Discussions forum. You should probably have a little bit of php experience if you are going to write this code.

MacroPhotoPro
03-30-2012, 06:17 PM
I don't know about methods (1) and (2). As suggested elsewhere in this thread I effectively use a little code in the php page (not the vBulletin template). Mine looks like:

// ################################################## #####################

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

// ################################################## #####################

if (!is_member_of($vbulletin->userinfo, 6, 7, 5, 15, 13, 9, 11, 16, 12))
{
// give no permission unless in usergroup x, y, or z
print_no_permission();
}

$navbits = construct_navbits(array('' => 'TMGA Logos'));

$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####




How about a variation on this that also employs create/edit/delete permissions?

For example, in the other custom pages I want to design, these are going to be for an image-hosting service I am making. I want people to pay a fee to host their images, and I want "everyone" to be able to "see" these images, but where only the Administrator and Paid Subscibers can edit, delete, or create new pages.

Further, the permissions should be configured to where Paid Subscribers are only able to edit/delete their own self-created pages, but to where they can't edit/delete the pages of other Paid Subscribers, while the Administrator can edit/delete anyone's pages.

I know how to do this with my CMS Manager, but because these custom pages we're here aren't controlled by that, how would they be thus-configured by hand?

Thanks!

--------------- Added 1333138408 at 1333138408 ---------------


2. Create the Template:
- If you are in debug mode, create the template in your MASTER STYLE so it shows up in all your styles, otherwise make sure you create the template in the style you are using. If following the page above, call the template TEST

How do I operate in debug mode, and will this still work if I am not?

cbiweb
04-03-2012, 01:02 PM
I've created the page, and everything works except that users are no longer logged in when visiting the custom page. Clicking any tab or link to navigate away from the page brings me back to the normal logged in state, but the custom page is logged out. How do I fix that?

edit: Found the problem. It's a privacy policy page, and in Options > Site Name / URL / Contact Details the link to the page was the full path (http://sitename.com/forums/privacy.php) instead of relative (privacy.php). Once I made it relative it worked fine.

MacroPhotoPro
04-03-2012, 03:58 PM
<?php

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

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

define('THIS_SCRIPT', 'scrImages');
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('IMAGE_HOSTING',
);

// 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('' => 'Macro Image Hosting'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = '';
echo 'I am here';

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

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

?>


Okay, I have followed your instructions in this tutorial to the letter and am getting a blank test page to generate just fine.

However, the moment I try to add custom code to it, the setup fails. I just did a basic "I am here" insertion, but where you have indicated Your Custom Code Goes Here is generating the quote at the TOP of my test page, rather than in the body where it should be, as follows:

http://www.macrophotopro.com/problems/testpage.jpg

What am I doing wrong and why is the "I am here" quote being displayed at the top of the page, rather than in the body where it should be going?

Thanks for any help!

Jack

Lynne
04-03-2012, 04:27 PM
You need to insert any text you want on the page into the template. You cannot use echo. You would need to do something like:
$message = 'I am here';
and in the appropriate place near the bottom, add:
$templater->register('message', $message);
And then in the template, put this where you want the text to appear:
{vb:raw message}

MacroPhotoPro
04-03-2012, 05:38 PM
Okay, I have that bit working right now, thank you.

In order to create an actual page now, can I just use HTML tags, or do I have to register more code with the template?

Thanks again.

Lynne
04-03-2012, 11:39 PM
If you have static content for your page, you may just want to type it into the template directly. Using variables is usually something you'd only want to do if you are using php to define some text.

MacroPhotoPro
04-04-2012, 01:57 AM
If you have static content for your page, you may just want to type it into the template directly. Using variables is usually something you'd only want to do if you are using php to define some text.

Okay thank you. Moving on from a basic block of text, what if I just want to make a basic HTML template within my custom page? For example:

<h1>My Title</h1>

My text

<ul>
<li>Cameras</li>
<ul>
<li>DSLRs</li>
<li>Point & Shoot</li>
</ul>
<li>Lenses</li>
<li>Etc.</li>
</ul>

More text.

<a href="mailto:myemail">My Email</a>

How would I set the template/php page up? In other words, you had me place {vb:raw imghost_content} just to put "I am here," what kind of variable would I need to add to construct a basic HTML page?

Thanks again!!

cellarius
04-04-2012, 05:15 AM
Use the template code given in the article to create a custom vBulletin page. To just create any html page (without showing the forum framework) use standard html page architecture (basically, you'll find that in the template code in the article, too).

MacroPhotoPro
04-04-2012, 12:59 PM
Use the template code given in the article to create a custom vBulletin page. To just create any html page (without showing the forum framework) use standard html page architecture (basically, you'll find that in the template code in the article, too).

I placed the simple code I put up top in the "your code goes here" element of the .php page, and my text showed up, but my HTML did not.

I assume I am missing something :confused:

Lynne
04-04-2012, 02:05 PM
I placed the simple code I put up top in the "your code goes here" element of the .php page, and my text showed up, but my HTML did not.

I assume I am missing something :confused:
Please give us a URL to view the page. My guess is the HTML did show up, but your CSS is causing it to not do what you want.

Search this article for discussions on the problems using <li> on this page and the CSS you need to add to fix it.

MacroPhotoPro
04-05-2012, 12:25 AM
Please give us a URL to view the page. My guess is the HTML did show up, but your CSS is causing it to not do what you want.
Search this article for discussions on the problems using <li> on this page and the CSS you need to add to fix it.


Thank you for responding. My site is not operational yet, so it's turned off, but here is a screenshot of it:

http://www.macrophotopro.com/problems/articles.jpg

This is my relevant .php code (forgive me if it's hilariously wrong :) ) :

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = '';
$message = 'Hello world';
$var_name = '<h1>My Title</h1>My text<ul>
<li>Cameras</li>
<ul>
<li><a href"cameras.html">DSLRs</a></li>
<li>Point & Shoot</li>
</ul>
<li>Lenses</li>
<li>Etc.</li>
</ul>

More text.

<a href="mailto:myemail">My Email</a>';

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

$templater = vB_Template::create('IMAGE_HOSTING');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('message', $message);
$templater->register('var_name', $var_name);
print_output($templater->render());

?>

This is my template:

{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 Macro Image Hosting}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

<div id="Macro Image Hosting">
<h1>{vb:raw pagetitle}</h1>
</div>

<h2 class="blockhead">Macro Image Hosting</h2>
<div class="blockbody">
<div class="blockrow">
{vb:raw message}
{vb:raw var_name}
</div>
</div>

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


Again, forgive me if it is all hilariously wrong, but I am a rank beginner :D

Jack

AusPhotography
04-05-2012, 01:19 AM
If you want a simple skeleton page bundled together as a vB product see:
https://vborg.vbsupport.ru/showthread.php?t=266449
It provides a tab and a Google search.

Because it is so lightweight it is easy to adapt to another purpose.
I published it as 'Re-usable Code' so no ? issues.

Kym

MacroPhotoPro
04-05-2012, 02:33 AM
If you want a simple skeleton page bundled together as a vB product see:
https://vborg.vbsupport.ru/showthread.php?t=266449
It provides a tab and a Google search.

Because it is so lightweight it is easy to adapt to another purpose.
I published it as 'Re-usable Code' so no ? issues.

Kym


Thank you very much, Kym, I will try it. (Fine site BTW, congrats!)

And nice to meet another photographer too :D

Cheers,

Jack

michaelbang
04-08-2012, 11:01 PM
Is it possible to create a new page, containing a new forum with new sections? I mean, basically copy the excisting "Forum" page to a new page with a new title, new sections, new forums etc?

Lynne
04-09-2012, 03:09 AM
Is it possible to create a new page, containing a new forum with new sections? I mean, basically copy the excisting "Forum" page to a new page with a new title, new sections, new forums etc?
Sure, you could do that. You will need to tweak some of the code, but it will be possible. It isn't really anything to do with this article though.

dadoc
04-14-2012, 03:56 AM
How can I add my forum sidebar to the page?

Lynne
04-14-2012, 04:41 PM
You would need to add the template code from the FORUMHOME template into your template for the block and also add all the php from the forum.php file for the block to your php file (along with any templates needed, etc.)

karabaja3
04-18-2012, 08:52 PM
Did you add the template to the MASTER STYLE or just to one of your styles? And is that style the default style for unregistered users?


It's all the defaults that you get from the headinclude template. Yes, vbulletin.css is one of them.

I do not have orignal vbulletin style. Just the customized one. And I have crated a new template, just like you wroted, but when I go to www.my-forum.com/test.php I see a blank page only. No source code. Nothing.

Update: solved

wilford brimley
04-19-2012, 04:05 AM
im working on this, thanks got my page going. Ive been looking through the 50 page sbut cant find my answers.

I need.
1. page to work in all skins not just default. I put a chat box on my page and a video stream
2. only want the page visible to certian usergroups and definatly not the general public.I want a private veiwng room. thannks.

Lynne
04-19-2012, 03:18 PM
1. Then you need to add the template to all the skins.

2. Then put a condition regarding is_member_of - do a search in the thread on that function and you should find the answer.

wilford brimley
04-20-2012, 04:10 AM
ok, cool. Thanks, I figured out how to edit the MASTER STYLE via debug nad add the template all skins. I have it set to only let logged in regs see it, and made my page load from a "forum" link only visable to usergroups, however any reg and logge din user can actually access it if they know the url.

I;ll search, thanks.

--------------- Added 1334899949 at 1334899949 ---------------

found it, thanks.

addamroy
04-22-2012, 01:32 PM
Can anyone either direct me to the appropriate post, or tell me how I can execute PHP code in these custom pages?

I searched through this article and the forum itself, can't find any solid info on how to do this.

cellarius
04-22-2012, 03:09 PM
By putting it into the php file? Right after "// ###### YOUR CUSTOM CODE GOES HERE #####"?

Eq4bits
04-23-2012, 07:09 PM
vB4.1.12

successfully created php file
successfully created template

I'm using this as a custom page in my CMS (http://pendletonharbor.net/bylaws.php) (long explanation that's not pertinent) but instead of having the 'Forum' tab 'highlighted'/active and the forum navbar links I need to have the 'Home' tab 'highlighted'/active and the 'home' navbar links.

Also in Firefox v11.0 everything displays correctly, however in IE v9.0.8112.16421 the log-in in the header is whacked out and the 'page' is fluid instead of adhering to the fixed width as defined in my stylevars. (link to page in above paragraph)

Anatoliy2
05-28-2012, 10:00 AM
Thank you very much for describing how to make a custom page. I made it and everything worked like a charm! I have a question. I made a new nav tab "Links" and pointed it to my custom page links.php. How can I make that when I'm in, the "Links" tub would be highlighted, not the "Forum" as it is now. My site is www.oregonfishingforum.com

Thanks in advance!

Lynne
05-28-2012, 05:05 PM
Thank you very much for describing how to make a custom page. I made it and everything worked like a charm! I have a question. I made a new nav tab "Links" and pointed it to my custom page links.php. How can I make that when I'm in, the "Links" tub would be highlighted, not the "Forum" as it is now. My site is www.oregonfishingforum.com

Thanks in advance!
You would enter into the Tab Script(s) field what you entered as THIS_SCRIPT in your page.

thecoo1est
05-30-2012, 03:36 AM
Hi Lynne, Would you answer one question for me? Im not sure I fully understand how to call additional templates in to existance.

I have the "custom home" template setup with your settings looks great of course. I then added another template, its a slideshow slider. How do I call the "slideshow" template into the" custom home" template above the vb:raw footer?

What exaclty would I need to do to the php file?

I know the slider works because if I add it to the custom home template I can see it, but I would rather have it in its own template for easy editing when I apply new pictures and links.

Anatoliy2
05-30-2012, 07:22 AM
You would enter into the Tab Script(s) field what you entered as THIS_SCRIPT in your page.
Thanks for the answer! That's what I did originally and it doesn't work. :( I created file links.php (put it in the root), created a new template TEST, made a new nav tab Links, put links.php in the Tab Script(s) field. Doesn't work. The "Forum" link is highlighted when I'm on links.php page. :( Please help to understand what I'm doing wrong.

Lynne
05-30-2012, 04:28 PM
Hi Lynne, Would you answer one question for me? Im not sure I fully understand how to call additional templates in to existance.

I have the "custom home" template setup with your settings looks great of course. I then added another template, its a slideshow slider. How do I call the "slideshow" template into the" custom home" template above the vb:raw footer?

What exaclty would I need to do to the php file?

I know the slider works because if I add it to the custom home template I can see it, but I would rather have it in its own template for easy editing when I apply new pictures and links.
You need to first render the "slideshow" template and then add the results of it as a variable into the "custom home" template.

$newTemplate = vB_Template::create('slideshow');
$newTemplate->register('variable1', $somearray);
$newTemplate->register('variable2', $variabletwo);
$slideshow = $newTemplate->render();

then register slideshow for use in the "custom home" template.

Thanks for the answer! That's what I did originally and it doesn't work. :( I created file links.php (put it in the root), created a new template TEST, made a new nav tab Links, put links.php in the Tab Script(s) field. Doesn't work. The "Forum" link is highlighted when I'm on links.php page. :( Please help to understand what I'm doing wrong.
Tab Script is probably just "links" - check to see what variable you defined as THIS_SCRIPT at the top of the page.

Anatoliy2
05-30-2012, 08:15 PM
Tab Script is probably just "links" - check to see what variable you defined as THIS_SCRIPT at the top of the page.
It works! Thank you very much!

Dave-ahfb
06-01-2012, 03:44 PM
How can we get custom pages to pull a custom child style?

Lynne
06-01-2012, 03:48 PM
How can we get custom pages to pull a custom child style?
I don't understand what you mean. You want a certain style on your custom page? Then write that in the PHP of your page.

Dave-ahfb
06-01-2012, 04:27 PM
Then write that in the PHP of your page.

I should have thought of that....oh, I did. When I realized that I did not know how, I posted here.

Each forum section on my site uses its own template set, I would like to utilize the different styles in the respected off forum sections.

green widget forum= green widget style= I want to use this style in my green widgets tutorials which are integrated using the methods explained in this thread.

red

blue

yellow

kh99
06-01-2012, 05:01 PM
Each forum section on my site uses its own template set, I would like to utilize the different styles in the respected off forum sections.


I looked in to this and can't find a really good way to do it. You could create a plugin using hook global_bootstrap_init_start, check for your value of THIS_SCRIPT and call $bootstrap->force_styleid(); (passing it the id of the style you want to use). I know, it seems strange that you shoudl have to have a plugin when you're writing your own script, but the problem is that the style is decided on and loaded all within global.php.

I suppose another method would be to be to copy the code from global.php instead of including it, then you can insert a call to force_styleid(). But then you might have to update your scripts if global.php changes in a later version.

A style can be specified in the parameter "styleid", so you might be able to do something like set $_REQUEST['styleid'] before global.php is included, but I notice that that sets a cookie with that style value, and I'm not sure if that will affect other pages or not.

Dave-ahfb
06-01-2012, 05:38 PM
I looked in to this and can't find a really good way to do it. You could create a plugin using hook global_bootstrap_init_start, check for your value of THIS_SCRIPT and call $bootstrap->force_styleid(); (passing it the id of the style you want to use). I know, it seems strange that you shoudl have to have a plugin when you're writing your own script, but the problem is that the style is decided on and loaded all within global.php.

I suppose another method would be to be to copy the code from global.php instead of including it, then you can insert a call to force_styleid(). But then you might have to update your scripts if global.php changes in a later version.

A style can be specified in the parameter "styleid", so you might be able to do something like set $_REQUEST['styleid'] before global.php is included, but I notice that that sets a cookie with that style value, and I'm not sure if that will affect other pages or not.

Now I am beginning to understand.

I should be able to create globalgreenwidget.php, specify $bootstrap->force_styleid(); and of course change the custom page call to global to globalgreenwidget.php.

The downfall as mentioned above, is having to maually fix this with every upgrade.

cellarius
06-01-2012, 05:41 PM
AFAIR, the GET-method will set the style cookie. The best and easiest option really is to go with the plugin, in my opinion. Just have one plugin for all your custom pages, supply them with a unique THIS_SCRIPT or a unique constant of your choice, and switch it.

--------------- Added 1338576139 at 1338576139 ---------------

Our posts crossed. You cannot use $bootstrap->force_styleid() in your own php page. You need to create a plugin, jsut as kh99 explained. Then there's no problem on updates.

Dave-ahfb
06-01-2012, 05:47 PM
Can you give me an example?

cellarius
06-01-2012, 05:57 PM
Well, it's everything there, really.

In your own page, do something like this:
After "define('THIS_SCRIPT', 'test');", add
$force_my_style = 5;
where 5 needs to be replaced with the styleid of the style you want to use on that page.

Then create a plugin at global_bootstrap_init_start

if ($force_my_style)
{
$bootstrap->force_styleid($force_my_style)
}

Not tested, should work.

Dave-ahfb
06-01-2012, 08:13 PM
not working, even tried registering $force_my_style on the custom page, still the parent style

kh99
06-01-2012, 08:27 PM
That's my fault - try using hook global_bootstrap_init_complete.

Sorry...one more time. This time I tested it: use hook global_bootstrap_complete and change the code to:

global $force_my_style;
if ($force_my_style)
{
$this->force_styleid($force_my_style);
}


BTW, nice solution, cellarius. Maybe this should be added to the article.

Dave-ahfb
06-01-2012, 09:14 PM
Works great, thanks!

This will help maintaining different ads per category

cellarius
06-02-2012, 07:47 AM
BTW, nice solution, cellarius. Maybe this should be added to the article.
Well, I'll return the applause :cool: After all, the idea came from you, and you've been the one refining it :up:

kh99
06-02-2012, 10:56 AM
Well, I'll return the applause :cool: After all, the idea came from you, and you've been the one refining it :up:

Well, not to go on too long with the mutual admiration, but the thing that bothered me about using a plugin was having a bunch of checks for THIS_SCRIPT and coding in styleids, but your scheme puts the styleid in the script. (...and all I really did was to debug it).

stb74
06-05-2012, 02:40 PM
I have been able to create my custom pages ok and use the following code for my templates


// ###### When do == 'xxx' #####
if ($_REQUEST['do'] == 'players')
{
$pagetitle = 'NI Football Fantasy League Players';

$templater = vB_Template::create('fantasy_players');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
}

// ###### When do == 'yyy' #####
if ($_REQUEST['do'] == 'rules')
{
$pagetitle = 'NI Football Fantasy League Rules';

$templater = vB_Template::create('fantasy_rules');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
}

// ###### When do does not equal 'xxx' or 'yyy' #####

$pagetitle = 'NI Football Fantasy League';

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


I am using v 4.2 and I have created a manin menu using the Navigation Manager and also sub menus. The main menu gets selected ok and highlighted but my sub menus are not. I have looked around the forums for an answer but can't find any. Any ideas or links to how I do this thanks.

Lynne
06-05-2012, 02:43 PM
I have been able to create my custom pages ok and use the following code for my templates

I am using v 4.2 and I have created a manin menu using the Navigation Manager and also sub menus. The main menu gets selected ok and highlighted but my sub menus are not. I have looked around the forums for an answer but can't find any. Any ideas or links to how I do this thanks.
Sounds to me like you are having problems setting up your tab in the Navigation Manager, not that you are having problems with your page itself. I'd suggest you post in the main forums for help with your NM settings.

fotoking
06-16-2012, 03:35 AM
Hello everyone,

I'm new here and I'm urgently looking for help in regards to this topic. Here's my issue:

1: I have created a custom page with a .php uploaded to the root folder as per the instructions.

2: Both of this I have created a template on the Default Style and Mobile Style.

3: The issue is I can view the page normally on the desktop version and Andriod devices and mobile version via the desktop however when I open it on an IPhone ie IPhone 4, the entire screen goes blank and stays blank.

I appreciate all the help I can get. Thanks Guys

Lynne
06-16-2012, 05:21 PM
3: The issue is I can view the page normally on the desktop version and Andriod devices and mobile version via the desktop however when I open it on an IPhone ie IPhone 4, the entire screen goes blank and stays blank.

I appreciate all the help I can get. Thanks Guys
I'd suggest checking your error_logs (if you don't know where they are, ask your host). Here is a page from the manual about troubleshooting blank or 'white' pages: https://www.vbulletin.com/docs/html/blank_pages

kkinsey
06-21-2012, 04:29 PM
Well, Lynne, I want to thank you very much for the article; I've used it with success here @work (up to a point), but I'm very sorry I have to chime in with YAQ (Yet another question).

On our sites, I can't seem to get the site footer to work.

Here's the relevant section of my PHP script:

$navbits = construct_navbits($navbits);
$navbar = render_navbar_template($navbits);
//$templater = vB_Template::create('footer');
//if (!is_object($templater)) { die("template not object!"); }
//$footer = $templater->render();
//if (!is_object($footer)) { die("footer not object!"); }
$templater = vB_Template::create('pfs');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('checked', $checked);
// $templater->register('footer',$footer);
print_output($templater->render());
You can see I've been fudging around trying to figure this out. I even read about 24 pages of this thread before giving in to the temptation to bug you about it. ;) Not that's that would be any consolation for you, I'm afraid.

I suppose what's really confusing is that the $templater object does contain the footer code as it's supposed to. So is this some sort of rendering issue? It doesn't appear in the HTML source code of the resulting page --- no footer HTML in there at all.

Here's the 'pfs' template 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}">
<head>
{vb:raw headinclude}
<title>My Page Title</title>
{vb:cssfile faq.css}
{vb:raw headinclude_bottom}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

<div id="pagetitle">
<h1 style="font-family:sans-serif,arial;text-align:center;margin-bottom:25px;margin-top:20px;font-size:20px;background:#448ccb;width:960px;color:whi te;font-weight:bold;">A Big Header</h1>
</div>
<iframe style="border:0px;margin-left:100px;" src="http://somesite.com/myscript.php" width="760" height="1600" scrolling="no"></iframe>

<!-- FOOTER TEMPLATE IS INCLUDED BELOW THIS LINE -->
<vb:raw footer>
</body>
</html>
I can comment out the IFrame, but it doesn't seem to matter; the footer's not output/shown regardless. I do see the closing /BODY and /HTML tags.

I you don't mind to help me close this bug, I'd be quite appreciative. :) Whacks w/the clue stick are appreciated as well :D

kh99
06-21-2012, 07:08 PM
I suppose what's really confusing is that the $templater object does contain the footer code as it's supposed to. So is this some sort of rendering issue? It doesn't appear in the HTML source code of the resulting page --- no footer HTML in there at all.

You've got the wrong kind of brackets for the tag where you're inserting the footer. They should be curly braces.

kkinsey
06-21-2012, 08:20 PM
Doh! Too much stuff this week for brain to function properly! Thanks much!

Where do you want your cookies sent? :)

kh99
06-21-2012, 10:16 PM
Doh! Too much stuff this week for brain to function properly!


I looked at it twice without noticing, it was only after going back and reading the part where you said the footer string was OK that I thought it had to be something to do with the template.

jderouen
06-29-2012, 07:13 PM
I followed all the directions and got this to work for me! Yay! One question that's only indirectly related - on this custom page I've just created, I don't want to display ads. We have ads on the other parts of the forum, but I can't figure out how to tell vBulletin NOT to display ads on museumlinks.php, the page I just created.

GameOverViper
07-01-2012, 09:20 PM
I have the page working, thanks!

I'd like to know how to pull RSS from certain forums to different custom pages as well if someone can help me. I've searched google, found something but it doesn't work with vb4. Any help would be appreciated.

Lynne
07-02-2012, 03:46 PM
See these threads for methods to pull threads via javascript:
[HowTo] Display your latest threads on an external page using an RSS2 feed (https://www.vbulletin.com/forum/showthread.php?t=159044)
[HowTo] Display your latest threads on an external page using an XML feed (https://www.vbulletin.com/forum/showthread.php?t=158934)
[HowTo] Display your latest threads on an external page using an RSS feed (https://www.vbulletin.com/forum/showthread.php?t=158916)

You may need to change the html output a bit.

GameOverViper
07-04-2012, 07:35 PM
See these threads for methods to pull threads via javascript:
[HowTo] Display your latest threads on an external page using an RSS2 feed (https://www.vbulletin.com/forum/showthread.php?t=159044)
[HowTo] Display your latest threads on an external page using an XML feed (https://www.vbulletin.com/forum/showthread.php?t=158934)
[HowTo] Display your latest threads on an external page using an RSS feed (https://www.vbulletin.com/forum/showthread.php?t=158916)

You may need to change the html output a bit.

Thanks for the links. However I'm having a issue with that still. After placing the code at the top of the php page, then adding echo $rss_output; to the template, it doesn't show an RSS feed.

Nothing says what to do from there, so I'm kind of clueless on how to get the actual feed to show. What do I need to wrap around the echo $rss_output;?

I placed it inside of the following code, but I'm no expert on this.

<h2 class="blockhead">Popular Games</h2>
<div class="blockbody">
<div class="blockrow">

{vb:raw rssfeed}

</div>
</div>

kkinsey
07-05-2012, 12:47 PM
What do I need to wrap around the echo $rss_output;?
Are you feeding the rssfeed variable into the template?$templater = vB_Template::create('my_page');
$templater->register_page_templates();
$templater->register('pagetitle', $pagetitle);
$templater->register('rssfeed', $my_rs_feed_variable_here);
print_output($templater->render());If you are and it's not working, I'd wonder if the variable is null for some reason.

Thread addendum:

Suppose you wanted to feed a $_SERVER variable into the template? Is there a native vBulletin function I could use to clean it prior to feeding it to $templater->register()?

kh99
07-05-2012, 02:37 PM
Suppose you wanted to feed a $_SERVER variable into the template? Is there a native vBulletin function I could use to clean it prior to feeding it to $templater->register()?

You could use $vbulletin->input->clean_gpc('s', 'varname', TYPE_NOHTML) (or whatever type you want, of course).

kkinsey
07-05-2012, 04:23 PM
Hmm, doesn't seem like I can. I had already discovered clean_gpc in the developer's guide; tried it with 'r' and 'p' ... null string result. And 's' is also null.

Guess I'll need to hunt down the location of clean_gpc (obviously in the input class ... wherever that is) and see what I can figure out.

kh99
07-05-2012, 07:18 PM
Guess I'll need to hunt down the location of clean_gpc (obviously in the input class ... wherever that is) and see what I can figure out.

Yeah, it's in includes/class_core.php. I haven't tried it, but it looks to me like 's' should get variables from $_SERVER.

kkinsey
07-06-2012, 02:05 PM
Indeed, it does.

I just wasn't thinking inside the framework ;)

//this won't work
$foo = $vbulletin->input->clean_gpc('s',$_SERVER['SOME_VAR'],TYPE_NOHTML);
// this is correct!
$bar = $vbulletin->input->clean_gpc('s','SOME_VAR',TYPE_NOHTML);

bzcomputers
07-11-2012, 09:15 AM
I first want to state I have read through this whole thread and tried to fix my issues but couldn't...

First issue I have is I'm trying to call up a template within a template. I've tried numerous codes but with no results. I have created pages based off the code presented here which I have working great pulling up single templates.

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

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

?>

What I am trying to do now is call up another template named "ccl_navigation" within the first template shown above "ccl_infoandtips". I've tried numerous things here in the php and also in the original template but still couldn't get the second template to render at all.

--------------------------------------
Second issue I'm having is with custom pages that are residing outside of the forum subdirectory. Everything with relative links is showing multiple errors in cpanel for every page. They include /clientscript, /images/misc, images/buttons, etc. I do see how they are referenced by a relative link but I have this:

<base href="{vb:raw basepath}" /><!--[if IE]></base><![endif]-->

in the headinclude template and thought that should of stopped the issue from occurring in the first place, but as you can see it hasn't. I don't actually see any visual problems with these pages, just the hundreds of errors recorded every hour.

Thanks for any help.

kh99
07-11-2012, 09:46 AM
First issue I have is I'm trying to call up a template within a template.

You should be able to render one template, save the result in a string, then register it as a variable in another template, like:

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
$templater = vB_Template::create('ccl_navigation');
// register whatever variables ccl_navigation needs here
$ccl_navigation = $templater->render();

$templater = vB_Template::create('ccl_infoandtips');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('ccl_navigation', $ccl_navigation);
print_output($templater->render());

?>




Then in the ccl_infoandtips template, put {vb:raw ccl_navigation} wherever you want it.

I don't know the answer to the second question, but I'd try using Firefox with Firebug to see what your page is trying to load.

bzcomputers
07-11-2012, 07:15 PM
Thanks kh99 for the help on the template within a template - worked perfectly! ..now lots of templates to edit

angeljs
07-13-2012, 11:06 AM
So helpful, thank you!

owning_y0u
07-14-2012, 02:46 PM
How do i make a tab in the navbar selected when using custom pages? have tried to use THIS_SCRIPT as condition for the navigation but it wont work.

Lynne
07-14-2012, 04:02 PM
How do i make a tab in the navbar selected when using custom pages? have tried to use THIS_SCRIPT as condition for the navigation but it wont work.
If THIS_SCRIPT is unique, then it should work. But, that is really something you should post in the main forums for help with since this article isn't about tabs.

KGodel
07-21-2012, 03:58 AM
Hey all! Sorry if this is answered, but after reading this thread I may have missed the answer. When adding custom pages to your location code using the location hooks, I have yet to figure out how to distinguish between pages when you have one file which becomes a "different page" based on a variable, i.e. page.php?page=1. In the online_location_process hook, how can I get 'page' variable to distinguish between pages to give different results when viewing Who is Online? I have tried both $_GET and $_REQUEST switches, but they do not seem to work.

Lynne
07-21-2012, 04:21 PM
$_GET should work. But, you really should start your own thread in the programming forum and include your code so we can take a look at it.

PrivateFTA
07-25-2012, 01:41 AM
very good song

omega79
09-26-2012, 03:46 PM
may sound stupid ... but how do i add a grid to that ne page?

Lynne
09-26-2012, 04:05 PM
A grid? You would just use <div> tags with classes and then set widths and float them left or right depending on what you want. You could probably google the html you would need.

omega79
09-26-2012, 04:11 PM
ah okay so i have to do all the code ... i thought there is maybe just a line with that i could add a grid that i created in the cms ...

i think it is a big missing point that you can not just create a new page within the cms ...

but thanks for this tutorial :D

//edit
it looks like this now
http://www.crafters-united.de/vbb/server.php?tabid=37
would like to have it look like this
http://www.crafters-united.de/vbb/content.php

my point is that i have to change the code over and over again for the custom page (if i want to test different positions of the boxes)
while for the start page i just drag and drop in the "acp>cms>Layout" section and push "save"

i hope you know what i mean ... i wisch i could do this with the custom php files also

Lynne
09-26-2012, 04:47 PM
Why are you using this tutorial if all you want to do is add articles to your CMS? This article has nothing to do with the CMS.

omega79
09-26-2012, 06:41 PM
i not want articles...
i want to open a new site on wich i will show something like the server-rules ...
it only should have the look of the front page ...
there is no need for articles on that new site ...

but while reading i thought i could open like a new section or something and just post one article ...
(just do not know how to do that ...yet ... have to figure that one out ... tomorrow)

i am really new to this and i am reading hours after hours, but thats hard if you not know anything about things like css and php
and only have basic htm skills ...

i am not a coder, i just run a small community site with a view hundert members ...

so please bear with me ... i know this "RTFM" or "use google" attitude is wide spread around any sort of coding community ... i hope this one is not like those others

Lynne
09-26-2012, 08:52 PM
Well, I honestly don't know what you are trying to do. If you want this to be in the CMS, and look like the CMS, then you should put this article into the CMS. If you want this to be a separate page, but you want it to look like the CMS, then you would need to find the CMS grid template and paste that code into the page (and possibly add some CSS to the template also). There are really no instructions anywhere on how to make your custom page look like a CMS page. And certainly, adding any widgets to the page is going to take custom coding and I can't point you to any article about that either.

Bluefin221
09-27-2012, 08:55 PM
How many times can I use this, can I make multiple pages using this method?

Also what was strange is that I had to add my content to the style manager as when I called this part the page was pure white.

define('THIS_SCRIPT', 'test');

Obviously changed test to the page I was calling but it wouldn't call anything.

As you can see reverted to normal and it will not call the page: http://www.fpcforums.com/forums/stream.php

I'm trying to call this: http://www.fpcforums.com/forums/streams/livestream1.php

What I want to do is have a landing page which lists all the streams then when you click on a link it takes you into that streams page.

Lynne
09-27-2012, 10:03 PM
define('THIS_SCRIPT', 'test'); does not "call" anything. I don't know what you are talking about at all.

You may create as many pages as you want using this method as long as you use a different template (if needed) and different script names for each page.

DefiantComplex
10-10-2012, 01:23 AM
Ok so i gave it a shot, works great.

However i do have a question. I own forum classic and i want a portal, however i want to build my own.

Now i have my page sitting @ root, and the forums @ forum. , not a problem session works and all.

The problem is, when i login from the root not forum. i get a url invalid redirect. Anyone know how to fix this?

Thanks.

aryung
11-02-2012, 06:16 AM
My forum have no Content view access for guests
to view content visitor must have to register first
but on this test.php custom page i want to allow guests to read content

how i setup this please help

cellarius
11-02-2012, 06:42 AM
Have you tried it? Just do nothing, i.e create the page as described. You would have to add permission checking if you wanted it.

aryung
11-02-2012, 02:57 PM
Have you tried it? Just do nothing, i.e create the page as described. You would have to add permission checking if you wanted it.

yes i do as described works well
the only problem is that it redirects to login page due to no guest access of whole forum
i check register.php and its template thoroughly to check which line of code pass permissions but did not found anything

so on this page how i add permissions for guests ?

Lynne
11-02-2012, 03:30 PM
What is the content of your php page? (Please use the code tags.)

aryung
11-02-2012, 05:47 PM
Content of the page is simple text not code lines
Which tells
Why unregistered or not logedin users are not able to access Forum
Why our forum is private to registered members only
actually these are Lessons for students and forum only allow our academy students to view threads

Lynne
11-03-2012, 01:41 AM
Content of the page is simple text not code lines
Which tells
Why unregistered or not logedin users are not able to access Forum
Why our forum is private to registered members only
actually these are Lessons for students and forum only allow our academy students to view threads
This article is about writing a php page which is code. Are you saying that your problem has nothing to do with a php page you created? If so, then you shouldn't be posting in this thread. If it does have to do with the php page you created, then you need to post the code.

ARNK
11-03-2012, 11:54 PM
1. Create the php page:
Where do you put this file specifically?

2. Create the Template:
- If you are in debug mode, create the template in your MASTER STYLE so it shows up in all your styles, otherwise make sure you create the template in the style you are using. If following the page above, call the template TEST (WARNING: the template name is CASE SENSITIVE!!!) with the following content:
Where does this file go specifically? Where does the code go?

What should it be named?

I need this in layman's terms please ;)

cellarius
11-04-2012, 07:35 AM
What file? There is no file involved. You create a new template for your style in the Style Manager.
http://www.vbulletin.com/docs/html?manualversion=40200603

aryung
11-04-2012, 08:10 PM
This article is about writing a php page which is code. Are you saying that your problem has nothing to do with a php page you created? If so, then you shouldn't be posting in this thread. If it does have to do with the php page you created, then you need to post the code.

We know Register.php loads if registration is enable no mater forum is open or private the line define('THIS_SCRIPT', 'register'); makes it happen. it seems Permissions for Register dot php/Template setup in a file to bypass CanView restrictions for not logedin / not registered usergroup

i do not need to do anything with test.php i put my Text Here
<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">
Our Forum is Private to our Academy Students Only
</div>
</div>

ARNK
11-05-2012, 03:26 AM
What file? There is no file involved. You create a new template for your style in the Style Manager.
http://www.vbulletin.com/docs/html?manualversion=40200603

1. Create the php page:
- Create a new file, whatever you want to call it (let's say test.php).
- Open up test.php and add the following (replace TEST with whatever template you want to show - WARNING: the template name is CASE SENSITIVE!!!):

If we're to create a new PHP page, does it not have to go somewhere?

kh99
11-05-2012, 12:52 PM
You can name your php file whatever you want, as long as it ends in .php and isn't named the same as one fo the existing vbulletin files. It should go in your forum directory, the same directory with fourm.php, showthread.php, etc.

aryung
11-07-2012, 05:33 AM
i am waiting for response according to non registered / not logedin users permissions

miner
11-07-2012, 05:58 AM
Nice article.

Lynne
11-07-2012, 05:09 PM
i am waiting for response according to non registered / not logedin users permissions
I don't understand your question. We have covered code for conditions based on members versus guests viewing the page. I'd suggest reading through the thread or using the Search option for the thread.

mokujin
11-09-2012, 09:56 AM
i do not need to do anything with test.php i put my Text Here
<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">
Our Forum is Private to our Academy Students Only
</div>
</div>

I think this article help you: https://vborg.vbsupport.ru/showthread.php?t=231525

aryung
11-17-2012, 05:46 PM
Thanks Mokujin for the link but this would not help me
as i did this on first attempt
though worked fine but messed

however i achieve with define('THIS_SCRIPT', 'register');

mokujin
11-18-2012, 01:34 PM
Thanks Mokujin for the link but this would not help me
as i did this on first attempt
though worked fine but messed

however i achieve with define('THIS_SCRIPT', 'register');
You know I really dont understand what you have with register.php file?
Lets say you are the administrator and your usergourpid is 6, right?
New members who registered have usergroupid 2 .
And your students, you will have to move them to an another usergroup, lets say usergroupid is 15

And your file test.php will allow your students (and yourself) to access it - test.php file?

aryung
11-20-2012, 04:56 AM
Actually if some one is already registered he is not restricted to access forum

define('THIS_SCRIPT', 'register'); if registered user visit register.php it will say you already a member go login and if guest it will load registration page

on my test.php
if user is loged in in it will load some instructions because i cant say "you are restricted" to those whom are not restricted.

and if guest test.php will tell why you are restricted to access

that's why i use this script 'register'
if condition works fine for content load but create problems when i add some input fields for guests
<vb:if condition="$show['guest']">Show this to guest only</vb:if>

richardevans123
01-03-2013, 01:13 PM
I have a problem, when I load the page, it logs me out, and when I log in, it gives me an invalid redirect.

Any way to resolve this? Thanks

Lynne
01-04-2013, 02:02 AM
I have a problem, when I load the page, it logs me out, and when I log in, it gives me an invalid redirect.

Any way to resolve this? Thanks
Can we get a link to the page and a test username/password.

GameOverViper
01-25-2013, 09:17 PM
How would I go about making a new page layout like this for a sub-domain?

Lynne
01-26-2013, 12:53 AM
How would I go about making a new page layout like this for a sub-domain?
I'm not sure what you mean.

GameOverViper
01-26-2013, 11:42 PM
I'm not sure what you mean.

Say I want to take the domain Xbox360Clans.net and make a page on vbulletin with blackops2.xbox360clans.net. How do I go about doing this so that the sub-domain works with the site?

Lynne
01-27-2013, 03:12 AM
Say I want to take the domain Xbox360Clans.net and make a page on vbulletin with blackops2.xbox360clans.net. How do I go about doing this so that the sub-domain works with the site?
I guess that depends on how you set up the sub-domain. But, I really don't know. Did you try the script? Make sure the include is pointing to the correct place? Check your error_logs?

RisingGlow
02-03-2013, 04:18 AM
How do I make it so the page is restricted to usergroups?

Digital Jedi
02-03-2013, 04:43 AM
How do I make it so the page is restricted to usergroups?
Check page 19 of this thread.

richardevans123
02-03-2013, 11:14 AM
Can we get a link to the page and a test username/password.

The Custom Code I'm using is under "http://holodeck.section31rp.com/forms.php"

And I'm logged in on the main forums, but not here on my custom page. (Note: I am editing this file to use with a mod. I have got the main file for creating forms - but i've added chdir ('/home/******/public_html/'); to make it work)

Thanks

fxdigi-cash
02-25-2013, 04:34 AM
great article, Thanks Lynne.

I have one question though. Say that my forum is located under www.mydomain.com/forum and I want to create a custom page with forum template, but in the main folder "out of the forum" like this www.mydomain.com/index.php

does that work? if yes, what changes I have to make, please.

Thanks in advance

Lynne
02-25-2013, 06:53 PM
great article, Thanks Lynne.

I have one question though. Say that my forum is located under www.mydomain.com/forum and I want to create a custom page with forum template, but in the main folder "out of the forum" like this www.mydomain.com/index.php

does that work? if yes, what changes I have to make, please.

Thanks in advance
I don't know if it would work since I have never tried it, sorry.

fxdigi-cash
02-27-2013, 01:34 AM
Thanks again for the great tips, Lynne.

I have one more question about if it is possible to add a custom: header, navbar, footer, ...etc...

if yes, how can I achieve that?

Thanks

P.s: I'm looking for customizing independent pages with different style and design within the vb forum... would that be possible?

Digital Jedi
02-28-2013, 03:52 AM
Thanks again for the great tips, Lynne.

I have one more question about if it is possible to add a custom: header, navbar, footer, ...etc...

if yes, how can I achieve that?

Thanks

P.s: I'm looking for customizing independent pages with different style and design within the vb forum... would that be possible?
If you use the vB CSS classes, then it will match whatever skin you've created the templates in. If you're trying to use different styling, then you have to customize you're own CSS.

fxdigi-cash
02-28-2013, 03:57 AM
Thanks @Digital for the great comments.

I have one more question though. If I want to use two styles at the same time indicating each custom page to use for example style 1 and other custom page use style 2, is that possible?

if yes, how to define or indicate the style to each page independently?

any idea?

Digital Jedi
02-28-2013, 04:27 AM
If you're customizing your own CSS, you can do whatever you want. There's no limitations there. But if you mean using the different styles in your Style Manager, then that's a little trickier. You can just put the style ID in the link to those pages, but that would set each user's options to that style each time they visited. I know forums can be set to force use a style without doing that, but I'm unfamiliar with how to do that for a custom page.

fxdigi-cash
02-28-2013, 05:10 AM
Thanks @Digital for the information.

I guess I will have to find a way to force the general style to forum pages while the custom style is used for custom pages.

now I believe I need to look around the net to digg more for this issue.

Thanks again. That was very helpful

cellarius
02-28-2013, 06:59 AM
You should be able to do something like that at in a plugin on hook style_fetch
if (THIS_SCRIPT == "test")
{
$styleid = 4398;
}

Where 4398 of course needs to be replaced by the id of the style to be used, and THIS_SCRIPT needs to equal the constant you are setting on your custom page.

fxdigi-cash
02-28-2013, 01:42 PM
You should be able to do something like that at in a plugin on hook style_fetch
if (THIS_SCRIPT == "test")
{
$styleid = 4398;
}

Where 4398 of course needs to be replaced by the id of the style to be used, and THIS_SCRIPT needs to equal the constant you are setting on your custom page.

Thanks @cellarius for the information.

I found this thread also talking about the same thing I'm after: https://vborg.vbsupport.ru/showthread.php?t=267775

The one who asked the question in that thread mentioned the solution which is this code:

if (STYLEID == 1){
Code
}

And to be honest with you, my knowledge in PHP is not that good, but only html and css. so I'm wondering if you can explain where to place that code, please.

as you know in the custom page, which is html or php and the template that I can create from vb admin cp.... so where exactly should I insert that code?

looking forward to hearing from you :)

Digital Jedi
02-28-2013, 06:55 PM
That particular link is not the same thing that cellarius posted. That's a plugin that would only execute when a particular style is used. Not the other way around.

In your Admin CP in Plugins & Products, you'll see the Add New Plugin option. You put the code there in a new plugin, and select the hook cellarius mentioned. You should remember what THIS_SCRIPT is, as it's what you changed one of the test lines to when you created your custom page.

brandondrury
02-28-2013, 09:37 PM
Is there anything that has changed in vB4 over its progression that would cause the original code on the first page to not work?

I've used this as my starting point for an upgrade script I've had for years, but it stopped working and I'm trying to track down why.

I'm having the exact same problem on a clean local install of vBulletin.

Thanks!

Brandon

Lynne
03-01-2013, 02:15 AM
There isn't anything in the first post code that has changed. If you need us to take a look at your exact code, you should make a thread in the vB4 Programming forum and post your php code and template code and let us have a link to your page so we can see what is going on.

fxdigi-cash
03-01-2013, 04:05 AM
That particular link is not the same thing that cellarius posted. That's a plugin that would only execute when a particular style is used. Not the other way around.

In your Admin CP in Plugins & Products, you'll see the Add New Plugin option. You put the code there in a new plugin, and select the hook cellarius mentioned. You should remember what THIS_SCRIPT is, as it's what you changed one of the test lines to when you created your custom page.

Thank you so much @Digital.

That was clear.

I followed the steps you mentioned, but it seems there is something wrong with the style. I have tested the style on vb pages, but the custom page shows weird styling.... :confused:
it is like interaction between main style and other style.

by the way, in your code if (THIS_SCRIPT == "test")
{
$styleid = 4398;
} "test" is for what?? is it customized page name or customized template name? sounds to me it is a page name ;)

any idea what's going on here?

Thanks

Digital Jedi
03-01-2013, 04:38 AM
Remember in your custom page, where you changed the text in green?
define('THIS_SCRIPT', 'test');
That's THIS_SCRIPT. Whatever you changed test to, is what you use in the plugin.

Can you link us to your page so we can see exactly what you mean by interacting?

fxdigi-cash
03-01-2013, 06:21 AM
Remember in your custom page, where you changed the text in green?

That's THIS_SCRIPT. Whatever you changed test to, is what you use in the plugin.

Can you link us to your page so we can see exactly what you mean by interacting?

ok, great. Thanks again.

for the style, I made actually a little mistake.... forgot to clear the browser cache and that's why the style was messy.... :D

Thanks again. That was very helpful

P.S: I found here at vbulletin.org a mod that let admin to use a global custom footer, any idea if this can replace $footer or {vb:raw footer}

brandondrury
03-01-2013, 07:59 PM
Thanks for the help. It turns out that it was a strange pathway issue in both situations. I'm not sure how that changed on my site, but I've got it working. Thanks for the swift help!

Brandon

BigAl205
03-04-2013, 12:36 PM
I run two forums hosted on two different servers. Is there a way to use this modification to pull the activity stream from the other forum?

I tried doing an RSS feed, but I would have to have a feed for every subforum, unless someone know how to feed the whole forum.

BigAl205
03-23-2013, 09:17 AM
I figured out how to do the feed for the whole forum, but it will create a new thread for every thread posted on the other forum. I just want a page or side block on site A showing "What's new on site B". Any ideas would be appreciated.

Lynne
03-23-2013, 04:00 PM
I figured out how to do the feed for the whole forum, but it will create a new thread for every thread posted on the other forum. I just want a page or side block on site A showing "What's new on site B". Any ideas would be appreciated.
This isn't an article on creating a sideblock. If you want to just have a sideblock, then go to: vboptions > forum sidebar > set those to what you want
forums & moderators > forum blocks > add the blocks you want

So, create a php block and put your code in there.

BigAl205
03-24-2013, 12:53 AM
I figured out how to do the feed for the whole forum, but it will create a new thread for every thread posted on the other forum. I just want a page or side block on site A showing "What's new on site B". Any ideas would be appreciated.

This isn't an article on creating a sideblock. If you want to just have a sideblock, then go to: vboptions > forum sidebar > set those to what you want
forums & moderators > forum blocks > add the blocks you want

So, create a php block and put your code in there.Perhaps I should have emphasized that I want a page to do this and If I can't have that, I will attempt a side block. My problem is that I don't know how to pull the activity stream from another forum on a different server.

cellarius
03-24-2013, 09:52 AM
Which still has nothing whatsoever to do with this tutorial.

ar15dcm
05-01-2013, 11:02 PM
Yes I am a noob...

In which file do I add the code so users on the page display properly in the whos online?

Lynne
05-01-2013, 11:05 PM
Yes I am a noob...

In which file do I add the code so users on the page display properly in the whos online?
It's covered in the article on page 1.

ar15dcm
05-01-2013, 11:12 PM
Okay I will look again...

--------------- Added 1367453675 at 1367453675 ---------------

Is this the file? where is it located? what is the file extension?

1. hook location - online_location_process:

--------------- Added 1367454121 at 1367454121 ---------------

Can you please point out it says where you are supposed to place the code? I am not a code wizard and I'm really trying to learn this stuff. I think sometimes it gets forgotten that there are newbies on the site.

Lynne
05-02-2013, 02:14 AM
You use the plugin system which is documented in the manual here - http://www.vbulletin.com/docs/html/plugin_system?manualversion=40200603

ar15dcm
05-02-2013, 10:51 AM
Thank you Lynne.

TheRealso0sick
05-09-2013, 09:10 AM
Hey thanks for this guide but i'm still having problems with it.
I managed to set up the template for the php page but it won't output vb template codes like
"{vb:raw user.musername}"

When i enter this, it shows only a blank space in the php page.

What have i done wrong?

Lynne
05-09-2013, 04:30 PM
Hey thanks for this guide but i'm still having problems with it.
I managed to set up the template for the php page but it won't output vb template codes like
"{vb:raw user.musername}"

When i enter this, it shows only a blank space in the php page.

What have i done wrong?
Did you make sure to register the variable $user to be used in the template? Did you make sure to define the variable $user in the php code prior to rendering the template?

TheRealso0sick
05-09-2013, 04:56 PM
Did you make sure to register the variable $user to be used in the template? Did you make sure to define the variable $user in the php code prior to rendering the template?

Oh, no..
To be honest i'm not so familiar with php. I only know my way around in the VB templates
and i followed your guide step by step and was wondering why it's not working.

Could you give me a step by step instruction on how to make this work?

:(

Lynne
05-09-2013, 10:51 PM
Oh, no..
To be honest i'm not so familiar with php. I only know my way around in the VB templates
and i followed your guide step by step and was wondering why it's not working.

Could you give me a step by step instruction on how to make this work?

:(
I suggest you make a thread in the main forums and post your exact php file (in php tags) and template code (in tags also) and then we can help you easier.

omriamos
05-14-2013, 09:51 AM
Hi,

I have a custom page (test.php for example) and I want to include a search results - specifically "search.php?do=getnew" - as a part of it.

e.g.
I want to have a custom header/code of some kind, like the subscribed-threads list, and afterwards to show the list of all the new posts from the forum (search.php?do=getnew).

Is it possible in any way?

Thanks

Lynne
05-14-2013, 02:57 PM
Hi,

I have a custom page (test.php for example) and I want to include a search results - specifically "search.php?do=getnew" - as a part of it.

e.g.
I want to have a custom header/code of some kind, like the subscribed-threads list, and afterwards to show the list of all the new posts from the forum (search.php?do=getnew).

Is it possible in any way?


Thanks
Sure it's possible if you code it. Are you asking if I have the code? No, I do not. You will need to code it yourself.

omriamos
05-14-2013, 04:58 PM
Well, I was hoping for a little guidance on how to add search results to my custom php page...
:)

Lynne
05-14-2013, 10:38 PM
You would need to create a search form (I would guess) and then write the queries to do the search and spit out the results. This really isn't a tutorial on how to write a form though or on how to code in PHP, so I really am not sure what you are wanting.

Crazer
05-19-2013, 04:58 PM
I hope that I am not the only one clueless, but I have been trying to find out what people mean by creating a template. Do they mean a style template, or what? Can someone please let me know? Thanks!

Lynne
05-19-2013, 06:41 PM
I hope that I am not the only one clueless, but I have been trying to find out what people mean by creating a template. Do they mean a style template, or what? Can someone please let me know? Thanks!
Yes, a style template. Admincp > Styles & Languages > find your style > Add Template (make sure you add the template to all styles on your site that you want the page to show up on).

joeychgo
06-03-2013, 05:49 AM
Is there a way to make this a fixed width box?

Lynne
06-03-2013, 04:57 PM
To make what a fixed width box - the whole page? And just this page but not the rest of the forum? You really need to be a bit more specific.

joeychgo
06-03-2013, 07:33 PM
The box below the navbar - the content area

Lynne
06-03-2013, 09:26 PM
Then if it's in a div, just set a width using css and make sure your left/right margins are set to auto.

joeychgo
06-03-2013, 11:58 PM
<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">


where? how? I tried adding width=”1000″ align=”center” with no luck

Digital Jedi
06-04-2013, 06:23 PM
<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">


where? how? I tried adding width=”1000″ align=”center” with no luck
This should technically be asked in it's own thread, since it's not a custom page question. But you set the width via CSS. This should get you started. http://www.w3schools.com/cssref/pr_dim_width.asp

joeychgo
06-04-2013, 06:39 PM
This should get you started. http://www.w3schools.com/cssref/pr_dim_width.asp


It doesn't. If it was any help to me at all I am sure I wouldn't have had to ask the question.

I don't want to spend hours trying to learn and understand something one of you could probably tell me how to accomplish in 5 minutes.

And it is about this custom page --

Lynne
06-04-2013, 09:31 PM
<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">


where? how? I tried adding width=?1000″ align=?center? with no luck
I said to use CSS.

style="width: 1000px; margin-left:auto; margin-right: auto;"

Dax IX
06-04-2013, 09:48 PM
Give a man a fish, etc...

joeychgo
06-04-2013, 09:57 PM
Thank you Lynne - we're getting closer now.

Trouble is - its still not quite right.

I used this code:


{vb:raw navbar}
<div id="pagetitle" style="width: 1000px; margin-left:auto; margin-right: auto;">
<h1>{vb:raw pagetitle}</h1><br />
</div>

<h2 class="blockhead" style="width: 1000px; margin-left:auto; margin-right: auto;">Title</h2>
<div class="blockbody" style="width: 1000px; margin-left:auto; margin-right: auto;">
<div class="blockrow" style="width: 1000px; margin-left:auto; margin-right: auto;">


and get this: http://www.lincolnvscadillac.com/tech/test.php

Lynne
06-04-2013, 10:12 PM
You get that because the other classes you are calling (block*) have their own CSS associated with the class.

<div class="blockbody" style="width: 1000px; margin-left:auto; margin-right: auto; padding: 10px;">
<div class="blockrow">

CSS is really not that hard to learn and then you wouldn't have to rely on others to fix any styling issues that come up on your site.

joeychgo
06-04-2013, 10:27 PM
CSS is really not that hard to learn and then you wouldn't have to rely on others to fix any styling issues that come up on your site.


From what I hear Xenforo isn't too hard to learn either. Probably take me less time. I cant understand why you cant just tell me what to put instead of all this aggravation. I asked a simple question, why cant you just help?

pelican
06-05-2013, 07:35 AM
by following the instructions, i successfully created a custom vb page, pull info and display it.

i am intending to create a custom file upload function with this custom page.
how can i post the info/data and capture it.

i know how to do it in normal php coding but not sure how in vbulletin environment.

assuming my custom page is fileupload.php

do i post back to the same page (fileupload.php) or another custom page (fileupload2.php) to capture the data?

what should be the form url to post to?

thanks.

Lynne
06-05-2013, 04:29 PM
I cant understand why you cant just tell me what to put instead of all this aggravation. I asked a simple question, why cant you just help?
I did tell you exactly what to change.

by following the instructions, i successfully created a custom vb page, pull info and display it.

i am intending to create a custom file upload function with this custom page.
how can i post the info/data and capture it.

i know how to do it in normal php coding but not sure how in vbulletin environment.

assuming my custom page is fileupload.php

do i post back to the same page (fileupload.php) or another custom page (fileupload2.php) to capture the data?

what should be the form url to post to?

thanks.
You can do it either way. I usually like to have just one page for a form because it seems 'cleaner' to me.

MacroPhotoPro
06-06-2013, 01:09 AM
Hello there;

I have got this page to work just fine, so long as my target page is in the main directory.

However, when I moved my page to a new (/imagehosting) directory it will no longer display.

What do I need to do to fix this?

Thanks,

Jack

Lynne
06-06-2013, 05:07 PM
Hello there;

I have got this page to work just fine, so long as my target page is in the main directory.

However, when I moved my page to a new (/imagehosting) directory it will no longer display.

What do I need to do to fix this?

Thanks,

Jack
I have not found a way to make that work. I think some default vbulletin files would need to be modified to get that to work, but I haven't spent much time looking into it.

MacroPhotoPro
06-06-2013, 08:37 PM
Anyone else have any ideas?

Thanks.

Digital Jedi
06-08-2013, 07:37 AM
From what I hear Xenforo isn't too hard to learn either. Probably take me less time. I cant understand why you cant just tell me what to put instead of all this aggravation. I asked a simple question, why cant you just help?
XenForo/vB/IPB. Basic CSS knowledge would still be required to edit raw HTML. Lynn's answer is pretty straightforward. Problem is, if you don't really understand the principle behind CSS, then it's almost impossible to make you understand it without typing out what's explained in any given CSS tutorial. And no, it wouldn't take five minutes to explain. Given the chance, it certainly won't take 5 hours to understand the width property.

joeychgo
06-08-2013, 08:33 AM
XenForo/vB/IPB. Basic CSS knowledge would still be required to edit raw HTML. Lynn's answer is pretty straightforward. Problem is, if you don't really understand the principle behind CSS, then it's almost impossible to make you understand it without typing out what's explained in any given CSS tutorial. And no, it wouldn't take five minutes to explain. Given the chance, it certainly won't take 5 hours to understand the width property.


It took someone else 5 minutes to explain it to me. They took the time.

http://www.lincolnvscadillac.com/tech/test.php

grey_goose
06-09-2013, 12:25 PM
I've added a new page, no problem. What do I need to do to be able to display custom profile fields on this new page?

Lynne
06-09-2013, 06:47 PM
I've added a new page, no problem. What do I need to do to be able to display custom profile fields on this new page?
You probably need to run a query and then you need to assign variable names to the results, register them for use in the template, and then enter/format them into your template.

Digital Jedi
06-10-2013, 10:41 PM
It took someone else 5 minutes to explain it to me. They took the time.

http://www.lincolnvscadillac.com/tech/test.php
I'm glad it worked out for you. But we took the time to give you an answer that would help you with more than just your one question. And, again, you weren't real clear the first time as to what you wanted. Which took more than five minutes to figure out ourselves. Since we didn't know what you didn't understand to start with. And we continued to help, even though it still had nothing to do with creating a custom page.

Spangle
06-24-2013, 03:14 PM
I've got this as my HTML page :
{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">Page not found</h2>
<div class="blockbody">
<div class="blockrow">
<h1> OOOPs </h1>
<h2> You've either made a typo, or tried to find a page that doesn't exist!
</br>
Now you have a choice, you can either look at this all day.
Or click <a href="http://www.primodoux.com/index.php"><span style =color:Red><h1>HERE</h1></span></a> to take you back to the index page. <br/>

<br/>
</div>
</div>

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

and I have this as the php :

<?php

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

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

define('THIS_SCRIPT', 'test');
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('notfound',
);

// 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('' => 'notfound'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Page not found';

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

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

?>

What I get from that is this :

{vb:stylevar htmldoctype} {vb:raw headinclude} {vb:raw headinclude_bottom} {vb:raw header} {vb:raw navbar}
{vb:raw pagetitle}
Page not found
OOOPs
You've either made a typo, or tried to find a page that doesn't exist!
Now you have a choice, you can either look at this all day. Or click
HERE
to take you back to the index page.

{vb:raw footer}


I think I need some help.

I'm using 4.2.1 if thats any help, and I'm trying to create a friendly 404 redirect page

TIA

Digital Jedi
06-24-2013, 03:49 PM
At first glance, at least one instance of "test" was not changed to your template name in your PHP code.

Lynne
06-24-2013, 04:01 PM
Is the page within the vbulletin directory?

Spangle
06-24-2013, 05:03 PM
At first glance, at least one instance of "test" was not changed to your template name in your PHP code.

Thanks

Fixed that one but still not working

--------------- Added 1372097097 at 1372097097 ---------------

Is the page within the vbulletin directory?


All the directories/files are uploaded to the root

ie :

public_html is my root directory

Lynne
06-25-2013, 12:13 AM
Can we get a link to view the problem?

Spangle
06-25-2013, 04:42 PM
Can we get a link to view the problem?


Go to

www.primodoux.com/faeries

Lynne
06-26-2013, 12:31 AM
You saved the template in the Style Manager, right? You didn't think we were talking about a Dreamweaver template hopefully.

final kaoss
07-11-2013, 04:25 AM
Currently giving a 404, did you give up on it?
Go to

www.primodoux.com/faeries

tommythejoat
07-19-2013, 07:06 PM
I have found this discussion very helpful in understanding how vB pages work, but I wonder if anyone has created a similar discussion on how plug-ins .work.

In particular, I think there are lots of variables in the context of all the hooks but I do not know if there is a formalism on how you reference them. Do they need to be declared? Do they need to be registered?

In particular, I added a column to the thread table and cannot for the life of me figure out how to load it from any of the new post or edit hooks.

Lynne
07-20-2013, 02:26 AM
You should ask your question in the general forums because that is out-of-scope for this article. (You may want to look through the other articles because this has actually been covered in other articles although some of it may be in vb4 articles.)

tommythejoat
07-20-2013, 02:40 AM
Thanks Lynne. I knew it was out of scope. I was hoping for a pointer. I cannot seem to generate a tight search query on this site to search articles. They alwasy return hundreds of false positives for me.

I just spent the evening reading code and found some references to query_hooks that may get me going in the right direction.

GameOverViper
07-20-2013, 03:08 PM
What do I need to do to add breadcrumbs to previous pages that I link to new pages?

For example - Page 1 > Sub Page 2

How do I get Sub Page 2 to breadcrumb back to Page 1?

MacroPhotoPro
07-28-2013, 01:15 AM
I have not found a way to make that work. I think some default vbulletin files would need to be modified to get that to work, but I haven't spent much time looking into it.

Can you please expound on this?

My entire project has come to a catastrophic halt because of this glitch.

Would greatly appreciate someone resolving this issue ...

Thanks!

Jack

--------------- Added 1374980133 at 1374980133 ---------------

Also, if I want to create a "comments" box (like what's on the blog and articles), what coding do I need to add to these custom pages?

Thanks,

edrecovery
07-31-2013, 01:40 AM
Do we need to upload the PHP file in order to make the page? Can I just copy the HTML code and paste it in the templet content fileld? also, how to you call templets? I'm visually impaired, so no screen shots please.

Lynne
08-01-2013, 01:27 AM
Yes, you need to upload the php file since that is what calls the template. If you just want a static html page, then you should just create a static .html page, not a .php page.

edrecovery
08-01-2013, 02:33 AM
How do I do that? also, where would I go to view the page? If i make a page with the CMS, will it only show up in the CMS? I want to make several pages for my website.

Lynne
08-01-2013, 03:32 PM
CMS pages only show up in the CMS.

If you make a page called test.php, then you would access it in your browser using http://yoursite.com/test.php

edrecovery
08-01-2013, 05:31 PM
Using the code provided, where do I put my templet title? where it says define this script? Please don't color code it, I can't see that.

edrecovery
08-03-2013, 06:48 PM
I've took out 'test' everywhere it said test, and when I go to http://www.growingpetals.com/home.php I get a blank page. but when I go to http://growingpetals.com/misc.php?do=page&template=home I'm able to view the page.

hinomaru
08-15-2013, 08:14 AM
Hello,

I want to make a table with 5 column at the custom page, and the page like this :

https://vborg.vbsupport.ru/external/2013/08/15.jpg

How to make it like that?

Thanks

Lynne
08-15-2013, 03:52 PM
Hello,

I want to make a table with 5 column at the custom page, and the page like this :

https://vborg.vbsupport.ru/external/2013/08/15.jpg

How to make it like that?

Thanks
Just put a table in the template code?

hinomaru
08-16-2013, 06:19 AM
yes..only put a table in the template code

Raz3r
09-21-2013, 10:16 PM
Let me apologize if this was already answered, but i have spent hours reading threw things only to NOT find the answer to my question. My question is I made the custom page without a problem and all works just fine but what i would like to do is only allow certain groups to be able to view the page what is the step by step process that is needed to accomplish this? what files do i need to edit and what is the content needed to edit them with? I hope someone out there can help me fix this as i have been stuck for a while now

Rocket2009
09-21-2013, 10:28 PM
Here is the code I use to make sure someone is a member, but you could change 'userid' to 'usergroup' with the appropriate test. I am including the banner so you can see where it fits. But it follows the require_once. I put xxxxxxx in for my account user name for the call to global.php. Hope this helps.



require_once('/home/xxxxxxx/public_html/forum/global.php');

// ################################################## #####################

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

// ################################################## #####################

if (!$vbulletin->userinfo['userid'])
{
print_no_permission();
}

Raz3r
09-22-2013, 12:09 AM
thank you for that bit of information but its still not exactly what im looking for I welcome any other suggestions again let me remind you I want to make the page so that only certain groups can view the page if possible i'm looking for the exact code needed to make this work correctly and or instructions to any files that may need edited again thank you for your response as that was one of the issues I was hoping to have corrected

ozzy47
09-22-2013, 12:11 AM
How are you showing your members that this page exists? NavTab link somewhere etc?

Raz3r
09-22-2013, 01:16 AM
yes i am showing threw the subnav under quick links I do not have currently have this to a live site yet i am currently working with localhost getting things working correctly before i put this live

Lynne
09-22-2013, 01:24 AM
Let me apologize if this was already answered, but i have spent hours reading threw things only to NOT find the answer to my question. My question is I made the custom page without a problem and all works just fine but what i would like to do is only allow certain groups to be able to view the page what is the step by step process that is needed to accomplish this? what files do i need to edit and what is the content needed to edit them with? I hope someone out there can help me fix this as i have been stuck for a while now
This has actually been covered a few times. You want a condition like this:

if (!is_member_of($vbulletin->userinfo, x, y, z))
{
// no permission if you aren't a member of usergroupid x, y, or z
print_no_permission();
}

x,y,z are usergroups that are ALLOWED.

Raz3r
09-22-2013, 03:54 AM
Thank you very much Lynne that did the trick that i was looking for I am sorry if it had been discussed before but i couldn't find the topic with it explained enough to understand again thank you

Easy5s.net
09-24-2013, 03:44 AM
- forum/my_folder/myfile.php
How to call file global.php ?

Zoul
09-26-2013, 02:34 PM
hello

is it possible to know how to do so:

the forum is:
. / Foum
and the page that I will wish to generate (List Who's Online (WOL) is here:
. / gfx

can you tell me is that there has to change and if possible
thank you

Lynne
09-26-2013, 04:02 PM
hello

is it possible to know how to do so:

the forum is:
. / Foum
and the page that I will wish to generate (List Who's Online (WOL) is here:
. / gfx

can you tell me is that there has to change and if possible
thank you
I had tried to do this before and was unsuccessful. I think you will need to just play with it yourself until you can get it to work.

Zoul
09-26-2013, 11:47 PM
thank you for the answer
it's been several months that I try
I would like to export the List Who's Online (WOL) in the gallery 4images
and three days I try this way.

is it possible to use one of these codes to match 4images and VB4.2.1?
because the integration does not work with 4images vb4.2.1 (at least not well because I managed repair part.)

just for look:
http://www.gfx-art.fr/index.php

Lynne
09-27-2013, 01:34 AM
I'm sorry, but I don't understand what you are trying to do at all and the link doesn't help me.

tbworld
09-27-2013, 01:56 AM
As @lynne said it is a bit hard to understand what you are looking for.

I managed to understand that you wanted us to view link
"http://www.gfx-art.fr/gfx/index.php".

I understand you want to use the WOL code in your pages. I do not understand the 4 images and why it is a problem in vbulletin v4.2.1?

Let me know if we are using a translator...

Zoul
09-27-2013, 08:46 AM
Hello
I'm sorry for my English (translator) and that for me to be obvious.
I'll try to be clearer.

Currently, the home page, the gallery 4 images, blog Dotclear and VB4.2.1 forum are all linked. (integrated).
There is nevertheless something that bothers me:
when somebody is on the reception, the gallery or blog, it is not recorded in the WOL Vb.
to be recognized (for a while) it is mandatory to go through the forum (visited one of the pages).

More restriction When we connect via 4images, it is redirected to 4 images and despite the time the connection is recognized everywhere, WOL Vb Does not detect the person.

the idea is to have all the stats for all pages (visitors, members ...) on the WOL forum

mm and that these stats are also on the WOL of 4 images.

catch here is to illustrate (at the same time):

Vbulletin:

https://vborg.vbsupport.ru/external/2013/09/4.png

4 images:

https://vborg.vbsupport.ru/external/2013/09/5.png


Normally both WOL should notify members 4 and 4 (Vb) +4 (4images)+ dotclear + home page = 8 visitors ++
the idea was to use the recognition Vb thanks to "Create your own vBulletin page"
to merge data

of the time someone visits or whatever the community page,
it is automatically Ressence on WOL 4 images and the Vb

and to go further
is to use the downright Vb to integrate a 4 images to have all the information and colors....



Is for you'm clear?

thank you for your help

Lynne
09-28-2013, 01:59 AM
In the very first post of this article, I reposted instructions on how to add this page to your WOL list (that is the online.php page). Did you create those plugins for all your custom pages? And did you follow this article for creating those pages? If you didn't, and someone else created those pages, then you need to ask them how to do this because I cannot help you with that.

tbworld
09-28-2013, 02:19 AM
Hello
I'm sorry for my English (translator) and that for me to be obvious.
I'll try to be clearer.

Currently, the home page, the gallery 4 images, blog Dotclear and VB4.2.1 forum are all linked. (integrated).


First --- Copy your text on the previous post and start a new thread in vb4 programming. Since this really does not have a direct relation to the thread and it might confuse people.

Two --- Thank you for writing this all out, I believe I understand what you are asking now. This is really a WOL question.

Create the new thread and I will take a look at the WOL code to see if I can be of any assistance.

Zoul
09-28-2013, 12:39 PM
hello Lynne

Thank you for your help

Yes I am the letter information
here is an almost finished page (redirect problem)
http://www.gfx-art.fr/forum/connect.php

This tutorial works very well in the directory '. / Forum' my server
but as soon as it exits the VB environment
ex: 'index.php' or '. / dotclear' or '. / gfx'
is not the case

the idea was to find a solution to a tutorial to succeed bind all those pages and even in a different folder than the vBulletin Installation

thank you

Hello tbworld

I totally understand the reasoning and voila a new open discution:
https://vborg.vbsupport.ru/showthread.php?p=2448567 # post2448567

Thank you very much for the future help

--------------- Added 1380403355 at 1380403355 ---------------

Sorry Double post but I spent the night above without success.

On this page (created thanks to a tutorial.)

http://www.gfx-art.fr/forum/connect.php

template:

{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>
{vb:raw headinclude}
<vb:if condition="$show['search_noindex']"><meta name="robots" content="noindex,follow" /></vb:if>

<title>{vb:raw pagetitle}</title>

<script type="text/javascript" src="clientscript/vbulletin_md5.js?v={vb:raw vboptions.simpleversion}"></script>

{vb:raw headinsert}
{vb:raw headinclude_bottom}



</head>
<body>

{vb:raw header}

{vb:raw navbar}

<vb:if condition="$show['guest']">

<div class="standard_error">
<form class="block vbform" method="post" action="login.php?do=login" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, {vb:raw show.nopasswordempty})">
<h2 class="blockhead">{vb:rawphrase vbulletin_message}</h2>

<input type="hidden" name="do" value="login" />
<input type="hidden" name="url" value="{vb:raw scriptpath}" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
{vb:raw postvars}
<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<div class="blockbody formcontrols">

<h3 class="blocksubhead">Bienvenue, merci de bien vouloir vous connectez</h3>
<div class="blockrow restore">{vb:raw errormessage}</div>
<vb:if condition="$show['register_message']">
<p class="blockrow">{vb:rawphrase admin_required_register, {vb:raw session.sessionurl}}</p>
</vb:if>

<h3 class="blocksubhead">{vb:rawphrase log_in}</h3>
<div class="blockrow">
<label for="vb_login_username">{vb:rawphrase username}:</label>
<input type="text" class="primary textbox" id="vb_login_username" name="vb_login_username" accesskey="u" tabindex="1" />
</div>
<div class="blockrow">
<label for="vb_login_password">{vb:rawphrase password}:</label>
<input type="password" class="primary textbox" id="vb_login_password" name="vb_login_password" tabindex="1" />
</div>
<div class="blockrow singlecheck">
<label for="cb_cookieuser"><input type="checkbox" name="cookieuser" id="cb_cookieuser" value="1" tabindex="1" /> {vb:rawphrase remember_me}</label>
</div>

</div>
<div class="blockfoot actionbuttons">
<div class="group">
<input type="submit" class="button" value="{vb:rawphrase log_in}" accesskey="s" tabindex="1" />
<input type="reset" class="button" value="{vb:rawphrase reset_fields}" accesskey="r" tabindex="1" />
</div>
</div>
</form>
</div>

<vb:if condition="!$show['enableforumjump']">{vb:raw forumjump}</vb:if>
<vb:else />

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


PHP file:

<?php

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

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

define('THIS_SCRIPT', 'Connect');
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('Connect',
);

// 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('' => 'Connect Page'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'GFX-Art Connexion';

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

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

?>


I have a problem redirection after being connected
it is redirected to the same page
the idea is that when you connect (the person is logged) per page, it is automatically redirected to
http://www.gfx-art.fr/forum/index.php

I have not managed to achieve despite all my tests and research on google.

Someone would have an idea of ​​idiot do this?

thank you

smirkley
09-28-2013, 09:31 PM
Lynne,

Thank you for a most excellent tutorial.

I have used this to make a product auto-templater xml as well as a generic php file if needed.

Time to use this for one of my unfinished projects.

Thanks.

FBRN_Andrew
09-29-2013, 06:44 PM
Thanks I followed this and It works pretty good, I'm not sure if I missed something. but on the top of the page, I'm getting a login box, and a "if this is your first visit...." message. but if you follow any other nav-link you're logged back in.

if anyone knows what I did wrong. I'd appreciate a heads up.

tbworld
09-29-2013, 10:04 PM
We are happy to help, but you need to show your code. Too hard to guess.

Zoul
09-29-2013, 10:28 PM
Hello FBRN_Andrew

if I'm not mistaken, and I understand the question in the template created, you just add this before the tag </head>
<style type="text/css">
#navbar_notice_1 {
display: none;
}
</style>

smirkley
10-05-2013, 04:09 AM
I love the way this mod works, and am building a functionality for my forum with it.

I have played with many variations of what I can do, but I found myself stuck in using my example.php page file to fill a variable array from a list in a custom database, and then get it to printout the list of database contents on the template form.

I will admit I havent read every page here (still workin on that lol), but I so far have not been able to figure this one out.

If anyone has sucessfully done something like this with this mod, throw me a clue of what I am not able to figure out. Thanks big time.

tbworld
10-05-2013, 05:16 AM
@smirkley, let's see what you have and you will get plenty of help. Code and programmers are seldom perfect, so do not worry about showing your code.

hellboundblogge
10-05-2013, 09:31 AM
Where to add the template?

ozzy47
10-05-2013, 09:46 AM
From the first post.

2. Create the Template:
- If you are in debug mode, create the template in your MASTER STYLE so it shows up in all your styles, otherwise make sure you create the template in the style you are using.