PDA

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


Pages : 1 [2] 3 4 5

ChangeFive
03-19-2010, 02:01 PM
They are working as defined - both of these are from the reset-fonts.css file:
h1, h2, h3, h4, h5, h6 {font-size:100%;font-weight:normal;}body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td {margin:0;padding:0;}
If you want it different, give it a class and define it yourself.

Could you explain this a little more? I finally got my test page working (a terms of service page) and tags like <p>, <h2>, <ol>, <ul>, and <strong> do not appear to work, although <b> and <br> do work for me. Thanks!

Lynne
03-19-2010, 02:32 PM
You might want to read up on CSS and how you can change the properties of a tag via a few lines of CSS. When you say <p> doesn't appear to work, what is it doing? It's hard to help when we aren't getting any specifics.

Adan0s
03-21-2010, 12:12 PM
could someone please point me to a tutorial or something like that on how to add existing things like a sidebar-block to my own page?
e.g. i create a sidebar block with the newest posts and i want that block to be rendered in my own page.

spartan1123
03-27-2010, 02:49 PM
What do i need to add to make the page show as selected if I add a tab for it?

Lynne
03-27-2010, 05:40 PM
You'd just need to change the code for the tab to show as selected when THIS_SCRIPT = 'test' or whatever you put in this line:
define('THIS_SCRIPT', 'test');

Sworm
04-01-2010, 03:57 PM
Hi lynne,
i have maded all the above steps and the page is ok, but there's a solution to integrate this html meta code in it?

<html><head><title>myforum.it - Informativa sulla Privacy e Termini d'uso</title>



<meta name="Rating" content="Safe for kids">
<meta name="Distribution" content="local">
<meta name="Identifier-URL" content="http://www.myforum.it">
<meta name="Author" content="Sworm">
<meta http-equiv="Expires" content="never">
<meta name="Robots" content="All">
<meta http-equiv="content-language" content="ITALIAN">
<meta name="Description" content="myforum.it Privacy Statement e Termini d'uso">
<meta name="Keywords" content="privacy,statement">

<style type="text/css">
BODY{
background-image:url
background-repeat: no-repeat;
background-position: left top;
background-attachment: fixed;
}

</style></head><body bgcolor="#B0E0E6" vlink="blue">
<div align="center">
<center>
<p></p>

</center>
<p align="left"></p>
<p>&nbsp;</p>
<center>
<table class="sub" style="border-color: rgb(0, 0, 128); border-collapse: collapse;" bgcolor="#00FFFF" border="20" cellpadding="7" cellspacing="0" width="69%">
<tbody><tr>
<td width="100%"><h1><font color=red>Privacy e Termini
d'uso</font></h1>
<dl>
<dt><b><font color=red>Termini d'uso</font></b>
</dt><dd> Software Upgrade fornisce le informazioni riguardanti l'utilizzo dei dati personali per l'iscrizione alla community di www.myforum.it e ai diversi servizi al suo interno, nel rispetto dei principi di protezione della privacy stabiliti dal Decreto Legislativo n. 196 del 30 giugno 2003 e dalle altre norme vigenti in materia.</dd><dt>

<b><span lang="it">Informativa sulla Privacy</span></b>
</dt><dd>I dati forniti dall'utente al momento dell'iscrizione a Software Upgrade ed ai suoi servizi saranno registrati su database elettronici di propriet? di Software Upgrade che ne sar? titolare per il trattamento.
I dati personali dell'utente saranno utilizzati da Software Upgrade nel rispetto dei principi di protezione della privacy stabiliti dal Decreto Legislativo n. 196 del 30 giugno 2003 e dalle altre norme vigenti in materia.
La presente informativa riguarda i dati personali inviati dall'utente al momento della registrazione, nonch? quelli ricavati dalle visite e navigazioni nel nostro Sito e successivamente forniti dall'utente per l'attivazione dei servizi offerti all'interno del sito.
I dati personali richiesti sono suddivisi in due categorie: obbligatori e facoltativi, come risulta nella procedura di iscrizione e di richiesta di attivazione dei servizi offerti. Il conferimento dei dati obbligatori ed il relativo trattamento per le finalit? sopra indicate sono strettamente funzionali all'esecuzione dei servizi indicati. L'eventuale rifiuto dell'Utente a fornire tali dati o l'eventuale rifiuto di consentire al loro trattamento comporter? l'impossibilit? di usufruire del servizio offerto da Software Upgrade .Gli altri dati raccolti servono ad aiutare Software Upgrade ad offrire un servizio sempre migliore. Rispetto ad essi, l'Utente ? libero di fornirli o meno.
Software Upgrade sottopone i dati personali degli utenti a tutte le operazioni di trattamento individuate dal D. lgs 196/2003 - ovvero, alla raccolta, registrazione, organizzazione, conservazione, elaborazione, modifica, selezione, estrazione, raffronto, utilizzo, interconnessione ed ogni altra operazione utile alla fornitura dei servizi richiestici, ivi compresa la comunicazione a terzi, ove necessaria - prevalentemente con modalit? automatizzate ed informatizzate. Tali dati potranno anche essere organizzati in banche dati o archivi. In particolare, le finalit? del trattamento dei dati personali sono le seguenti:</dd><dt>
</dt><dd>1) fornire i servizi previsti;
</dt><dd>2) fornire le informazioni e/o inviare comunicazioni relative al servizio;
</dt><dd>3) risalire ad autori di eventuali illeciti solo in caso di specifiche richieste e per conto delle autorit? competenti.
Qualora l'utente abbia prestato idoneo consenso (obbligatorio per i nostri servizi totalmente free)
</dt><dd>4) fornire le informazioni e/o offerte sui servizi che Software Upgrade e/o societ? affiliate e/o controllate, cos? come partners commerciali ed outsourcers che possono essere ritenute di interesse per l'utente, senza che ci? determini la cessione dei dati personali a soggetti terzi. <font color=red><b>Software Upgrade si impegna a non cedere mai i dati dei propri utenti a terzi</b></font>;
</dt><dd>5) inviare comunicazioni ed informazioni di carattere puramente informativo relative a programmi e applicativi ed iniziative proprie e di terzi;
</dt><dd>6) soddisfare indagini di mercato e statistiche, marketing e preferenze sui prodotti.</dd><dt>
</dt><dd>7)L'Utente potr? accedere ai propri dati in qualsiasi momento ed esercitare i diritti di cui all'art. 7, D. lgs . 196/2003.


</dd><dt><b><span lang="it">Software Upgrade informa che, ai sensi dell'art. 7 della D. lgs . 196/2003:</span></b>
l' Utente ha diritto di ottenere la conferma dell'esistenza o meno di dati personali che lo riguardano, anche se non ancora registrati, e la loro comunicazione in forma intelligibile. L' Utente ha diritto di ottenere l'indicazione:
</dt><dd>a) dell'origine dei dati personali;
</dt><dd>b) delle finalit? e modalit? del trattamento;
</dt><dd>c) della logica applicata in caso di trattamento effettuato con l'ausilio di strumenti elettronici;
</dt><dd>d) degli estremi identificativi del titolare, dei responsabili e del rappresentante designato ai sensi dell'articolo 5, comma 2;
</dt><dd>e) dei soggetti o delle categorie di soggetti ai quali i dati personali possono essere comunicati o che possono venirne a conoscenza in qualit? di rappresentante designato nel territorio dello Stato, di responsabili o incaricati.

L' Utente ha diritto di ottenere:
</dt><dd>a) l'aggiornamento, la rettificazione ovvero, quando vi ha interesse, l'integrazione dei dati;
</dt><dd>b) la cancellazione, la trasformazione in forma anonima o il blocco dei dati trattati in violazione di legge, compresi quelli di cui non ? necessaria la conservazione in relazione agli scopi per i quali i dati sono stati raccolti o successivamente trattati;
</dt><dd>c) l'attestazione che le operazioni di cui alle lettere a) e b) sono state portate a conoscenza, anche per quanto riguarda il loro contenuto, di coloro ai quali i dati sono stati comunicati o diffusi, eccettuato il caso in cui tale adempimento si rivela impossibile o comporta un impiego di mezzi manifestamente sproporzionato rispetto al diritto tutelato.
L'utente ha diritto di opporsi, in tutto o in parte:
</dt><dd>a) per motivi legittimi al trattamento dei dati personali che lo riguardano, ancorch? pertinenti allo scopo della raccolta;
</dt><dd>b) al trattamento di dati personali che lo riguardano a fini di invio di materiale informativo (newsletter) o per il compimento di ricerche di mercato o di comunicazione commerciale.
L'Utente, inoltre, avr? sempre diretto accesso via web ai propri dati, come in possesso di Software Upgrade, attraverso i propri codici di accesso ("Username" e "Password"). L'Utente in questo modo potr? integrare, modificare o richiedere la cancellazione dei propri dati, in qualsiasi momento tramite questi link:
Modifica o aggiorna i tuoi dati: Modifica dati dal <a href="http://www.myforum.it/forums/profile.php?do=editprofile">Pannello di controllo Utente</a>

Cancellazione definitiva utente: Richiedere Cancellazione mediante il form <a href="http://www.myforum.it/forums/sendmessage.php">Contattaci</a> al titolare del sito.





<p align="center"><span lang="it">[
<a title="HomePage" href="http://www.myforum.it/">Torna in Software Upgrade</a>
]</span></p>






</td>

</tr>
</tbody></table>

</center>
</div>

</body></html>

If i try to add it, is showed bad, not formatted with the <h2> and the text don't start after some space , and the CSS integrated in this html don't work..... if would be a solution , should be great..... if no i'll still to use this html page not vb integrated.

Thanks in advance

ddaybofb
04-01-2010, 05:23 PM
I need some help, ive been working on this for like the past day.

http://www.clutchtimesports.net/forums/CTS%20Athletes.php

Notice how the writing is above the template, i can't get it to the middle


This is the custom file
<?php

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

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

define('THIS_SCRIPT', 'CTS Athletes.php');
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('CTS Athletes',
);

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'CTS Athletes';

include('twitter-rss-to-html.php');

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

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

?>

This is whats showing up on the page that i want in the middle

<?
/* twitter-rss-to-html.php


// a PHP script to display Twitter updates from a user's RSS feed on a web page

require_once("magpie/rss_fetch.inc");

// set up script variables
// the user's RSS feed on Twitter
$remote_url = "http://twitter.com/statuses/user_timeline/2557521.rss";
// the number of tweets to display (or -1 to display all)
$tweets_to_display = -1;
// the page where the tweet(s) will be displayed
$page = "http://www.clutchtimesports.net/forums/CTS%20Athletes.php";
// the user's Twitter username
$username = "ESPN";

$rss = fetch_rss($remote_url);

// start buffering output
ob_start();

$count = 1;
$now = time();
foreach ($rss->items as $item) {
// limit the number of tweets displayed
if ($tweets_to_display > 0) {
if ($count > $tweets_to_display) {
continue;
}
}
$tweet = $item['description'];
// ignore tweets linking back to page (if it is defined)
if ($page != "") {
if (!strpos($tweet, $page) === false) {
continue;
}
}
// figure out how recently the tweet was posted
$when = ($now - strtotime($item['pubdate']));
$posted = "";
if ($when < 60) {
$posted = $when . " seconds ago";
}
if (($posted == "") & ($when < 3600)) {
$posted = "about " . (floor($when / 60)) . " minutes ago";
}
if (($posted == "") & ($when < 7200)) {
$posted = "about 1 hour ago";
}
if (($posted == "") & ($when < 86400)) {
$posted = "about " . (floor($when / 3600)) . " hours ago";
}
if (($posted == "") & ($when < 172800)) {
$posted = "about 1 day ago";
}
if ($posted == "") {
$posted = (floor($when / 86400)) . " days ago";
}
// filter the user's username out of tweets
$tweet = str_replace($username . ": ", "", $tweet);
// turn URLs into hyperlinks
$tweet = preg_replace("/(http:\/\/)(.*?)\/([\w\.\/\&\=\?\-\,\:\;\#\_\~\%\+]*)/", "<a href=\"\\0\">Link</a>", $tweet);
// link to users in replies
$tweet = preg_replace("(@([a-zA-Z0-9\_]+))", "<a href=\"http://www.twitter.com/\\1\">\\0</a>", $tweet);
// add the time posted
$tweet = $tweet . " <span class=\"tweetwhen\">" . $posted . "</span>";
echo ("\n\n<p>" . $tweet);
$count++;
}


// display output
ob_end_flush();
?>

How do i get the writing on my page to the middle?

Yonatan
04-02-2010, 06:13 PM
Lynne,

Can you check my post?

I still have a problem with the section condition.

Thanks!

wynode
04-03-2010, 10:11 AM
Thanks for this. Very handy.

Just one issue I'm having is with ordered lists. There is some content which has the following HTML tags:

<ol>
<li> Item 1</li>
<li> Item 2</li>
</ol>
etc

It used to come up with numbers with the 3.8.x version but doesn't seem to do it for this vb4 versions. Any thoughts on how to implement numbering easily?

Lynne
04-03-2010, 02:57 PM
Thanks for this. Very handy.

Just one issue I'm having is with ordered lists. There is some content which has the following HTML tags:
This was already covered. See page 10 (may continue onto page 11, I don't remember).

ddaybofb
04-04-2010, 03:03 PM
I need some help, ive been working on this for like the past day.

http://www.clutchtimesports.net/forums/CTS%20Athletes.php

Notice how the writing is above the template, i can't get it to the middle


This is the custom file
<?php

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

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

define('THIS_SCRIPT', 'CTS Athletes.php');
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('CTS Athletes',
);

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'CTS Athletes';

include('twitter-rss-to-html.php');

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

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

?>

This is whats showing up on the page that i want in the middle

<?
/* twitter-rss-to-html.php


// a PHP script to display Twitter updates from a user's RSS feed on a web page

require_once("magpie/rss_fetch.inc");

// set up script variables
// the user's RSS feed on Twitter
$remote_url = "http://twitter.com/statuses/user_timeline/2557521.rss";
// the number of tweets to display (or -1 to display all)
$tweets_to_display = -1;
// the page where the tweet(s) will be displayed
$page = "http://www.clutchtimesports.net/forums/CTS%20Athletes.php";
// the user's Twitter username
$username = "ESPN";

$rss = fetch_rss($remote_url);

// start buffering output
ob_start();

$count = 1;
$now = time();
foreach ($rss->items as $item) {
// limit the number of tweets displayed
if ($tweets_to_display > 0) {
if ($count > $tweets_to_display) {
continue;
}
}
$tweet = $item['description'];
// ignore tweets linking back to page (if it is defined)
if ($page != "") {
if (!strpos($tweet, $page) === false) {
continue;
}
}
// figure out how recently the tweet was posted
$when = ($now - strtotime($item['pubdate']));
$posted = "";
if ($when < 60) {
$posted = $when . " seconds ago";
}
if (($posted == "") & ($when < 3600)) {
$posted = "about " . (floor($when / 60)) . " minutes ago";
}
if (($posted == "") & ($when < 7200)) {
$posted = "about 1 hour ago";
}
if (($posted == "") & ($when < 86400)) {
$posted = "about " . (floor($when / 3600)) . " hours ago";
}
if (($posted == "") & ($when < 172800)) {
$posted = "about 1 day ago";
}
if ($posted == "") {
$posted = (floor($when / 86400)) . " days ago";
}
// filter the user's username out of tweets
$tweet = str_replace($username . ": ", "", $tweet);
// turn URLs into hyperlinks
$tweet = preg_replace("/(http:\/\/)(.*?)\/([\w\.\/\&\=\?\-\,\:\;\#\_\~\%\+]*)/", "<a href=\"\\0\">Link</a>", $tweet);
// link to users in replies
$tweet = preg_replace("(@([a-zA-Z0-9\_]+))", "<a href=\"http://www.twitter.com/\\1\">\\0</a>", $tweet);
// add the time posted
$tweet = $tweet . " <span class=\"tweetwhen\">" . $posted . "</span>";
echo ("\n\n<p>" . $tweet);
$count++;
}


// display output
ob_end_flush();
?>

How do i get the writing on my page to the middle?

Any help with this?

Lynne
04-04-2010, 03:18 PM
Any help with this?
Well, you don't actually start the page with just <? , right?

ddaybofb
04-04-2010, 03:31 PM
Well, you don't actually start the page with just <? , right?

no, sorry, <?php

--------------- Added 1270419490 at 1270419490 ---------------

nvm, found another way

balkanboy
04-06-2010, 04:40 AM
i created a custom login page for a front page but how can i set it to check if already logged in and if so to forword to for example forum.php....

Cip
04-06-2010, 05:53 PM
I'm a little bit unsatisfied with the template that you suggest, mainly because the sub-title suggests that the content should be inside of a box. Other than that, great advice (as always ;)).

xAVx
04-07-2010, 02:28 PM
Well, i have the same problem as ddaybofb, i need to get my included PHP to the middle...How do i do it?

zelnik
04-12-2010, 10:27 AM
Brilliant guide Lynne, thanks ever so much worked a treat... now to try and it get on the menus! :)

pmk_1992
04-21-2010, 10:17 AM
Hi
i get blank page when do this tut

can you tell me where i have to go to create the template in MASTER STYLE ?

i did like the picture but it not work

Lynne
04-21-2010, 01:42 PM
The template doesn't get posted into the plugin code area - it gets put into the templates. Style Mananger > find your style (or if you are in debug mode, you may select MASTER STYLE) > Add Template.

TheSupportForum
04-21-2010, 01:46 PM
Hi
i get blank page when do this tut

can you tell me where i have to go to create the template in MASTER STYLE ?

i did like the picture but it not work


Admincp >> Styles & Templates >> Style Manager >>

Click on All style Options
Click add new template

to enable this for master templates you enable debug mod in config.php located in /includes

to enable debug add the following



$config['Misc']['debug'] = true;

pmk_1992
04-21-2010, 02:06 PM
it working now
thank so much

toolmanwill
04-22-2010, 12:07 PM
Lynne, thanx again so much for this tut. i'm creatin' pages like a madman now!! :D

Khan_
04-23-2010, 11:27 PM
can we give access permissions to particular usergroups and deny for some ..

If yes where do i set the permissions .. ?? Lil confused .. i used logicans webtemplates when i was on vB 3.8.2 and it has its own settings .. now i upgraded to 4.0.3 and never used custom pages so lil confused with it .. Need little support or suggest me any particular mod as logicans webtemplates for 3.8.x series ..

Lynne
04-23-2010, 11:46 PM
Under the Start Main Script area, you may deny some usergroups:
if (!is_member_of($vbulletin->userinfo, x, y, z))
{
// give no permission unless in usergroup x, y, or z
print_no_permission();
}

Khan_
04-23-2010, 11:59 PM
guess i dont want registered users and moderators to access this page so do i do it this way below in the start main script?

if (!is_member_of($vbulletin->userinfo, 2, 7,))
{
// give no permission unless in usergroup 6, or 5
print_no_permission();
}

Do i have to edit it this way .. check the php code please ..

2 = registered user <=> should not have access
7 = moderator <=> should not have access
6 = super admin. <=> should have access
5 = global moderator <=> should have access

Lynne
04-24-2010, 12:13 AM
If you want to exclude usergroups 2 & 7, then you would do:
if (is_member_of($vbulletin->userinfo, 2, 7))
{
// give no permission to usergroup 2 & 7
print_no_permission();
}

Khan_
04-24-2010, 12:18 AM
// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

if (is_member_of($vbulletin->userinfo, 2, 7))
{
// give no permission to usergroup 2 & 7
print_no_permission();
}

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




This is how i add it under start main script ..

P.S i want more groups to be excluded from it .. like 2,11,13,9,7 etc etc .. do i have to do it 2, 11, 13, 9, & 7 ? i am getting confused here on the second part. // give no permission to usergroup 2, 11, 13, 9 & 7

David Regimbal
04-24-2010, 01:13 AM
child directory does not seem to work for me :(
I'm very sure I'm doing something wrong though:


<?php

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

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

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

// 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
$curdir = getcwd ();
chdir('/path/to/forums');
require_once('./global.php');
chdir ($curdir);

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

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'INTEL';

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

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

?>


In a folder such as "/pages." My forum is in the root.

Error:




Warning: require_once(./includes/functions_user.php) [function.require-once]: failed to open stream: No such file or directory in [path]/includes/class_bootstrap.php(283) : eval()'d code on line 52

Fatal error: require_once() [function.require]: Failed opening required './includes/functions_user.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /path/to/public_html/includes/class_bootstrap.php(283) : eval()'d code on line 52

arilukes
04-26-2010, 12:55 AM
Great tutorial, and thanks to everyone who's input went into this.

I was able to create the page template and plugins with no issues.

FCS-Webmaster
05-02-2010, 10:59 AM
How do I include Widgets to my own vBulletin page?

Lynne
05-02-2010, 01:59 PM
How do I include Widgets to my own vBulletin page?
You'd have to write the code to include them. I do not have that code - you will have to go look through the files yourself.

aaronater
05-02-2010, 02:21 PM
Hey :)

What if I wanted to just clone the Home page? Meaning the first tab on the navbar 'Home' when you click it it takes you to the Home page where you can add articles. If I want a new page, lets call it 'Zome' I can make the new navbar tab called 'Zome' but what about the content page to go with it?

Thanks

caciocode
05-02-2010, 02:56 PM
The next part has become complicated for me. I even have no idea where to place those scripts.

aaronater
05-02-2010, 04:45 PM
OK I worked it out, thanks.

firefoxx
05-09-2010, 07:17 PM
Hi,

I have a flatcast radio. So I added the following code to the php file.

$HTML .='<div align="center"><IFRAME height="500">.......</IFRAME></div>'

So when I go to radio.php I see nothing.

Davidinh
05-10-2010, 03:23 PM
How to view a item from database
i have create a test page that followed this tutorial
it work fine but i want to connect some item into the database

the test.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('TEST',
);

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';

// ##### Initialize categories connection ####
$category = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "testing order by name DESC");
while ($categories = $db->fetch_array($film))
// initialize each item { }
$db->free_result($category);

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

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

?>
the template is exactly as the first post

within data table i dunno how to put (variable of item) into the template page and they will show in the page

any help will be appriciated

also help create the xml file for this test if you guy needed
i create it on local machine therefore i don't have a link

Lynne
05-10-2010, 07:43 PM
If your variable name is $categories, then register it for use in the template:
$templater->register('categories', $categories);
and then use it in the template like this:
{vb:raw categories.whatever}

Davidinh
05-10-2010, 09:10 PM
thanks Lynne

I tried it but nothing show

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

seem to be not array

Lynne
05-10-2010, 09:31 PM
Well, you never did anything with $categories, so nothing is going to show up from it. You just have an empty while loop (and not even really that).

Davidinh
05-11-2010, 12:12 AM
thanks for reply Lynne but i still dunno what is exactly your point and this is a point i'm not really got it
so, i'm going to put something in while loop like

// ##### Initialize categories connection ####
$category = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "testing order by name DESC");
while ($categories = $db->fetch_array($category))
// initialize each item
{
$name = $categories['name'];
$des = $categories['des'];
}
$db->free_result($category);

and the code line in template
{vb:raw categories.name}
do i have register the varialbe ($name, $des) for template?

--------------- Added 1273540800 at 1273540800 ---------------

and i tried to register them under $categories :

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

$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('categories', $categories);
$templater->register('categories', $name);
$templater->register('categories', $des);
print_output($templater->render());

it shows the first letter of the first item in database only
the first item name: testing 1
it shows "t" only :confused:

Lynne
05-11-2010, 01:58 AM
You would have to do something in here if you are in a loop:
{
$name = $categories['name'];
$des = $categories['des'];
$templater = vB_Template::create('TEST_1');
$templater->register_page_templates();
$templater->register('name', $name);
$templater->register('des', $des);
$my_output .= $templater->render();
}

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


I strongly suggest you take a look at some of the code in files like forum.php where there is a while loop.

EQmandingo
05-11-2010, 03:43 AM
i was wondering..... is there a way i can add a forum to display on this custom page say for example the default main forum...or rather just the posts from that forum itself and if so how can i do this.

by the way.. this is by far one of my favorite things i have seen here at vb.org thank you so much.

Lynne
05-11-2010, 03:46 AM
i was wondering..... is there a way i can add a forum to display on this custom page say for example the default main forum...or rather just the posts from that forum itself and if so how can i do this.
You would just do a query to grab the threads/posts from that forum and then display them on the page. There is a thread here about this very thing that I answered today. It's out in the main forums, but I posted a basic query in there as an idea of how to do it. (Of course, you can just open up any vB file to see how to do it also.)

EQmandingo
05-11-2010, 04:05 AM
You would just do a query to grab the threads/posts from that forum and then display them on the page. There is a thread here about this very thing that I answered today. It's out in the main forums, but I posted a basic query in there as an idea of how to do it. (Of course, you can just open up any vB file to see how to do it also.)

WOW!! Could you please link me to said thread and possibly with the post # if its that hot of a thread ... would love to know exactly how to do that the right way.

Btw It is you I am thanking for this thread...I love to try out products but things like this is what helps me understand how to better operate and modify vbulletin. So a proper thank you for this thread and your lightning response to my question :-) :up:

Davidinh
05-11-2010, 10:54 AM
thank you Lynne

from the post #291
that mean i have to create more tepmlate as TEST_1 for initial part of category. is it correct Lynne ! :)

i am going to try it and let you know thanks again Lynne

but how about template code

i will use {vb:raw my_output.part of loop}
(part of loop : $ name, $des right !!! or till the same
{vb:raw categories.whatever}
(whatever : name, des )

would you please ...... Lynne

Lynne
05-11-2010, 02:02 PM
WOW!! Could you please link me to said thread and possibly with the post # if its that hot of a thread ... would love to know exactly how to do that the right way.
All I've posted is some basic info to get started, I did not write the whole page for him - Help calling new threads to a custom page help (https://vborg.vbsupport.ru/showthread.php?t=242183)

thank you Lynne

from the post #291
that mean i have to create more tepmlate as TEST_1 for initial part of category. is it correct Lynne ! :)

i am going to try it and let you know thanks again Lynne

but how about template code

i will use {vb:raw my_output.part of loop}
(part of loop : $ name, $des right !!! or till the same
{vb:raw categories.whatever}
(whatever : name, des )

would you please ...... Lynne
You need to get the info in order to spit it out. In your original code, you never got the info. You did a query, wrote a while loop to do something with the info from the query, but never actually did anything with it. So, there was nothing to output. Take a look at the forum.php page and how they grab the currently active users. You make a query, then go into a while loop and spit out the user info into a template, then after you get out of the while loop, you spit all that template info out into another template.

Davidinh
05-11-2010, 03:34 PM
thanks Lynne
i got it, the way template work on VB4

Once again thanh you very much for your time Lynne
i thought i need one more step about how to use a file CSS or connected it into a template

i am going to create the TEST.css template (with google grids or kind of CSS for 2 or 3 columns) then
on the top (head part) of the main page of cust_page put this link in
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}TEST.css" />
</head>

So, it should be completed your tutorial "How create a custom page for VB 4"


thanks for all who distribute this knowlege

Best regard,

alfanexus
05-14-2010, 01:13 PM
Would it be possible to put a widget on such a page? If then how?

Lynne
05-14-2010, 01:36 PM
Possible? Almost anything is possible if you code it. I do not know how to put a widget on the page, however, and I imagine it would be a lot more coding that just putting a custom block of your own on the page would be.

Davidinh
05-15-2010, 04:12 PM
how to create multiple template under $_REQUEST[do] Lynne

i tried to get more template (on test.php)
but i don't understand how to make a second template for it

any help !

Lynne
05-15-2010, 06:30 PM
how to create multiple template under $_REQUEST[do] Lynne

i tried to get more template (on test.php)
but i don't understand how to make a second template for it

any help !
You just render a different template per do usually:
if ($_REQUEST['do'] == 'this'){
$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
}

if ($_REQUEST['do'] == 'that'){
$templater = vB_Template::create('TEST2');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
}

Davidinh
05-15-2010, 08:32 PM
thank you Lynne
in the template "TEST2" it has carry on the head and footer like the template TEST
is it correct ?

Lynne
05-15-2010, 09:00 PM
TEST2 would look like whatever you make it to look like. You could even just use the exact same template, TEST, if you have the same variable names and such. I'm just giving an example in my post.

Davidinh
05-15-2010, 09:26 PM
i got a second template as you sample. Lynne thanks
but i can put out the info from database (it's blank) it's so complicated to me


// initialize db content
$view = $db->query_read(
"SELECT d.*, c.*
FROM " . TABLE_PREFIX . "doc AS d
LEFT JOIN " . TABLE_PREFIX . "doc_cat AS c ON (d.id = c.catid)
WHERE c.catid = '$docid'
");
while ($viewer = $db->fetch_array($view))
{
$title = $viewer['docname'];
$content = $viewer['document'];
$describe = $viewer['docdes'];
$press = vbdate($vbulletin->options['dateformat'], $viewer['postdate']);
// register templates
$templater = vB_Template::create('TEST_2');
$templater->register_page_templates();
$templater->register('docid', $docid);
$templater->register('viewer', $viewer);
$templater->register('title', $title);
$templater->register('content', $content);
$templater->register('describe', $describe);
$templater->register('press', $press);
$my_doc_view .= $templater->render();
}

$db->free_result($view);
// start the navbar
$navbits = array();
$navbits['test.php?' . $vbulletin->session->vars['sessionurl_q'] . ""] = "Create Own Page";
$navbits[''] = "Test Viewer";

$templater = vB_Template::create('TEST2');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('my_doc_view', $my_doc_view);
$templater->register('viewer', $viewer);
$templater->register('title', $title);
$templater->register('content', $content);
$templater->register('describe', $describe);
$templater->register('press', $press);
$templater->register('my_cat', $my_cat);
print_output($templater->render());
{


in the template TEST2 (like i do for categories is work fine in the front page)
i insert these line
{vb:raw my_doc_view} (the other template i call TEST_2)
and in the template TEST_2 i tried to point some info that i already register :
{vb:raw title}
{vb:raw content}

then i got a blank view

any idea Lynne

Lynne
05-15-2010, 10:44 PM
then i got a blank view

any idea Lynne
If you need help getting the queries working and such, then you really need to post in the main forums. I can't go through everyone's code that posts in this thread.

And if you are getting a blank page, it could be that you didn't put the template into the style you are using to view your page.

Davidinh
05-16-2010, 10:14 AM
oh okay Lynne, thanks for your time

but the problem it not on the second template page It shows out fine without the info that i try to put out from database
however, sorry about mess up the posting here Lynne

Sincerely,

--------------- Added 1274051701 at 1274051701 ---------------

well, finally, i got them all Lynne
thank you for you time

I took the sample from file profile.php of vbb4 and study the way they used the template "USERCP_SHELL" and apply your tutorial

and now my test page it word great
some kind of variable as

// set shell template name
$shelltemplatename = 'USERCP_SHELL';

then it drops down the # of register template
Just call variable by {vb:raw whatever}

hope this help somebody who likes me :))
Sincerely,

kardus
05-18-2010, 03:49 AM
I did this and it works perfectly. Unfortunately it won't work with PHP files that I am trying to include in my custom page. I made a thread about it here: https://vborg.vbsupport.ru/showthread.php?p=2038959

Can Lynne (or anyone?) help me get this working?

Lynne
05-18-2010, 02:21 PM
It looks like Cellarius helped you out and you are now up and running. :)

FCS-Webmaster
05-27-2010, 08:23 PM
can anyone help me with this one - so I'll be able to convert all my old codes to the new vbulletin system? heres the thread I made with a describtion of my problem (https://vborg.vbsupport.ru/showthread.php?t=243417)

thezman
06-01-2010, 10:12 PM
I have a simple question. I want a customer page that displays a table I created in Dreamweaver. Where do I place the html to have it display on my customer page?

Lynne
06-02-2010, 03:49 AM
I have a simple question. I want a customer page that displays a table I created in Dreamweaver. Where do I place the html to have it display on my customer page?
html goes in the template.

thezman
06-02-2010, 07:32 PM
html goes in the template.

Then I have a problem somewhere. I tested with a simple bit of code (<b>Test</b>) right in the section that says customer code goes here. I get an error. I take out the code and the error goes away.

Further, the page is viewable (unmodified) but not as a part of the VB framework. It is just blank page, without the tabs, headings and so forth.

Lynne
06-02-2010, 10:54 PM
Then I have a problem somewhere. I tested with a simple bit of code (<b>Test</b>) right in the section that says customer code goes here. I get an error. I take out the code and the error goes away.

Further, the page is viewable (unmodified) but not as a part of the VB framework. It is just blank page, without the tabs, headings and so forth.
It is the php page that says "Custom Code Goes Here" - that is not the template. The template is the thing created in Step 2. Did you do that? And did you create the template in the Style you are currently using on your site? If you don't, then you will get a blank page.

Percocet
06-07-2010, 11:10 PM
So after you create the new test.php and the new template how do you get them to show up on your site? I assume you place the template in your template files, but what do you do with the test.php file?

--------------- Added 1275957752 at 1275957752 ---------------

Ok i figured it out. You just place it in the main VBULLETIN folder that will be titled "forum" if you followed the install directions exactly as they are on the vb website :)

Lynne
06-07-2010, 11:42 PM
You need to upload test.php to your site.

Wilfred1
06-11-2010, 10:17 PM
From an SEO perspective is it better to have the html code in the php file instead of using a template?

Lynne
06-12-2010, 03:48 AM
Really? Why?

You can put the php in the php file, it's just not as easy as using a template, but you are free to do it however you want.

Wilfred1
06-12-2010, 04:12 AM
Thanks Lynne - but I am just asking which way is better for SEO or doesn't it matter as the bots will find it all just the same?

ragtek
06-12-2010, 08:04 AM
It doesn't matter

jdrakopo
06-23-2010, 12:28 PM
Thanks for posting this.
However, I'm receiving the following error on my page:
>> Parse error: syntax error, unexpected T_VARIABLE in /home/bostonwh/public_html/adhub.php on line 44

...where line 44 is as follows:
$templater = vB_Template::create('adhub');

... and I DO have a template defined by that name which is identical to what you have above (though, I'm wondering if it's acceptable for me to have 'test' and 'TEST' be the same term - which in my case is 'adhub' for both)

Lynne
06-23-2010, 02:24 PM
Sometimes the line number isn't exact - so look *around* line 44.

ragtek
06-23-2010, 02:56 PM
Or youre template is not correct

eues
06-24-2010, 06:02 PM
so could i use this to pull in code from wordpress installed on the same server? so it would be wordpress inside a vbulletin theme?

Lynne
06-24-2010, 07:08 PM
so could i use this to pull in code from wordpress installed on the same server? so it would be wordpress inside a vbulletin theme?
Sure, as long as you can write the code to do so.

eues
06-24-2010, 10:39 PM
Sure, as long as you can write the code to do so.

ah good to know! Thanks Lynne

There's no way i'd ever be able to write the code though :( do you know of any tutorials that may help me out so i could give it a go?

Lynne
06-25-2010, 02:24 AM
ah good to know! Thanks Lynne

There's no way i'd ever be able to write the code though :( do you know of any tutorials that may help me out so i could give it a go?
A tutorial on pulling info from wordpress? Sorry, I don't as I have never used wordpress for anything.

jdrakopo
06-29-2010, 01:42 PM
Is everyone getting this to work in IE ?
In Chrome, all is well.
In IE 7, this does not seem to work (I've not tried IE 8).
Thanks.

---------------------
I'm updating this post since I realize I am doing an <embed
And - that has problems in IE.

Cheers.

xqzme
07-09-2010, 07:39 PM
I've cut, pasted and edited the php file and created the template file, but I get a blank page for http://mydomain.org/siteterms.php.

siteterms.php has been uploaded to root directory with other php files. Changed TEST to siteterms (the name of the template). Anything simple jump out or that I should look into?

nci
07-10-2010, 06:07 AM
I have a working page,yet it never register the members session,when members are on the page it will show that they are not logged in and no matter how many times they try to logged in,It will still show that they are not logged in,except they click the forum link.
What is the problem?.
Do i need to create a separate session for the page?.

Wilfred1
07-16-2010, 07:07 AM
I wonder if you can help me with this one Lynne

The problem I have is defining the WOS statement for:
Unknown Location
/index.php?pageid=news_reader
What I have which doesn't work (the others do) is:
case '../index.php?pageid=news_reader':
$userinfo['activity'] = 'News Reader';
break;
and
case 'News Reader':
$userinfo['where'] = '<a href="../index.php?pageid=news_reader">News Reader</a>';
$userinfo['action'] = "Viewing Page";
$handled = true;
break;

Nicke71
07-18-2010, 08:37 PM
Thanks Lynne, will dig more into this as I intend to do my own pages / apps a part of vB instead of outside vB.

Very helpful.

euantor
07-29-2010, 09:22 AM
I've followed this to the letter, yet I'm getting " " at the top of every new page. Strangely, these characters don't usually appear on the main site. Any ideas anybody?

Lynne
07-29-2010, 02:27 PM
I've followed this to the letter, yet I'm getting " " at the top of every new page. Strangely, these characters don't usually appear on the main site. Any ideas anybody?
Those are characters you get when you are not using just a basic text editor. You need to use something like notepad++ or bbedit to edit the php files or hidden characters can get added to the page.

2fast4ya
07-29-2010, 07:52 PM
Okay, I've read this article a thousand different times, and it's shown me the thousand different reasons why I'm such a noob when it comes to this stuff. So bare with me here.

I understand the concept of creating the PHP page where all of your content will fall under. This is is where I add the custom HTML or PHP code for the extra content that I wanted. For example, an "About Us" page.

Now it's my understanding that once you create this test.php page, you need to then create a Template in VB to CALL that php page. Am I wrong? Because when I'm looking at the Create a Template code, I can't see any part of that code that calls on test.php ...

Again, I'm sure I'm missing something simple and obvious and stupid, but I have to ask.

Let me just start to understand this concept first before I even begin to try to do this. If I can pull this off without losing my mind in frustration it would be great lol :o

Lynne
07-29-2010, 10:14 PM
Now it's my understanding that once you create this test.php page, you need to then create a Template in VB to CALL that php page. Am I wrong? Because when I'm looking at the Create a Template code, I can't see any part of that code that calls on test.php ...
Actually, it's the opposite. The test.php page calls the template.

Nicke71
07-30-2010, 03:42 AM
Hi Lynne.

I just made my first vb powered page, it fetch local movie showtimes and displays it.

I just wonder how to handle css within this page? I added css to additional.css file, but it is possible to have the extra css only for my custom page? (Instead of making it loading for all vb pages)

And thanks again for all help you provide to vb community.

Lynne
07-30-2010, 02:06 PM
Hi Lynne.

I just made my first vb powered page, it fetch local movie showtimes and displays it.

I just wonder how to handle css within this page? I added css to additional.css file, but it is possible to have the extra css only for my custom page? (Instead of making it loading for all vb pages)

And thanks again for all help you provide to vb community.
You could add CSS directly into your template, or create a new css template and include it in your page by following the examples of how it is included in the headinclude and headinclude_bottom template.

2fast4ya
07-30-2010, 08:27 PM
i figured it out! Thank you so much Lynne for your wonderful help!

Nicke71
07-31-2010, 11:55 AM
Thanks, I added it to the template and it worked fine. Probably the best way if only one page use the css.

mordor1
08-04-2010, 02:56 PM
Does any 1 know how make a redirect on a costum page if user is not loged in?

rfsforums
08-04-2010, 08:54 PM
I have notices that are shown in the forum for unregistered users but I'd like to not display them on this new page. How can I turn them off? Thanks for the great article got it to work on the 2nd attempt!

Lynne
08-04-2010, 09:08 PM
Does any 1 know how make a redirect on a costum page if user is not loged in?
Put in a Meta Redirect Tag (http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm) in the template. Put a condition around it based on whether they are a guest or not.
<vb:if condition="$show['guest']">your tag code</vb:if>I have notices that are shown in the forum for unregistered users but I'd like to not display them on this new page. How can I turn them off? Thanks for the great article got it to work on the 2nd attempt!
Put a condition around the notifications based on THIS_SCRIPT (change 'test' to whatever you defined THIS_SCRIPT to be in your page):
<vb:if condition="THIS_SCRIPT == 'test'">notification code</vb:if>

NathanLedet
08-04-2010, 09:53 PM
If I'm making a plugin that users can access via their User Control Panel, how do I make it so that the left sidebar shows up?

Thanks :)

rfsforums
08-04-2010, 10:43 PM
Put a condition around the notifications based on THIS_SCRIPT (change 'test' to whatever you defined THIS_SCRIPT to be in your page):
<vb:if condition="THIS_SCRIPT == 'test'">notification code</vb:if>

Thanks Lynne for the super fast reply! I thought I located the 'notification code' in the navbar template and put the condition around everything I could think of. When it did work it also hid the notices on the forum home which I don't want. Can you give me a little more guidance?
Many Thanks!

Lynne
08-05-2010, 12:58 AM
If I'm making a plugin that users can access via their User Control Panel, how do I make it so that the left sidebar shows up?

Thanks :)
I have no idea. There is a mod to add the sidebar to other pages, so I'd suggest you look at that mod and see how he did it.

Thanks Lynne for the super fast reply! I thought I located the 'notification code' in the navbar template and put the condition around everything I could think of. When it did work it also hid the notices on the forum home which I don't want. Can you give me a little more guidance?
Many Thanks!
You know, I goofed on that, it should have been like this:
<vb:if condition="THIS_SCRIPT != 'test'">notification code</vb:if>

TheSupportForum
08-05-2010, 02:27 PM
i would like to create an admincp page available to Admins, Super Moderators and Moderator

please could someone please provide a standard template for this

thank you

Lynne
08-05-2010, 02:43 PM
i would like to create an admincp page available to Admins, Super Moderators and Moderator

please could someone please provide a standard template for this

thank you
I don't have a template for an admin cp page. I have seen an article about how to add pages to the admincp though, so you should do a search for it.

TheSupportForum
08-05-2010, 02:46 PM
i will try give it a go by searching, but if anyone has a working example of an admincp php file please post it

mordor1
08-07-2010, 09:22 AM
Put in a Meta Redirect Tag (http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm) in the template. Put a condition around it based on whether they are a guest or not.
<vb:if condition="$show['guest']">your tag code</vb:if>
Put a condition around the notifications based on THIS_SCRIPT (change 'test' to whatever you defined THIS_SCRIPT to be in your page):
<vb:if condition="THIS_SCRIPT == 'test'">notification code</vb:if>


Got it tanks!

Tahooma
08-11-2010, 06:12 AM
Any Info how i could put a standard template around my php ?
Means, that my php looks like the homepage, so i just really reuse the VB CMS Templates ?
Just want to look my subpage like the homepage, with the sidebar, navigation, calendar,...

Thanks in advance

cellarius
08-11-2010, 06:22 AM
Then why don't you create a custom php page in the CMS in the first place? No sense in recreating the whole CMS infrastructure, when you just could use it. ;)

Tahooma
08-11-2010, 06:53 AM
Then why don't you create a custom php page in the CMS in the first place? No sense in recreating the whole CMS infrastructure, when you just could use it. ;)

My goal is to integrate a mod which uses the whole width of the screen into the "3 columns" design.
As i am very ned wo vBulletin, i thought the easiest way would be to force the .php file into the templates.

Dragonsys
08-11-2010, 08:51 PM
I wonder if you can help me with this one Lynne

The problem I have is defining the WOS statement for:
Unknown Location
/index.php?pageid=news_reader
What I have which doesn't work (the others do) is:
case '../index.php?pageid=news_reader':
$userinfo['activity'] = 'News Reader';
break;
and
case 'News Reader':
$userinfo['where'] = '<a href="../index.php?pageid=news_reader">News Reader</a>';
$userinfo['action'] = "Viewing Page";
$handled = true;
break;

I am trying to find a solution for this as well. What I have tried i using the online_location_preprocess hook.

my code looks like this:
if ($loc == './error.php?error=400')
{
$filename = 'error_400.php';
}
if ($loc == './error.php?error=401')
{
$filename = 'error_401.php';
}
if ($loc == './error.php?error=403')
{
$filename = 'error_403.php';
}
if ($loc == './error.php?error=404')
{
$filename = 'error_404.php';
}
if ($loc == './error.php?error=500')
{
$filename = 'error_500.php';
}
and then in online_location_process i have:
if ($filename == 'error_400.php')
{
$userinfo['activity'] = 'error400';
}
if ($filename == 'error_401.php')
{
$userinfo['activity'] = 'error401';
}
if ($filename == 'error_403.php')
{
$userinfo['activity'] = 'error403';
}
if ($filename == 'error_404.php')
{
$userinfo['activity'] = 'error404';
}
if ($filename == 'error_500.php')
{
$userinfo['activity'] = 'error500';
}

But I still get Unknown Location.

ArtakEVN
08-13-2010, 02:12 AM
Thank your tutor.
I had met following error, when I using this template page, there is a cookie sent already.

Uh! Unable to add cookies, header already sent.
File: /www/forum/phoenixjournals.php
Line: 1

Forums test


I create scripts as phoenixjournals.php, but it occur if I logout.

How could I solve it? or what deos it mean in this case?

I hope your teaching. Thanks.

Maybe you save your file in unicode.

choitz
08-15-2010, 07:19 PM
Hi,
This has all worked brilliantly after flicking a bit between the original and Lynn's article (more of a case of me having to get my head round it).

Now, I don't know if it's a roblem with my custom style, but standard html doesn't seem to be having any effect on my pages, for example:
<UL><LI>[</LI></UL> <STRONG></STRONG> <I></I>
but;
<a href="..."></a>
works. I'd be grateful for any ideas why?

Cheers

Lynne
08-15-2010, 08:00 PM
Use a div of class="restore" around the code to get back to normal html.

choitz
08-16-2010, 04:53 PM
Use a div of class="restore" around the code to get back to normal html.

Thanks for helping me out with a n00b problem Lynn, for the record if anyone else has that problem the double quotes (")after A HREF are left in, but if you use single (') or none at all then it works. Thanks again Lynn!

AfterWorldForum
08-19-2010, 09:02 AM
Lynne,

Thanks for converting the article to a vB4 version. It's very helpful for those of us offering some custom-built pages.

If you do not mind, I do have a question about tables, though. I've used the approach a lot where I offer a custom page to pull some custom data from the database. Typically, this means I connect to the db, pull out data, and then build one huge HTML string with tables to represent the data.

I have looked, but not managed to find a definite article on how to achieve the same but consistent with the vB4 coding standards. I have tried looking at the CSS classes used in the vB4 pages, but I have to admit that is kind of over my head (I will admit I did not spend THAT much time on it, considering I still am trying to solve lots of issues left over after the migration).

As a simple example, I used to use alt1 and alt2. I can wrap one of those div class="restore"> around the table definition, but were I to totally rewrite my pages so they also match with the vB4 styles I use, how would I go at that, exactly? And where would I be able to find the restore class in the new stylevar setup, so I could actually alter the (for instance) alt1 and alt2 tags?

Sorry if you feel I am hijacking your thread. I just have not found a way to actually solicit for an article or guide, and custom pages is where I imagine lots of people will be using tables.

Thanks in advance, and I apologize for what might appear as an thread hijack.

Peter

Lynne
08-19-2010, 02:46 PM
If you do a Search in Templates for ".restore", you'll find them all defined in vbulletin.css. I never change things in that template though, the best thing to do is put new CSS in addiitional.css

If you need help with something, you just post in the main (vB$, in this case) forums. Usually you don't ask for an article, you just ask for help. Then, either the person helping, or the person who got helped, may throw together an article to help others.

AfterWorldForum
08-19-2010, 04:23 PM
If you do a Search in Templates for ".restore", you'll find them all defined in vbulletin.css. I never change things in that template though, the best thing to do is put new CSS in addiitional.css

If you need help with something, you just post in the main (vB$, in this case) forums. Usually you don't ask for an article, you just ask for help. Then, either the person helping, or the person who got helped, may throw together an article to help others.

Thanks Lynne. I'll have a peek at the vbulletin.css. Should that not work out, I'll post a question :)

nymyth
08-19-2010, 07:47 PM
What code can I put into the template so that I can have alternating colors. I will listing links from top to bottom and I would like each link to have a different bg color like we do in forumdisplay

Lynne
08-19-2010, 10:11 PM
What code can I put into the template so that I can have alternating colors. I will listing links from top to bottom and I would like each link to have a different bg color like we do in forumdisplay
Probably in your php code you would have a counter and then based on whether it's even or odd, you set the class (alt1 or alt2). This thread is really not the place to ask about how to write the php code though. You could probably find it doing a search though since it's been posted a few times.

Frank T
08-20-2010, 04:56 AM
I ran into a wierd problem programming my own custom page. I wanted to add a note to the bottom of a screen to see what infraction a user received. So, I thought I did the obvious: $vbphrase['infractionlevel8_title'] -- and to my surprise, it was blank (even though it's actually defined).

Next, I copied the vbphrase precache out of infraction.php:
$phrasegroups = array('infraction', 'infractionlevel', 'pm', 'posting', 'banning', 'user');

Nothing.

I made sure vbphrases are working, because I successfully displayed $vbphrase['forum'].

I worked on this for a few hours and couldn't figure it out. What's so unique about these infractionlevel phrases, and why can't I get to them from inside of my custom page?

Any help is greatly appreciated.

Fixed by calling fetch_phrase_group('infractionlevel');

sbsforum.us
08-23-2010, 01:43 PM
Thank you very much this is exactly what I needed!!!

tech4c
08-25-2010, 02:14 PM
thanks

tzelon
08-28-2010, 09:37 PM
Thank you !
I have 2 qustions:
Can I add widgets to my new page? How can I do that ?
Can I choose layout to the new page?
THANKS AGIN

Lynne
08-28-2010, 09:59 PM
Thank you !
I have 2 qustions:
Can I add widgets to my new page? How can I do that ?
Can I choose layout to the new page?
THANKS AGIN
Widgets go in the CMS. You can't add them anywhere else, just as you can't pick a CMS layout for your page either. However, your page is just a template so you can lay it our however you want - even if that means copying a CMS grid and putting it in there.

tzelon
08-28-2010, 10:46 PM
Ok
thanks.
I have new problem, in my computer the new page is working but in others computer they see blank page.
this is my php code of the page

<?php

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

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

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

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';

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

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

?>

yospeck
09-01-2010, 10:54 PM
Excellent guide (combined with the adding the nav tab dropdown menu guide Lynne).

I'm an absolute code n00b and don't don't know a condition from a variable to a hook, basically jumped in feet first and just trying to learn this stuff as I go.

My only criticism (and I hope it's constructive) is that some of these guides are written for people who actually know where to navigate in the admincp and where to add new styles/templates, etc. There's as many new people coming to these forums learning coding and vBulletin for the first time and although I know you guys do your best to try and make things basic, sometimes it can be with presumed knowledge. With just a few more simple initial babysteps (given that topics like this are likely to be one of the first things someone wants to do with their site, and therefore might have very little prior knowledge of vBull and how to do any coding) it would be sooooo helpful to have a "to do this you go to here > here > here" in the OP instead of working through the entire thread to find out the info (which I generally do as I don't like to ask questions that are answered in the thread, it can just sometimes be a pain when it's on page 16 :D ).

Anyway, again, great great guide and in the main really simple to do (even for a none-coder like myself). Kudos!

Guitar Guy
09-05-2010, 07:18 PM
Hello,

First off, I just want to say that this is a top-notch guide, in my opinion.

I just have a quick question:
How do I add dividers to sections? Is it in the template? Or the PHP page? What's the code?
Also, How do I add the shadow effect behind the whole box?
http://img541.imageshack.us/img541/2458/wgobox.jpg

Regards,
Guitar Guy

Lynne
09-05-2010, 08:50 PM
Hello,

First off, I just want to say that this is a top-notch guide, in my opinion.

I just have a quick question:
How do I add dividers to sections? Is it in the template? Or the PHP page? What's the code?
Also, How do I add the shadow effect behind the whole box?

What your output looks like is in the html, so it is in the template. Usually users use CSS to put a border around a div. The shadow is also just CSS that you would apply to the div:

div.yourclass {
border:5px solid red;
-moz-box-shadow:-2px 2px 2px #C8C8C8;
-webkit-box-shadow:-2px 2px 2px #C8C8C8;
}

Guitar Guy
09-06-2010, 03:01 AM
Thank you for the response, but it's not entirely what I'm asking.

What I'm trying to do is basically divide this page:

http://img299.imageshack.us/img299/6962/privacypolicypage.jpg


into sections that look like pieces from the "What's Going On" box:

http://img715.imageshack.us/img715/959/whatsgoingonbox.jpg


Here is the code that I currently have for the 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}


<STYLE TYPE="text/css">
<!--
P {text-indent: 30pt;}
-->
</STYLE>

</head>
<body>

{vb:raw header}

{vb:raw navbar}

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

<br />
<div class="block">
<center><h2 class="blockhead">What information do we collect?</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<p>We collect information from you when you register on our site. When ordering or registering on our site, as appropriate, you may be asked to enter your: e-mail address. You may, however, visit our site anonymously.</p>
</div>
</div>
</div>

<br />

<div class="block">
<center><h2 class="blockhead">Why do we collect this information?</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<ul>
<li>To personalize your experience (your information helps us to better respond to your individual needs);</li><br />

<li>To improve our website (we continually strive to improve our website offerings based on the information and feedback we receive from you);</li><br />

<li>To improve customer service (your information helps us to more effectively respond to your customer service requests and support needs);</li><br />

<li>To process transactions; your information, whether public or private, <em>will not be sold, exchanged, transferred, or given to any other company for any reason whatsoever, without your consent, other than for the express purpose of delivering the purchased product or service requested.</em></li><br />

<li>To send periodic emails; the email address you provide for order processing, will <em>only</em> be used to send you information and updates pertaining to your order.</li>
</ul>
</div>
</div>
</div>

<br />

<div class="block">
<center><h2 class="blockhead">How do we protect your information?</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<p>We implement a variety of security measures to maintain the safety of your personal information when you place an order or enter, submit, or access your personal information. We offer the use of a secure server. All supplied sensitive/credit information is transmitted via Secure Socket Layer (SSL) technology and then encrypted into our Payment gateway providers database only to be accessible by those authorized with special access rights to such systems, and are required to?keep the information confidential. After a transaction, your private information (credit cards, social security numbers, financials, etc.) will not be stored on our servers.</p>
</div>
</div>
</div>

<br />

<div class="block">
<center><h2 class="blockhead">Do we use cookies?</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<p>Yes (Cookies are small files that a site or its service provider transfers to your computers hard drive through your Web browser (if you allow) that enables the sites or service providers systems to recognize your browser and capture and remember certain information). We use cookies to understand and save your preferences for future visits and keep track of advertisements.</p>
</div>
</div>
</div>

<br />

<div class="block">
<center><h2 class="blockhead">Do we disclose any information to outside parties?</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<p>We do not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our website, conducting our business, or servicing you, so long as those parties agree to keep this information confidential. We may also release your information when we believe release is appropriate to comply with the law, enforce our site policies, or protect ours or others rights, property, or safety. However, non-personally identifiable visitor information may be provided to other parties for marketing, advertising, or other uses.</p>
</div>
</div>
</div>

<br />

<div class="block">
<center><h2 class="blockhead">Third party links</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<p>Occasionally, at our discretion, we may include or offer third party products or services on our website. These third party sites have separate and independent privacy policies. We therefore have no responsibility or liability for the content and activities of these linked sites. Nonetheless, we seek to protect the integrity of our site and welcome any feedback about these sites.</p>
</div>
</div>
</div>

<br />

<div class="block">
<center><h2 class="blockhead">California Online Privacy Protection Act Compliance</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<p>Because we value your privacy we have taken the necessary precautions to be in compliance with the California Online Privacy Protection Act. We therefore will not distribute your personal information to outside parties without your consent. As part of the California Online Privacy Protection Act, all users of our site may make any changes to their information at anytime by logging into their control panel and going to the 'Settings' page.</p>
</div>
</div>
</div>

<br />

<div class="block">
<center><h2 class="blockhead">Childrens Online Privacy Protection Act Compliance</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<p>We are in compliance with the requirements of COPPA (Childrens Online Privacy Protection Act), we do not collect any information from anyone under 13 years of age. Our website, products and services are all directed to people who are at least 13 years old or older.</p>
</div>
</div>
</div>

<br />

<div class="block">
<center><h2 class="blockhead">Your Consent and Policy Changes</h2></center>
<div class="blockbody">
<div class="blockrow restore"><br />
<p>By using our site, you consent to our web site privacy policy. If we decide to change our privacy policy, we will update the Privacy Policy modification date below. If you have any questions regarding this policy, please either ask in the <a href="http://www.defeatthesystem.com/forum.php";>forum</a> or <a href="mailto:support@defeatthesystem.com">Email Support</a>.</p>
</div>
</div>
</div>
<br /><br /><br /><span></span><span></span><center><div style='font-size:7pt; font-family:Arial; color:gray; text-decoration:none;'>This policy was last modified on August 18, 2010<span></span><span></span><span></span>
<br /><span></span><span></span><div style='font-size:7pt; font-family:Arial; color:gray; text-decoration:none;'>Please also visit our Terms of Service section establishing the use, disclaimers, and limitations of liability governing the use of our website <a style='color:#3C3C3C; text-decoration:none;' href='http://www.defeatthesystem.com/terms.php'>Here</a></center></div><span></span><span></span><span></span></div><center>

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

I basically want to have pieces like the "What information do we collect?" and "Why do we collect this information?" in that box, etc, etc

Thank you in advance for your help.

Regards,
Guitar Guy

Lynne
09-06-2010, 03:35 AM
If you want to make your page look more like the other section, then you need to use the same sort of CSS for your page.

Dusty Miller
09-06-2010, 10:26 AM
Is there a way of adding php scripts in a custom page. I am trying to add a form in which people can add search their details and I want to query an external database...

Where should the php code be inserted..

I want to user the vBulletin wrapper to control users, usergroup levels etc.

Lynne
09-06-2010, 01:48 PM
You can insert the php code anywhere under where it says Main Script and before your template is being rendered.

Bill_Reilly
09-07-2010, 11:14 PM
noob question, sorry... if I want to place a little javascript on my page(basically a calculator) where do I place the code that would normally go within the head tags?

Lynne
09-08-2010, 12:38 AM
noob question, sorry... if I want to place a little javascript on my page(basically a calculator) where do I place the code that would normally go within the head tags?
Within the head tags of your template.

Bill_Reilly
09-08-2010, 02:55 AM
well yea. That gives me errors, which is why I asked. I had it as an shtml page already, so I'm just attempting to copy and paste working code.......

Warning: Invalid argument supplied for foreach() in [path]/includes/functions.php on line 3332

vBulletin Message
The following error occurred when attempting to evaluate this template:
%1$s
This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

Lynne
09-08-2010, 03:17 AM
You may want to try putting <vb:literal> tags around the javascript and see if that works. If it still doesn't, you may want to start a thread in the general discussions area and ask for help with your code.

Bill_Reilly
09-08-2010, 03:22 AM
Putting those around the header portion of the code worked. Thank you :)

sergioloporto
09-15-2010, 03:01 PM
Hi... I understand that test.php should be put in the root /.
If I put the test.php in /folder/ should it work fine or I need to edit something?

Lynne
09-15-2010, 05:33 PM
Hi... I understand that test.php should be put in the root /.
If I put the test.php in /folder/ should it work fine or I need to edit something?

See this in the code:
// 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');

sergioloporto
09-15-2010, 06:09 PM
I am getting the following error when I go to the file:

Warning: require_once(./global.php) [function.require-once]: failed to open stream: No such file or directory in /home/user/public_html/forumfolder/newfolder/file.php on line 29

Fatal error: require_once() [function.require]: Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/forumfolder/newfolder/file.php on line 29


This is how I wrote the file:

<?php

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

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

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

// 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 ('/home/user/public_html/forumfolder/newfolder');
require_once('./global.php');

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

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'page title';

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

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

?>

What I did wrong?

Lynne
09-15-2010, 07:09 PM
Your vbforums are in a directory called /newfolder? You are supposed to chdir to the vbulletin forums directory.

sergioloporto
09-15-2010, 07:15 PM
Excellent, thank you!

--------------- Added 1284586523 at 1284586523 ---------------

Question/problem 1)

However if I put some text after this:

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'page title';

it says Parse error: syntax error, unexpected T_VARIABLE in [and then the line number of the code I put]

Should I put my custom code on this php or on the template I created?

--------------- Added 1284587127 at 1284587127 ---------------

Questio/problem 2)

If I stay on the page file.php for a bunch of minutes, and then I refresh the page, this is what I get:

Unable to add cookies, header already sent.
File: /home/user/public_html/forumfolder/newfolder/page file.php
Line: 1

Lynne
09-16-2010, 03:27 AM
If you are getting those errors, then you are creating your page wrong. You should start your own thread and post your php code and template code so someone may help you out.

sergioloporto
09-16-2010, 07:17 AM
Here it is: https://vborg.vbsupport.ru/showthread.php?p=2098965
Thank you for your help

joejoemaker
09-17-2010, 02:50 PM
How can I use another template in the template for the new page?
Like this:

{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">Title</h2>
<div class="blockbody">
<div class="blockrow">
{vb:raw another_template}
</div>
</div>

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


"{vb:raw another_template}" should be replaced with the Template "another_template"

Someone who understand my querstion?

Lynne
09-17-2010, 03:38 PM
How can I use another template in the template for the new page?

You will need to render the template in your php code.

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

Then make sure you register $another_template for use in the TEST template.

joejoemaker
09-17-2010, 04:57 PM
It works, Thanks!!

Have I to do this for every Template I want to use or is there a short version?

Lynne
09-17-2010, 05:09 PM
It works, Thanks!!

Have I to do this for every Template I want to use or is there a short version?
Yes, you need to render every template you want to use. You may be able to put it in a while loop, but that depends on what you are doing.

joejoemaker
09-17-2010, 05:24 PM
Ok, Thank You!!!

sergioloporto
09-19-2010, 10:44 AM
Hello,

how should the following look like if the file test.php is on the path http://mysite.com/custompages/test.php ?



switch ($filename)
{
case 'test.php':
$userinfo['activity'] = 'mypage';
break;
// add more cases here if you have more than one custom page. no need for multiple plugins. one plugin can handle all.
}switch ($userinfo['activity'])
{
case 'mypage':
$userinfo['where'] = '<a href="test.php?'.$vbulletin->session->vars[sessionurl].'">My Page</a>';
$userinfo['action'] = "Viewing My Page";
$handled = true;
break;
// add more cases here if you have more than one custom page. no need for multiple plugins. one plugin can handle all.
}


If I put /custompages/test.php instead of test.php I get the right link and redirection in the "who's online" list, but instead of the action I get "Unknown Location".

tiga2
09-24-2010, 04:12 PM
I love this tutorial but Im lacking of showing the latest threads on that Page.
I hope some has the php code for pulling the latest threads out

Lostboyfan
09-24-2010, 06:59 PM
Where do we put the text and custom code. Like html and text? I see an area that says to put your own custom code but I keep getting errors.

Wilfred1
09-30-2010, 04:06 AM
I have my forums located at root/forum
I have a shop that uses the software CS-CART (http://www.cs-cart.com) located at root/shop. It has its own index.php file

What I would like to do is wrap a forum page, with the header and navbar, around the shop pages.

I tried using this method and the template I created was an iframe but it isn't the best solution...for example click refresh and the iframe goes back to the shop home page etc.

Can anyone advise what would be the best way to do this...thanks

Gn_Snake
10-04-2010, 08:30 AM
Hello everyone,
I tried to read this thread a little but honestly I'm lost ... :D

I would need to insert a php code within a thread, you can do?

Lynne
10-04-2010, 02:07 PM
Hello everyone,
I tried to read this thread a little but honestly I'm lost ... :D

I would need to insert a php code within a thread, you can do?
This article is about create a whole new page. It won't help if you are trying to insert php code into a thread.

Gn_Snake
10-04-2010, 05:54 PM
This article is about create a whole new page. It won't help if you are trying to insert php code into a thread.

Sorry Lynne :erm:

I look for the solution ... even if I have not seen it yet

ceho
10-07-2010, 07:27 PM
Hi Lynne,

was it possible to use {username} on a custom site? I use them your way and would like to add {username} on one or two of my custom sites, like e.g. in the vB notices.

Is there any chance to realize this? Thanks a lot!

Lynne
10-07-2010, 08:40 PM
A custom site? You mean in the template for this page? You can use {vb:raw bbuserinfo.username} in a template.

ceho
10-08-2010, 07:30 AM
Yes, this was exactly it. Very easy ;-). Thanks a lot!

Duncan
10-18-2010, 04:31 AM
My forum is forum.com. However, I want to make a page at forum.com/pages/default.php

How do I go about doing this? I tried a couple of changes but no success.

Wilfred1
10-18-2010, 04:46 AM
My forum is forum.com. However, I want to make a page at forum.com/pages/default.php

How do I go about doing this? I tried a couple of changes but no success.
Duncan
All my pages are in a folder called pages so here is one of mine as an example. It is a page called "About This Site" and what you need to be aware of is the line that starts with "chdir" as this is where you will need to insert your site details so it changes the directory to where your forums are.
<?php

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

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

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

// 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 ('/home/MYSITE/public_html');
require_once('./global.php');

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

$navbits = construct_navbits(array('' => 'About This Site'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'About This Site';

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

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

?>
Hope it helps

Duncan
10-18-2010, 04:52 AM
Thank you so much!! I will work on this now. I really appreciate it.

--------------- Added 1287381349 at 1287381349 ---------------

My forums are located at forums.com however, I want the pages to be in forums.com/pages/ - however, when I change the location to home/ACCOUNT/public_html/pages it doesn't work.

I get this error:

Fatal error: require_once() [function.require]: Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ACCOUNT/public_html/PAGES/mypage.php

When I install on the forum root, however, without any modifications it works like a charm. How can I get it to work in this directory?

--------------- Added 1287381571 at 1287381571 ---------------

Nevermind, I got it to work. Thank you!

ubcforums
10-24-2010, 04:55 PM
Hi, can I use $_GET from the test.php ?

cellarius
10-24-2010, 07:10 PM
Of course. You can use any php code. But you should use the vB input cleaning mechanisms: https://vborg.vbsupport.ru/showthread.php?t=119372

Dusty Miller
10-29-2010, 12:54 PM
I've got a custom page that shows a search form, it then posts the result back to the same page. This works well if nobody is logged in.

If logged in you get the error: Your submission could not be processed because a security token was missing

I've followed and used this template anyone got an ideas what I'm doing wrong?

Lynne
10-29-2010, 01:38 PM
You forgot to put the securitytoken into the form. Do a Search in Templates to find it used in other forms and use that code.

Dusty Miller
10-29-2010, 05:48 PM
I've coded the form within the php page, not the template. Should the form be coded within the template page instead?

Lynne
10-29-2010, 10:40 PM
I've coded the form within the php page, not the template. Should the form be coded within the template page instead?
It doesn't matter how it's coded as long as you include the securitytoken into the form. Usually it's an input field of type hidden.

Lostboyfan
11-10-2010, 07:37 PM
Thank you Lynne for showing me how to do this. Now I can make a cutom home page with using VB templates.

------added--------

i wanted to make a page out of my vbulletin forum root. I keep getting this error and I have been stuck ever since.

Fatal error: Call to undefined function construct_navbits()

Anyone can PM me too if they want more details

hihello
11-17-2010, 05:12 AM
I tried as instructed. Everytime I click on the the new navigation, it takes me to the new page but the tab jumps over to the forum nav. What am I doing wrong?

Lynne
11-17-2010, 01:53 PM
I tried as instructed. Everytime I click on the the new navigation, it takes me to the new page but the tab jumps over to the forum nav. What am I doing wrong?
What new navigation? There is no navigation created in this page.

hihello
11-17-2010, 03:58 PM
What new navigation? There is no navigation created in this page.

I created a new navigation link to link to the new page. When I click the link, it goes to the page but highlights the forum link instead. I figured it may be the template problem since I tried two different ways and the outcome was the same. I tried adding my own script in navbar and then I tried the tab mod I found on this forum.

Lynne
11-17-2010, 05:46 PM
I created a new navigation link to link to the new page. When I click the link, it goes to the page but highlights the forum link instead. I figured it may be the template problem since I tried two different ways and the outcome was the same. I tried adding my own script in navbar and then I tried the tab mod I found on this forum.
It would have to do with the condition you wrote for your new tab to show as active.

hihello
11-17-2010, 09:42 PM
Yes. It's not the template. It's working now that I installed a new nav hack. It's very easy. Btw, I found your article on removing various navtab very help. I couldn't figure out how to remove the What's new. Thanks!!!

TheInsaneManiac
11-29-2010, 10:36 PM
How do I allow my pages to use the do action like my old one?
eval('$navbar = "' . fetch_template('navbar') . '";');
if ($_REQUEST['do'] == 'support')
{
eval('print_output("' . fetch_template('impostersupport') . '");');
}
if ($_REQUEST['do'] == 'port')
{
eval('print_output("' . fetch_template('porthelper') . '");');
}
eval('print_output("' . fetch_template('impostergenerators') . '");');

Lynne
11-29-2010, 11:16 PM
How do I allow my pages to use the do action like my old one?
eval('$navbar = "' . fetch_template('navbar') . '";');
if ($_REQUEST['do'] == 'support')
{
eval('print_output("' . fetch_template('impostersupport') . '");');
}
if ($_REQUEST['do'] == 'port')
{
eval('print_output("' . fetch_template('porthelper') . '");');
}
eval('print_output("' . fetch_template('impostergenerators') . '");');
Basically the same except you need to change all your eval/fetch_template statements to use the new syntax (the new syntax is covered in other articles, although shown in the code for this one).

TheInsaneManiac
12-02-2010, 02:26 PM
Why does this show at the top of every page?
$stylevar[htmldoctype]

Lynne
12-02-2010, 04:52 PM
Why does this show at the top of every page?
$stylevar[htmldoctype]
That is not valid syntax for vB4. Also, what do you mean "at the top of every page"? This is an article about creating a single page. If that code is showing on every page, then it isn't an issue for this article/page.

Shadow666
12-07-2010, 12:50 AM
Hi,

The copyright in the footer for the new page I was creating has now disappeared, since upgrading to vbulletin 4.1.0 PL2.


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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'test');
define('CSRF_PROTECTION', false);

// ################### 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('test',
);

// 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');
require_once('./includes/test_func_var.php');

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

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'test';



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


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


?>


The copyright is in the file includes/test_func_var.php

<?php
$vbphrase[powered_by_vbulletin] = '<a href="http://www.test.com">Test v1.0</a> Copyright &copy; ' . date('Y') . ' <br />' . $vbphrase[powered_by_vbulletin];
?>


Template test


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


{vb:raw footer}
</body>

</html>


Why does this no longer work.

Thanks.

Lynne
12-07-2010, 01:35 AM
Are you running 4.1.0 PL2? Or PL1 or no PL at all?

Shadow666
12-07-2010, 01:38 AM
Sorry, post edited. PL2

Lynne
12-07-2010, 02:32 PM
Sorry, post edited. PL2
did this used to work in another 4.x version? It's hard to tell what is wrong when you have not posted the template at all, nor do we know the full contents of the other file you call. What sort of debugging have you done to figure out where the problem lies?

Shadow666
12-07-2010, 06:16 PM
Original post updated.

This worked fine with 4.0.x until updated to 4.1.0 PL2

Any other mods that I have installed, the copyright for them has also disappeared. e.g. VB Pro Garage Timeslips 3.0.7

Lynne
12-08-2010, 01:17 AM
I don't know what you mean regarding the other mods (or what they have to do with this page). Have you tried putting the file contents directly into the main file and seeing if it works there? Or setting it to something else in the file to see if it works? Like I asked, what have you done so far to try to troubleshoot this?

And actually, you say it used to work? I could have sworn the footer template gets rendered when global.php is called, so I'm not sure how it could have worked before. And yes, I just checked and it is. You can't call your file that has a phrase to be used in the footer template *after* the footer template has been rendered.

compunerdy
12-09-2010, 06:05 AM
I got the new page up and working but when I put the following code into the template it will not load the Flash file.


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="975" height="600" id="saberBuilder_v1.0_securityFix" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="saberBuilder_v1.0_cart.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="saberBuilder_v1.0_cart.swf" quality="high" bgcolor="#ffffff" width="975" height="600" name="saberBuilder_v1.0_securityFix" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

If I remove the following code


{vb:raw headinclude}
{vb:raw headinclude_bottom}


The flash file plays just fine but then the page does not look right. Why is this conflicting?

Any help would be great appreciated as I do not have much hair left to pull out.

Lynne
12-09-2010, 02:20 PM
What exactly is the result when you put that code in the template (do you see it? Is it in the page source? etc)? Do you have a link?

compunerdy
12-09-2010, 03:19 PM
It looks like it is trying to load but doesn't. Here is a link http://forums.thecustomsabershop.com/mhsbuilder/mhsbuilder.php

Lynne
12-09-2010, 05:22 PM
Put in the full url for your swf.

compunerdy
12-09-2010, 05:42 PM
Tried that already.. Its in there now though if you want to take a look. I can also remove those 2 lines of code to show that it loads fine without them. Something in the headinclude and headinclude_bottom make it not load. I am just not sure what.

EDIT.. Actually it does work now in firefox just not IE

DOUBLE EDIT.. added one more full URL and it works fine now.. DUH!!

Thanks and sorry for wasting your time.

Lynne
12-09-2010, 06:25 PM
Can you create a second page that doesn't have the header/navbar so I can compare the two?

compunerdy
12-09-2010, 06:42 PM
It works now when I put in the full URL. Evidently the headers change the working directory which made it not load without the full URL.

Lynne
12-09-2010, 09:54 PM
Great! :)

stevectaylor
12-18-2010, 09:21 AM
would this still work in a sub-folder?

--------------- Added 1292675660 at 1292675660 ---------------

I'm struggling here on a test page; Why wont it allow the 'php include' function to show.

<div class="blockbody">
<div class="blockrow">
Testing this page for php input. <?php include("offers/choice_ad1.php"); ?>
</div>
</div>

Lynne
12-18-2010, 04:20 PM
would this still work in a sub-folder?

--------------- Added 18 Dec 2010 at 04:34 ---------------

I'm struggling here on a test page; Why wont it allow the 'php include' function to show.

<div class="blockbody">
<div class="blockrow">
Testing this page for php input. <?php include("offers/choice_ad1.php"); ?>
</div>
</div>
You cannot put php in the template. PHP goes into the php file, and html goes into the template.

CroNiX
12-18-2010, 09:09 PM
First, thank you for this. I learned a lot and have a few things planned!

When following the example, I noticed that if you went to the url:
http://www.yoursite.com/test (with no .php) the page still comes up fine, but the online locations page would break. I fixed this easily by adding an extra statement to the switch in the plugin using the online_location_process hook:

switch ($filename)
{
case 'test': //added this line, would need to do for each file if more than one
case 'test.php':
$userinfo['activity'] = 'mypage';
break;
// add more cases here if you have more than one custom page. no need for multiple plugins. one plugin can handle all.
}

I'm not sure if this has anything to do with the fact I'm using the mod rewrite url rules.

Lynne
12-18-2010, 10:30 PM
Thanks for posting that. I'm guessing you are correct in that it has something to do with the mod rewrite rules because I can't go to just mysite.com/test and get the same page.

stevectaylor
12-19-2010, 07:54 AM
You cannot put php in the template. PHP goes into the php file, and html goes into the template.

Thanks lynne, I did guess that, but when inserted to the php it appears at the very top. How do you position a php include statement.

Shamil.
12-19-2010, 11:24 AM
Thanks lynne, I did guess that, but when inserted to the php it appears at the very top. How do you position a php include statement.

This is what I did


<?php

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

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

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

// 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 ('/home/hostcule/public_html');
require_once('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
if (!in_array($vbulletin->userinfo['usergroupid'], array(5,6,7))) print_no_permission();

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Hostcule Manager';

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

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

?>


It went in after: Start Main Script.

stevectaylor
12-19-2010, 04:39 PM
This is what I did


<?php

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

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

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

// 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 ('/home/hostcule/public_html');
require_once('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
if (!in_array($vbulletin->userinfo['usergroupid'], array(5,6,7))) print_no_permission();

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Hostcule Manager';

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

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

?>


It went in after: Start Main Script.

Thanks but can't really see how it changed.

Lynne
12-19-2010, 04:45 PM
Thanks lynne, I did guess that, but when inserted to the php it appears at the very top. How do you position a php include statement.
In the php page, test.php, after you include global.php, just include your script also - something like:
chdir ('/home/hostcule/public_html');
require_once('./global.php');
include("offers/choice_ad1.php");

It should not have any output. If it does, then you need to assign it to a variable and then output that variable in your template where you want it.

stevectaylor
12-19-2010, 04:56 PM
In the php page, test.php, after you include global.php, just include your script also - something like:
chdir ('/home/hostcule/public_html');
require_once('./global.php');
include("offers/choice_ad1.php");

It should not have any output. If it does, then you need to assign it to a variable and then output that variable in your template where you want it.

I had done this and seperately set a variable but both print the output before that header of the page.

Lynne
12-19-2010, 05:28 PM
Thanks lynne, I did guess that, but when inserted to the php it appears at the very top. How do you position a php include statement.

I had done this and seperately set a variable but both print the output before that header of the page.
You need to look at the contents of that file. If it has any echo statements, then that is going to cause what you are seeing. You cannot use echo if you want to put the ads where you want them.

stevectaylor
12-19-2010, 06:20 PM
I think I might have suused the issue. When I put in custom variables it doesn't like them e.g

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
$pagead = 'trial';

Then in template add

{vb:raw pagead}

Nothing shows, but alter the standards and the standards work fine.

Lynne
12-19-2010, 06:38 PM
I think I might have suused the issue. When I put in custom variables it doesn't like them e.g

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
$pagead = 'trial';

Then in template add

{vb:raw pagead}

Nothing shows, but alter the standards and the standards work fine.
You need to register any variable for use in a template.

stevectaylor
12-20-2010, 08:57 AM
You need to look at the contents of that file. If it has any echo statements, then that is going to cause what you are seeing. You cannot use echo if you want to put the ads where you want them.

Registered the variable. What are the acceptable alternatives to echo as the print function also returns the same result?

Lynne
12-20-2010, 03:14 PM
Registered the variable. What are the acceptable alternatives to echo as the print function also returns the same result?
instead of:
echo "Hello World!";
use
$outputvar .= "Hello World!";

stevectaylor
12-20-2010, 03:28 PM
instead of:
echo "Hello World!";
use
$outputvar .= "Hello World!";
Thanks Lynne,

I found the answer in another thread of yours on vbulletin.com and used the following which works a dream.

ob_start();
include('offers/accommodation.php');
$pagead = ob_get_contents();
ob_end_clean();

MatiasCandy
12-29-2010, 02:25 AM
Lynne,

First Thank you for helping everyone.

My issue is a little more complexed

I understand how to add a page and I completed it pretty quick (just your test page)

Now that I have learned that what I need to do is get a bit more complex.

I have a custom app I am trying to bring into vb4.x. Someone else had it in 3.8 but it was very sloppy and I want it to be perfect.

So here are the first set of questions:

1. how do I add conditions in the template for

if guest show this "please register"
if Registered but never filled out app show this "Please Fill this out"
If registered and filled this out show "Welcome Back."

now all of this is already in PHP in my file but I want this app to be perfect like I said.

2. In my PHP file they have html / php mixed mainly queries of the database, display results, and $bbuserinfo[useremail], etc...

Please go slow I am not a programmer but I want to learn how to do this.

Thank you for your time

Lynne
12-29-2010, 02:40 AM
This is an article about how to create another page. For your questions....
1. Read the other articles in this forum about conditions. If you have questions, post them in that article. If you can't get your page to work, you need to post your own thread with the complete code for your page and templates.

2. Not sure what your question is there as it's just a statement.

MatiasCandy
12-29-2010, 03:29 AM
Thank Lynne, I have started my own thread over here (in case you still want to help me)

My First Import (https://vborg.vbsupport.ru/showthread.php?p=2140509)

larryd
12-29-2010, 12:09 PM
Can you tell me what I'm doing wrong here? This script should be returning and printing out the id field from all entries in the database yet it only returns and prints the last id.

http://vb.newcelica.org/test.php


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

$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);

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

include(config.php);
$result = mysql_query("SELECT * FROM dynotable WHERE name <> '' ORDER BY name ASC",$dynodb);

while ($row = mysql_fetch_array($result)) {
$id = $row["id"];

$output = "<table><tr><td>id</td><td>$id</td></tr></table>";

$templater->register('output', $output);
print_output($templater->render());

}

?>

Lynne
12-29-2010, 04:03 PM
Can you tell me what I'm doing wrong here? This script should be returning and printing out the id field from all entries in the database yet it only returns and prints the last id.

http://vb.newcelica.org/test.php


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

$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);

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

include(config.php);
$result = mysql_query("SELECT * FROM dynotable WHERE name <> '' ORDER BY name ASC",$dynodb);

while ($row = mysql_fetch_array($result)) {
$id = $row["id"];

$output = "<table><tr><td>id</td><td>$id</td></tr></table>";

$templater->register('output', $output);
print_output($templater->render());

}

?>


Once you use print_output, that is the end of the page rendering. You only use print_output when you are completely done and ready to render the page.

stevectaylor
01-03-2011, 06:30 PM
Any ideas how to get the like button to show on the page?

Lynne
01-03-2011, 11:52 PM
Any ideas how to get the like button to show on the page?
You would just add the code to the template. I do not know the exact code, if that is what you are asking.

gaitantkd
01-07-2011, 03:28 PM
hi i tried this but no luck using vb 4.1.0 PL2

test.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('TEST',
);

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';

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

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

?>

template named test:
{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}</title>
{vb:raw headinclude}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

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

<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">
Text
</div>
</div>

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

Lynne
01-07-2011, 03:57 PM
hi i tried this but no luck using vb 4.1.0 PL2

test.php
.......
// pre-cache templates used by all actions
$globaltemplates = array('TEST',
);

.......

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

?>

template named test:

You clearly state in your php page that your template is named "TEST" and then you named your template "test". That is not the same. You need to name it "TEST" (ALL CAPS).

cindie
01-13-2011, 09:36 PM
The page is working fine, but when it displays the new (Gallery) page, the Forum tab is up instead of the new (Gallery) tab and the submenu for Forum is showing. Any ideas?

--------------- Added 1294962412 at 1294962412 ---------------

Never Mind.

rumas
01-14-2011, 05:26 PM
Hello Lynne,
I used this thread to create a Google custom search results page and it works great.

However, my problem is I have Google adsense ads in the navbar and footer, how do I exclude the ads from the "search results page" as they are against Google terms of service?

Lynne
01-15-2011, 03:37 AM
You would need to put a condition around the code in the ad to not show it on this page. (Use your definition of THIS__SCRIPT in the condition.)

rumas
01-16-2011, 09:08 AM
Thank you Lynne for helping me and everyone else with in this thread...

Here is the condition I used around the ad, works great. Maybe this will help someone else!

<vb:if condition="THIS_SCRIPT != 'Your_Definition'">

</vb:if>

tonmo
01-16-2011, 01:20 PM
Hi Lynne - I'm wondering if you can help me. I have tons of pre-existing custom HTML (actually .php) pages, all which leverage a server-side include, let's call it header.php.

I'd like to replace the contents of header.php with something that would allow all of my pre-existing pages to automagically support my vbulletin header and navigation.

All these pages also reference a footer.php, if that is helpful to the cause (but that's easy enough for me to replicate, at least visually what is shown to the user).

--------------- Added 1295192670 at 1295192670 ---------------

Thank you Lynne for helping me and everyone else with in this thread...

Here is the condition I used around the ad, works great. Maybe this will help someone else!

<vb:if condition="THIS_SCRIPT != 'Your_Definition'">

</vb:if>
I get an undefined error when trying to wrap this around my ad code via the Advertisements feature within AdminCP. Do you embed your ads manually?

Lynne
01-16-2011, 05:10 PM
Sorry tonmo, but I don't understand your question at all. This is just a tutorial on how to make a single custom page. If you want to reference other scripts in the page, that is fine, but you need to write the code in those scripts and write the code in the php page. This isn't a tutorial on how to write your code.

As for the undefined error.... you need to change Your_Definition to a valid name or that isn't going to work.

tonmo
01-16-2011, 05:36 PM
To clarify - I have dozens of static php pages that I created long before I implemented vBulletin. The page format is this:

HEADER
..
UNIQUE ARTICLE CONTENT
..
FOOTER

The HEADER and FOOTER are separate included files (i.e., header.php and footer.php); they are common across all article pages. I am wondering if there is any common vb4 code I can put into the header and footer files in order to wrap all of these articles into the vbulletin look and feel. I'm running 4.1.1.

Does that help explain what I'm trying to do?

Lynne
01-16-2011, 06:27 PM
To clarify - I have dozens of static php pages that I created long before I implemented vBulletin. The page format is this:

HEADER
..
UNIQUE ARTICLE CONTENT
..
FOOTER

The HEADER and FOOTER are separate included files (i.e., header.php and footer.php); they are common across all article pages. I am wondering if there is any common vb4 code I can put into the header and footer files in order to wrap all of these articles into the vbulletin look and feel. I'm running 4.1.1.

Does that help explain what I'm trying to do?
Yes, that explains it better. I would guess you would want to assign the contents of those files to a variable and then spit them out into the template. I know I've seen the code posted around here to do that, but don't know it off the top of my head. (I think it's even posted in this thread somewhere.)

TheInsaneManiac
01-17-2011, 03:43 AM
Basically the same except you need to change all your eval/fetch_template statements to use the new syntax (the new syntax is covered in other articles, although shown in the code for this one).

Can you use an example.

tonmo
01-17-2011, 01:00 PM
Yes, that explains it better. I would guess you would want to assign the contents of those files to a variable and then spit them out into the template. I know I've seen the code posted around here to do that, but don't know it off the top of my head. (I think it's even posted in this thread somewhere.)

Thanks - but probably not for me. I want each page to retain its own unique title and I don't believe your method would allow that.

All of my static pages exist in different places throughout my site, and have signifcant inbound links that I don't want to break. So far I've found two ways to convert them into vb pages:

1) Simply create new Article pages via CMS and copy/paste the original article contents into the new file. Convert the static page to a permanent redirect which points to the new CMS article.

2) Use the method described in this thread (How To Create Your Own vBulletin Page).

I'm finding both to be a bit labor-intensive (I have dozens of pages). Maybe 5 or 10 mins per article - those add up! Since all my static pages use server-side includes for the header and footer, I was hoping I could insert the logo, ad, and navbar at the top, and the footer at the bottom, so that I would only need to edit two files (the two includes) and viola! My site is converted. Seems that's not an option?

fireglow305
01-28-2011, 01:59 PM
Good article, thank you. ;)

odln018
02-04-2011, 04:59 PM
I must be truly dumb, as I can't get this to work. I don't know what to use as a "link.php". Also, should the drop down appear if the link.php doesn't exist?

Stupid I'm sure.

Lynne
02-04-2011, 05:17 PM
I must be truly dumb, as I can't get this to work. I don't know what to use as a "link.php". Also, should the drop down appear if the link.php doesn't exist?

Stupid I'm sure.
link.php? And what dropdown?

odln018
02-04-2011, 05:18 PM
Geez, I can't even post in the right thread.

odln018
02-05-2011, 07:15 PM
Would someone who's gotten this up and running please PM me?

Thanks in advance

ceho
02-12-2011, 04:28 PM
Hi, would it be possible to add any information from a user's profile (Profile, Image Options, User Profile Fields) to a custom site? I have all the conditions etc., e.g. from postbit_legacy, but I don't get any of these to be displayed on a custom site. Or would I have to change the php file, or add something to the head of my custom site...? Sorry, I am lost, would be great to get a hint here. Thanks in advance.

Lynne
02-12-2011, 04:30 PM
Hi, would it be possible to add any information from a user's profile (Profile, Image Options, User Profile Fields) to a custom site? I have all the conditions etc., e.g. from postbit_legacy, but I don't get any of these to be displayed on a custom site. Or would I have to change the php file, or add something to the head of my custom site...? Sorry, I am lost, would be great to get a hint here. Thanks in advance.
You may put anything you want on this page. However, you may need to copy the php from another page onto this one if you want some of the same information displayed. You cannot just take a variable name that is used on another page and plop it into the template for this page and have it display the same thing. Behind every variable is some code that defines it.

ceho
02-12-2011, 05:15 PM
Phew, this means I need to find out which php is behind each condition? Would you know a trick to do so? Firebug doesn't help on this I am afraid. Let's say I want to copy the content from postbit_legacy to a custom site, how can I find out the correct php file? Can I just copy the content into the according php content of my custom page?

Just a little hint and I try my best to go on alone ;-). Thanks a lot for you quick help Lynne!

basilrath
02-13-2011, 09:11 PM
Is it possible to get the "whos viewing this thread or post" box at the bottom of my custom page?

Lynne
02-13-2011, 11:39 PM
Is it possible to get the "whos viewing this thread or post" box at the bottom of my custom page?
Sure, if you copy the code for it also.

iBaker
02-14-2011, 06:24 AM
I have found with 4.1.1 that:
- If I have the forums in my root
- My pages in a folder /pages/
- I use the chdir ('/home/xxxx/public_html');

The page displays with correct styling ONLY if I have the vb option "Always use Forum URL as Base Path" set to Yes...If I set it to No (which I need to do) I lose all the styling from the vb style

Anyone come across this and know of a way around it?

basilrath
02-14-2011, 06:45 AM
Sure, if you copy the code for it also.

Well i tried that Lynne but sadly nothing...

Im assuming its the section in the showthread ???

Thanks for any info

Armadio
02-14-2011, 06:38 PM
I have found with 4.1.1 that:
- If I have the forums in my root
- My pages in a folder /pages/
- I use the chdir ('/home/xxxx/public_html');

The page displays with correct styling ONLY if I have the vb option "Always use Forum URL as Base Path" set to Yes...If I set it to No (which I need to do) I lose all the styling from the vb style

I have the same problem, look at the picture

basilrath
02-15-2011, 12:15 PM
Is there a way to add "who is viewing this thread" or in my case page to my custom page????

Lynne
02-15-2011, 03:35 PM
Is there a way to add "who is viewing this thread" or in my case page to my custom page????
I do not have the code for this, but yes there is a way. The code you need is probably at the bottom of the forum.php or showthread.php page since both of those will show users browsing that page.

justasiam
02-26-2011, 06:40 PM
Thank you for these instructions. I only have 1 question.

You said to create 2 new plugins. What do I name them?

Lynne
02-26-2011, 07:57 PM
Thank you for these instructions. I only have 1 question.

You said to create 2 new plugins. What do I name them?
You do not need to create any plugins for a page. If you do create plugins, you may name them whatever you want - that only matters to you.

CampinCarl
03-06-2011, 03:44 PM
Can someone please tell me how to add the vB sidebar to my own custom page?

bchertov
03-08-2011, 10:20 PM
Sorry folks, but I haven't read through this whole thread. I did see the first post where it suggests creating a template for a custom page.

I want to create a media kit for my site and I want to look good!

I'm thinking it would be best to use some sort of page layout program (dreamweaver, etc.) and take the generated HTML and display it within my vBulletin 4.x site, probably in the content area. It could replace just the contents of a post or article, or completely fill the page between the header and footer.

Ideally it wouldn't have to be recoded to be in the VB template language.
How would I include the generated HTML in vbulletin?
What about CCS files or anything else needed to display it inside of vBulletin?

How would you suggest I proceed?

And what's the best Mac program to use for the layout that's relatively simple but has some flexibility?

Thanks!
Barry

SkyStryder
03-10-2011, 07:05 PM
Can someone please tell me how to add the vB sidebar to my own custom page?

I need to do this also.:up:

--------------- Added 1299794304 at 1299794304 ---------------

Alternatively, Is there code we can add to the example Lynne provided that
will bring in the cms layout? It may be just a matter of initializing and
adding to the template? I have seen this which gives me hope:
<div class="vbcms_content">
{vb:raw layout}
</div>
Then I could assign it to a section and category? That would be awesome!

priest1311
03-15-2011, 03:15 PM
Hello all,

So if i have been ready it correct this is the way to get a custom homepage with the navbar and footer. Because i have been searching like crazy for it but if i can add my own html layout and still use the header and footer that would be great. This is correct right?

Priest!

Lynne
03-15-2011, 03:53 PM
Hello all,

So if i have been ready it correct this is the way to get a custom homepage with the navbar and footer. Because i have been searching like crazy for it but if i can add my own html layout and still use the header and footer that would be great. This is correct right?

Priest!
You may add your own html. Just try it out and see.

kc3815
03-20-2011, 11:12 PM
I just get the following when I navigate to http://www.mysite.com/test.php

'test')); eval('$navbar = "' . fetch_template('navbar') . '";'); // spit out template eval('print_output("' . fetch_template('test') . '");'); ?>

Any Ideas?

Lynne
03-20-2011, 11:31 PM
You've done something wrong. I suggest you redo it all and make sure you are using a plain text editor when creating the php file. like notepad.

kc3815
03-21-2011, 09:07 PM
You've done something wrong. I suggest you redo it all and make sure you are using a plain text editor when creating the php file. like notepad.

Thanks for the fast response. I tried again and was able to get it to work.

Another question if you don't mind...

Please forgive me if my terminology is not perfect.

I see that I can set values in the // ###### YOUR CUSTOM CODE GOES HERE ##### area and the register them for use by the template in the // ###### NOW YOUR TEMPLATE IS BEING RENDERED ###### area. However, I want to display the output from some php code. Is there a way to add the code and set it's value for template use?

Or I guess, in other words, is there a way to run a php script and display it's output within the template?

Lynne
03-21-2011, 10:54 PM
Or I guess, in other words, is there a way to run a php script and display it's output within the template?
Run the PHP code and put the result into a variable and then put the variable in the template.

boodog
03-23-2011, 12:35 AM
Worked beautifully. Thank you Lynne :)

Phaedrus
03-27-2011, 04:19 AM
Excellent. I was able to make a very nice Privacy Statement rather than the pdf file I had before.

Mark4865
03-27-2011, 10:26 AM
Hello,

Can anyone tell me how we view the page we have created, we followed all instructions but have no idea how to view the page.

Please help??

Lynne
03-27-2011, 05:48 PM
Hello,

Can anyone tell me how we view the page we have created, we followed all instructions but have no idea how to view the page.

Please help??
yoursiteurl.com/yourpagename.php

Mark4865
03-28-2011, 11:07 AM
Hello Lynne,

Thanks for response, tried that this is what I get, sorry I am a technical idiot

Mark

Parse error: syntax error, unexpected T_STRING in /var/www/clients/client11/web26/web/custom.php on line 3