PDA

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


Pages : [1] 2 3 4 5

Lynne
16 Nov 2009, 17:38
This is an updated article on how to create your own vbulletin powered page. It's only for use with vB4.

This is NOT my work. I'm posting this from another thread where vB Style (http://www.vbulletin.org/forum/member.php?u=215438) took the time to write this out. And his work is based on the article by Gary King (http://www.vbulletin.org/forum/member.php?u=5183) here - How to create your own vBulletin-powered page! (uses vB templates) (http://www.vbulletin.org/forum/showthread.php?t=62164)

Instructions to Create your Own Page:

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

?> - Be sure to change 'TEST' to the actual template name (WARNING: the template name is CASE SENSITIVE!!!), and change 'test' to the filename or a unique name for the page. Also, change 'Test Page' and 'My Page Title' to whatever you want to show in the navbits, such as 'Viewing Member Profile' (just an example).

2. Create the Template:
- If you are in debug mode, create the template in your MASTER STYLE so it shows up in all your styles, otherwise make sure you create the template in the style you are using. If following the page above, call the template TEST (WARNING: the template name is CASE SENSITIVE!!!) with the following content:
{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">
Text
</div>
</div>

{vb:raw footer}
</body>
</html>.
Instructions to Add your Page to the Who's Online List (WOL):
Create two plugins using the following hooks. Replace mypage and similar with your information.

1. hook location - online_location_process:
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.
}.
2. hook location online_location_unknown:
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.
}.
The colored part in the code above shows what you need to change in the plugins (both reds should be the same and both blues should be the same, whereas green can be whatever you want).


Please see this article for help with rendering templates - [vB4] Rendering templates and registering variables - a short guide (http://www.vbulletin.org/forum/showthread.php?t=228078)

cellarius
17 Nov 2009, 14:03
Thanks Lynne for compiling this - this will be most helpful for many users, no doubt :)

So, I gather you agree with my doubts (http://www.vbulletin.org/forum/showpost.php?p=1914537&postcount=13) that the NO_REGISTER_GLOBALS constant is still needed?

Lynne
17 Nov 2009, 15:18
Thanks Lynne for compiling this - this will be most helpful for many users, no doubt :)

So, I gather you agree with my doubts (http://www.vbulletin.org/forum/showpost.php?p=1914537&postcount=13) that the NO_REGISTER_GLOBALS constant is still needed?
Yep. I did a search in the vb pages and couldn't find NO_REGISTER_GLOBALS lurking around in any of them. :)

cellarius
17 Nov 2009, 15:29
Excellent! :)

Brandon Sheley
17 Nov 2009, 15:32
Thanks for the article Lynne :)

/me bookmarks this one

Mythotical
17 Nov 2009, 19:40
Might want to add if conditions to your article as well. I did a search through templates and found this:

To do an if condition in a template:
<vb:if condition="$myvar['mytable']">
&nbsp; blah
<vb:else />
&nbsp; bleh
</vb:if>

Just replace $myvar with the variable you are using from your db query and mytable should be replaced with the row or column you are calling from the db.

Lynne
17 Nov 2009, 20:22
There are already articles about conditions to use in templates. I would just be repeating them by putting them in this article. There are also articles about rendering templates and registering variables also (which I linked to). I wanted to put this up as just a basic outline to get someone started.

Mythotical
17 Nov 2009, 21:07
Actually you point me to one article referring to conditions. I have not found one anywhere. You do that then your my savior.

bobster65
17 Nov 2009, 21:35
Actually you point me to one article referring to conditions. I have not found one anywhere. You do that then your my savior.

http://www.vbulletin.org/forum/showthread.php?t=217570

Mythotical
17 Nov 2009, 21:35
http://www.vbulletin.org/forum/showthread.php?t=217570

Actually I found that, seems I wasn't searching for the right term.

nomoreturn
17 Nov 2009, 23:34
Where we have to upload test.php

cellarius
17 Nov 2009, 23:45
Where we have to upload test.php
Put it in your forum root.

Lionel
18 Nov 2009, 02:11
Nice, and what do you do if you want to have 3 columns in your page? Right now I had to create a table with 3 td, but I had rather avoid that

Lynne
18 Nov 2009, 02:39
Nice, and what do you do if you want to have 3 columns in your page? Right now I had to create a table with 3 td, but I had rather avoid that
There is no reason you can't use a table if you don't want to use divs. But, if you want to use divs to make 3 columns, google is a great place to start. There are lots of sites that will show you how to use divs in place of tables.

Lionel
18 Nov 2009, 03:22
Got your first reply. Sorry Lynne. I asked because I found you extremely helpful and because I could not find any places by vb to explain about the new css, until I saw that there were new templates.

Specially whatever you put in $stylevar does not necessarily gets implemented. So instead of thinking that they were bugs, I inquire first.

Mythotical
18 Nov 2009, 04:22
Lynne, so how would we call multiple templates for the same custom page and it actually work?

Lynne
18 Nov 2009, 04:33
You would do it as before, only use the new syntax. So, something like this:
$pagetitle = 'My Page Title';

$foo = 'hello';
$bar = 'world';
$templater = vB_Template::create('first_template');
$templater->register('foo', $foo);
$templater->register('bar', $bar);
$my_variable = $templater->render();


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

You would use {vb:var foo} and {vb:var bar} in your first_template to insert the variables $foo and $bar and then you would use {vb:var my_variable} in the TEST template to insert the output from $my_variable.

Mythotical
18 Nov 2009, 04:37
EDIT: I'm a fruitcake, damn pain pill is kicking my butt right now.

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

Missing that from my print_output area.

Thanks tho, at least I understand now.

--------------- Added 1258523530 at 1258523530 ---------------

Ok next question, I am reusing the same variable for different pages so I am not having a cluster of different variables within conditional statements. Right now it seems that is confusing me or its the meds, either way is it safe to say I can keep doing that or should I change it?

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

That var is what I am reusing for each page load of do=cat or do=file, etc. Do I need to change it to print_output or what?

LoveStream
18 Nov 2009, 16:51
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.

ragtek
18 Nov 2009, 17:16
Be sure that there's nothing before <?php

Lynne
18 Nov 2009, 18:58
Ok next question, I am reusing the same variable for different pages so I am not having a cluster of different variables within conditional statements. Right now it seems that is confusing me or its the meds, either way is it safe to say I can keep doing that or should I change it?

$templater->register('display', $display);That var is what I am reusing for each page load of do=cat or do=file, etc. Do I need to change it to print_output or what?
You should be able to use the same variable name on different pages - vb does that alot.

If you are wanting to register that variable on each page for use in the template, you need to put that line inbetween the $templater = vB_Template::create('whatever_template') and the $templater->render() lines.

edit: Or actually, you may be able to just preregister it at the top of you page for the template. See the article I link to in my first post to find out about preregistering variables.

cory_booth
18 Nov 2009, 19:06
Replace the line:
require_one ./gobal

With:

$curdir = getcwd ();
chdir('/yourpath/to/site/public_html/forum');
require_once('/yourpath/to/site/public_html/global.php');
chdir ($curdir);


Will allow you to put the php files anywhere on the site (i.e. mydomain.com/pages/)

LoveStream
19 Nov 2009, 02:02
Be sure that there's nothing before <?php

Yes, I double checked it but it still remains. I suspect that affected by server programs. When I logged there is no problem. It is only just for guest than member logged.

I create new my.php file. and do define this scripts refer to template files.

Regards.

--------------- Added 1258599895 at 1258599895 ---------------

Replace the line:
require_one ./gobal

With:

$curdir = getcwd ();
chdir('/yourpath/to/site/public_html/forum');
require_once('/yourpath/to/site/public_html/global.php');
chdir ($curdir);


Will allow you to put the php files anywhere on the site (i.e. mydomain.com/pages/)

Thanks. I do put it the same path with vB. When I trial as logged it's run very well.

Lynne
19 Nov 2009, 02:10
Replace the line:
require_one ./gobal

With:

$curdir = getcwd ();
chdir('/yourpath/to/site/public_html/forum');
require_once('/yourpath/to/site/public_html/global.php');
chdir ($curdir);
Will allow you to put the php files anywhere on the site (i.e. mydomain.com/pages/)
Actually, if you chdir, you don't want to then put the whole path to the global.php file. You would just go:

$curdir = getcwd ();
chdir('/yourpath/to/site/public_html/forum');
require_once('./global.php');
chdir ($curdir);

Mythotical
19 Nov 2009, 03:52
You should be able to use the same variable name on different pages - vb does that alot.

If you are wanting to register that variable on each page for use in the template, you need to put that line inbetween the $templater = vB_Template::create('whatever_template') and the $templater->render() lines.

edit: Or actually, you may be able to just preregister it at the top of you page for the template. See the article I link to in my first post to find out about preregistering variables.

Good point, I will look into doing that tomorrow. Need sleep first.

ragtek
19 Nov 2009, 10:14
What's withrequire_once(DIR . '/includes/class_bootstrap_framework.php');
vB_Bootstrap_Framework::init();

Do we need it?
Some files in vB4 have it^^

Lynne
19 Nov 2009, 14:41
You may need to add those lines depending on what you do in your code. But, every page doesn't need those lines. I *think*, but I'm not positive, that if you have hooks in your page, you will want to include those lines. But, since usually there aren't any hooks added into a custom page, then those lines aren't needed.

EidolonAH
21 Nov 2009, 13:14
Brilliant, thank you Lynne.:up:

Anseur
21 Nov 2009, 17:05
I've set this up on my test site, and it works OK while i'm logged in, but when I'm not logged in, and I visit this custom page, I just get a plain white screen.

looking at a source of this plain white pages shows me:

<!-- BEGIN TEMPLATE: dkp_template -->

<!-- END TEMPLATE: dkp_template -->


Here is the code currently used in the template for this custom .php 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}</title>
{vb:raw headinclude}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<li class="popupmenu">
<h2 class="blockhead">The MCO DKP System</h2>
<h2 class="blocksubhead"> <vb:if condition="$show['modcplink']">
<a href="javascript://" class="popupctrl">Administration</a>
<ul class="popupbody popuphover">
<li><a href="/25manwrathplus/admin/" target=”dkp_frame”>Admin Index</a></li>
<li><a href="sublink2.php">SubLink 2</a></li>
<li><a href="sublink3.php">SubLink 3</a></li>
</ul>
</li>
</vb:if> </h2>

<div class="blockbody">
<div {height:auto;}>

<iframe name="dkp_frame" width=100% height=1700px SCROLLING=no FRAMEBORDER=0 src="/25manwrathplus">dkp_frame</iframe>

</div>
</div>

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

Lynne
21 Nov 2009, 17:34
I've set this up on my test site, and it works OK while i'm logged in, but when I'm not logged in, and I visit this custom page, I just get a plain white screen.

looking at a source of this plain white pages shows me:
[code]
<!-- BEGIN TEMPLATE: dkp_template -->

<!-- END TEMPLATE: dkp_template -->


What is in your error_logs? (If you don't know where they are, ask your host.) What is in your php page that you created?

Anseur
21 Nov 2009, 18:06
Assuming you mean the error log I have access to via my hosts cpanel interface, the white page does not generate an error in there at all.

here's the contents of the php file. (dkp.php)


<?php

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

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

define('THIS_SCRIPT', 'dkp.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('dkp_template',
);

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

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

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

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

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

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

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

?>

Lynne
21 Nov 2009, 18:31
Take this line out of your template and see if it works:
<iframe name="dkp_frame" width=100% height=1700px SCROLLING=no FRAMEBORDER=0 src="/25manwrathplus">dkp_frame</iframe>

You may have to register the $show variable also - I can't remember if that one is required, but you might try it. (And please use the code tags for code, not quote tags.)

As for error_logs, I have no idea where they are in cPanel, I just know I get mine from a logs folder where the access_logs are also kept.

Anseur
21 Nov 2009, 18:37
Ok, did that, but I'm afraid it dosen't help.

happens in both IE8 and Firefox 3.5

I dunno if it is suppose to help, but I even rebuilt the styles from the ACP after the change and it still didn't change.

Lynne
21 Nov 2009, 18:39
You did what? I suggested a couple of things (remove the code, register the variable).

edit: It works just fine for me if I remove the line I suggested you remove.

Anseur
21 Nov 2009, 18:52
I think you edited your post. I did what you suggested before you edited your post. (remove the iframe)

I'm afraid I dont understand what "register the $show variable" means.

I know where the error logs are in cpanel, they are just called "error logs" (I know the log works because the live version of my site generates a few errors sometimes with one of the less used styles) and they dont generate an errors relating to this custom page.

Lynne
21 Nov 2009, 19:00
And I edited my post while you were writing your post again. It works just fine for me if I remove that line from the template. I get a page that just says "MCO DKP" (then new line) "The MCO DKP System".

Anseur
21 Nov 2009, 19:08
ok, can you confirm the iframe is what breaks it for you? (you doing this to your own test site or something?) ie, does it go white while logged out if you add the iframe?

thanks for your time.

Lynne
21 Nov 2009, 19:12
It goes white if I logout if I add the iframe, yes. That line is definitely the problem. I also get an error when logged in with that line (cannot find/25manwrathplus).

Anseur
21 Nov 2009, 19:50
Ok, Can't immagine why an iframe would do that.

Well thanks for your time anyway.

Parture
21 Nov 2009, 19:55
What's the CSS page for this page? Is it vbulletin.css

Lynne
21 Nov 2009, 20:39
Ok, Can't immagine why an iframe would do that.

Well thanks for your time anyway.
Did you add the template to the MASTER STYLE or just to one of your styles? And is that style the default style for unregistered users?

What's the CSS page for this page? Is it vbulletin.css
It's all the defaults that you get from the headinclude template. Yes, vbulletin.css is one of them.

Anseur
21 Nov 2009, 20:55
Did you add the template to the MASTER STYLE or just to one of your styles? And is that style the default style for unregistered users?


Of course! Your a genius! I could kiss you right now! (but I wont!)

a thousand thankyous!

EidolonAH
24 Nov 2009, 12:50
Can anyone please help me to understand why the html tags such as h2 ul and li are not working in my custom pages?

This is the TOS page:
http://www.eidolonmh.com/vbskinsxtreme/tos.php?styleid=3

This is how it's coded:
{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">vBSkinsXtreme Terms of Service</h2>
<div class="blockbody">
<div class="blockrow">
<h2>Terms of Service</h2>
<ul>
<li>vBSkinsXtreme is a private web club and visiting this website or being a member is a privilege, NOT a right.</li>
<li>vBSkinsXtreme has full liberty to choose its members. We reserve our rights to accept or reject any member signups, remove or banish any member from the site, grant and revoke any privileges to members within the site without warning, prior notice or giving any reason and in anytime we find appropriate.</li>
<li>vBSkinsXtreme can anytime stop or suspend its services without prior notice.</li>
<li>The information published in this website may be outdated or wrong in one way or another, so no information should be used without consulting it with a professional.</li>
<li>All content sent to vBSkinsXtreme by its members and visitors can be rejected, deleted, modified, edited by site administration.</li>
<li>Legal rights of the content sent to vBSkinsXtreme by its members or visitors belongs to Site administration when they are submitted to the site unless it is clearly mentioned otherwise in the submit page. Site visitors/members can not ask the submitted content to be removed or unpublished from the site later.</li>
<li>All site visitors who visit this website are obligated to obey site rules & site agreement and respect site principals and goals.</li>
</ul>

<h2>Limitation of Liability and Disclaimer</h2>

Site visitor agrees that the use of vBSkinsXtreme's services is entirely at visitor's own risk. vBSkinsXtreme's services are provided on an "as is" basis without warranties of any kind, either expressed or implied, constructive or statutory, including, without limitation, any implied warranties of merchantability, non-infringement or fitness for a particular purpose.

$vboptions[bbtitle] makes no guarantee of availability, continuity or quality of its service and reserves the right to change, withdraw, suspend, or discontinue any functionality or feature of vBSkinsXtreme's services. In no event will vBSkinsXtreme be liable for any damages, including, without limitation, direct, indirect, incidental, special, consequential, or punitive damages arising out of the use of or inability to use vBSkinsXtreme's services or any content thereon.

This disclaimer applies, without limitation, to any damages or injury, whether for breach of contract, tort, or otherwise, caused by any failure of performance; error; omission; interruption; deletion; defect; delay in operation or transmission; computer virus; file corruption; communication-line failure; network or system outage; or theft, destruction, unauthorized access to, alteration of, or use of any record.

<h2>Indemnity and Legal exemption</h2>

<strong>User agrees to indemnify and hold vBSkinsXtreme harmless from any loss, liability, claims, damages and expenses, including attorneys fees, arising from or related to the content, use, or deletion of User's Files, messages or use of any other feature or service in this site. This expressly includes:</strong>
<ul>
<li>User's responsibility for any and all liability arising from the violation or infringement of proprietary rights or copyrights.</li>
<li>Any defamatory or unlawful material contained within User's messages, private messages, emails, attachments, images and files.</li>
<li>Content submitted to the site by the user</li>
<li>Other content in the site</li>
<li>Communication with site administration</li>
</ul>

<h2>Legal Policy and Notice</h2>

vBSkinsXtreme's Terms of Service, site agreement, disclaimer, forum rules, site rules, indemnity clause, copyright notice and privacy policy are subject to change, but changes shall be announced. Such changes are reflected in the relevant pages of the site upon alteration and due when they are published in the site.

<h2>Copyright Notice:</h2>
All rights of this website is reserved. This includes the rights to its name, domain name, trademark, concept, format, content, style, skin, code, database and every other element in this website. No part of this website, its content, name, applications, documents, programs, texts, design elements, images, posts, look, feel, atmosphere or format can be copied, shared, moved, published or used without prior and explicit consent of its Author.<br />
Except where diligently implied, absolutely NO part of vBSkinsXtreme may be reproduced or recreated without explicit written permission by site owner of vBSkinsXtreme and certified with written verification.
</div>
</div>
{vb:raw footer}
</body>
</html>

Lynne
24 Nov 2009, 14:55
Can anyone please help me to understand why the html tags such as h2 ul and li are not working in my custom pages?


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.

Calash
25 Nov 2009, 14:34
Perfect, thank you so much for posting this.

I do have a general question. For my eFiction bridge mod I have been exporting the templates into variables that I can then use in the external template system. I figured out how to make this work by using the following code.



$templater = vB_Template::create('header');
$header = $templater->render();

$templater = vB_Template::create('footer');
$footer = $templater->render();

$templater = vB_Template::create('headinclude');
$headinclude = $templater->render();


$templater = vB_Template::create('navbar');
$navbar = $templater->render();


This ends up being a lot of repetitive code. Is there a better way to get the templates into the variables?

Lynne
25 Nov 2009, 14:44
You should not have to create/render any of those you posted there. When you go to render your own template, you would have this second line here to render those templates automatically for your page:
$templater = vB_Template::create('your_template');
$templater->register_page_templates();
$templater->register('your_variable', $your_variable);
print_output($templater->render());

Calash
25 Nov 2009, 15:03
The problem is that I need the individual templates in variables. eFiction uses it's own template system and, barring a major rewrite of that code, the best solution I have is to export the templates, then import them into it's system.

cellarius
25 Nov 2009, 15:23
... forget it, missed the answers on the next page :)

Adem GENĮ
28 Nov 2009, 16:12
What I can not run

In this thread the

created tes.php
created test template

did not change anything

Can not demonstrate this
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';
How do I show?

Regards

Lynne
28 Nov 2009, 16:22
Whoops. Find this line in test.php
$templater->register('pagetitle', 'Test Page');

And change to:
$templater->register('pagetitle', $pagetitle);

Adem GENĮ
28 Nov 2009, 17:13
This does not exist
$templater->register('pagetitle', 'Test Page');


I want to show here is a variable
Example:

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

$adem = 'Hello World';



HTML - template test

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



Text


{vb:raw adem}



</div>
</div>



Does not appear on the page

--------------- Added 1259433584 at 1259433584 ---------------

First message changed?

I have to add the following for $adem variable is?

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

Lynne
28 Nov 2009, 18:16
I have to add the following for $adem variable is?

$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('adem', $adem);
print_output($templater->render());
Yes, you must register any variable you plan to use in your template.

Adem GENĮ
28 Nov 2009, 19:13
Thank you very
Now okay

BBR-APBT
29 Nov 2009, 00:26
How to show Whats going on Box on this new page?

Lynne
29 Nov 2009, 03:06
How to show Whats going on Box on this new page?
I don't know, that article hasn't been updated. I would think the instructions are pretty much the same though.

willy888
03 Dec 2009, 14:36
Thanks I use this article its very helphull for me
Can we add a widjet with a collum in the new page ?

Dave-ahfb
10 Dec 2009, 14:57
Ok I have tried every which way from sunday to understand how to be able to use this with a certain group of my scripts with no luck. Keep in mind any responses may have to be "dumbed down" ;)

Here is an example of how these scripts are set up.

page is originally called as such
testpage.php?sub=gen_form

testpage.php would contain code
<?php
include_once('/path/to/test.class.php');
$gen_test = new test_gen;
?>

as well as

<?php

if($_GET['sub'] == 'gen_form')
{
$gen_test->gen_test_form();
}
if($_POST['sub'] == 'Generate Test')
{
$gen_test->gen_test();
}
if($_POST['sub'] == 'Preview Test')
{
$gen_test->preview_test();
}

?>

Of course all of the true scripting is located at /path/to/test.class.php

can anybody be of help? I am hoping with an example I can finish the rest of my scripts which are similar and maybe get a better understranding so that I may do my other scripts which are different.

muratmunich
15 Dec 2009, 10:46
And what if i have more than 10 Variables in a Template?
Do i have to register each variable ?


$templater->register('your_variable', $your_variable);
$templater->register('your_variable2', $your_variable2);
$templater->register('your_variable3', $your_variable3);
.
.
$templater->register('your_variable10', $your_variable10);


Does this way loose Performance (Many Class calls) ?
Or is there a Array ?

In my opinion the old way was more easier than this !

ragtek
15 Dec 2009, 11:03
You could put all youre variables into an array. Then you have only to register the arrayvariable.

Lynne
15 Dec 2009, 16:27
You could put all youre variables into an array. Then you have only to register the arrayvariable.
Yep, that is what I did to a few of my mods. I had $variable1 and $variable2 and $variable3, etc. and just through them all into an array - $myarray['variable1'] and $myarray['variable2'] and $myarray['variable3'], etc. Then I just registered $myarray.

muratmunich
15 Dec 2009, 20:32
Thanks...

Ok nice, but do you know the Advantage of this way to use Variables in a Template ?

ragtek
15 Dec 2009, 20:58
http://www.vbulletin.org/forum/showthread.php?t=228078

anthony parsons
16 Dec 2009, 23:35
I like it Lynne... between this and the nav plugin (http://www.vbulletin.org/forum/showthread.php?t=226914), my life is now made a lot easier than having to sit down and come up with it myself. Very much appreciated. Custom page with menu... excellent.

http://www.vbulletin.org/forum/attachment.php?attachmentid=107634&stc=1&d=1261010072

nubian
17 Dec 2009, 06:07
Is is mandatory that I have the text case of there vars to be all in caps in the test.php and in the name of the template?
$globaltemplates = array('TEST',);$templater = vB_Template::create('TEST');How do I get it so that I can retain the case of my test.php but change the case in the template from TEST to test?
I plan on making quite a few custom pages so would it be possible to place these php files in another directory?

Lynne
17 Dec 2009, 16:52
1. No, you don't need all caps. You just need to be consistent when you use it. If it's in all small letters in the $globaltemplates area, then use all small letters in the $templater.
2. Sure, but you'll have to make sure when you include the global.php page, or any other scripts, you'll have to make sure the path to them are correct.

turtile
19 Dec 2009, 17:22
I get the error:

Warning: require_once(./global.php) [function.require-once]: failed to open stream: No such file or directory in /home1/riptidep/public_html/unusualplants/index.php on line 27

Fatal error: require_once() [function.require]: Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/riptidep/public_html/unusualplants/index.php on line 27

I tried the other global method from the posts and I get a blank page. My template is under my default page.

Code:
<?php

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

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

define('THIS_SCRIPT', 'index.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('INDEX',
);

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

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


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

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

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Unusual Plants Home Page';

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

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

?>

Thanks

Lynne
19 Dec 2009, 17:58
And are you putting this file in the same directory as all your other vbulletin files? If not, you need to do a chdir to get the global.php file.

turtile
19 Dec 2009, 18:33
My index file is in unusualplants.net/
The forum is located at unusualplants.net/forums

I tried changing the directory at the beginning of the code (never changing back), right before the global line(never changing back), at the beginning and changing the directory back after the global line, and right before the global line and changed it back after. I get a blank page for each one.

I used this for changing the directory:
chdir('forums');

and this for moving back:
chdir('../');

Thanks

Lynne
19 Dec 2009, 18:51
When you added the template, did you add it to the style you are currently using to browse your forum?

turtile
19 Dec 2009, 18:53
When you added the template, did you add it to the style you are currently using to browse your forum?

Yes

Lynne
19 Dec 2009, 19:17
Yes
First, make sure the path is correct - it should be the full path to your vb forums directory.

Check your error_logs (if you don't know where they are, ask your host) to see if anything is in there.

turtile
19 Dec 2009, 19:45
First, make sure the path is correct - it should be the full path to your vb forums directory.

Check your error_logs (if you don't know where they are, ask your host) to see if anything is in there.

the forum.php file is located @ unusualplants.net/forums/

(I'm not sure which time this is set on)


For PHP:
/home1/riptidep/public_html/unusualplants/error_log:
[19-Dec-2009 17:45:25] PHP Warning: require_once(./global.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /home1/riptidep/public_html/unusualplants/index.php on line 27
[19-Dec-2009 17:45:25] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/riptidep/public_html/unusualplants/index.php on line 27

Thanks for all of your help

Lynne
19 Dec 2009, 19:49
It looks like you didn't do your chdir correctly. You need to do the FULL path:
chdir ('/path/to/your/forums');

ExTincTi0N
19 Dec 2009, 20:35
Okay Lynne I am in need of your assistance.

https://www.vbulletin.org/forum/external/2009/12/33.png

How do i get it so that the nav button "Game Nights" is selected?

Lynne
19 Dec 2009, 20:44
If you defined THIS_SCRIPT at the top of your page, you should use it in your condition for your tab. You should post for help regarding this in the thread where you got the tab code.

ExTincTi0N
19 Dec 2009, 20:56
Thanks for the help lynne, and next time I will say which one i used, btw it was yours lol.

turtile
19 Dec 2009, 20:58
It looks like you didn't do your chdir correctly. You need to do the FULL path:
chdir ('/path/to/your/forums');

I tried:
chdir('/home1/riptidep/public_html/unusualplants/forums');

...and still a blank page.

I don't get anything in the error log either.

Lynne
19 Dec 2009, 21:26
And is your template named INDEX (*exactly* - capital letters too).

turtile
19 Dec 2009, 21:34
And is your template named INDEX (*exactly* - capital letters too).

I had it as index. Works perfect - thanks a lot!

I.am
21 Dec 2009, 18:02
Have you tried to validate it? http://validator.w3.org/

skylab
22 Dec 2009, 17:32
Getting a blank page. What are some things I can troubleshoot? The path is correct and the theme is correct and ive created the template in the right place.

ragtek
22 Dec 2009, 17:46
Post your current files

Bouncer222
27 Dec 2009, 02:53
I'm just wondering, is there any way to make pages for vb4 like you're able to make pages for 3.8.4 using vbadvanced? It was a lot more simpler than editing templates and instead using the BB code editor I believe that was how?

Lynne
27 Dec 2009, 03:08
I'm just wondering, is there any way to make pages for vb4 like you're able to make pages for 3.8.4 using vbadvanced? It was a lot more simpler than editing templates and instead using the BB code editor I believe that was how?
If you want to use vbadvanced, you may do so once they release a version of vbadvanced that works with vB4 (they may have done so already, I have no idea - check on their site).

tomsch
27 Dec 2009, 16:08
...

Lynne
27 Dec 2009, 16:15
ok when i use the code in post one as-is i get a white page

is that what i should see??

i was expecting to see the vb header and footer etc..

this is the output of my test.php


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>

That isn't even from this mod if everything is in capital letters since the example template I gave is all in small letters (and the html tag should be different). Did you put the template in the current style you are using?

tomsch
27 Dec 2009, 16:36
your to fast Lynne i removed to last post cause i finally saw my error.

i used lowercase test in my template and that was the result.

ARadarDetector
29 Dec 2009, 07:09
I did it and got this on a blank white page:, my website is: Radar-Detector.Net and I set my path to /home/matt/public_html/speed.php

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/matt/public_html/speed.php on line 2

Parse error: syntax error, unexpected T_STRING in /home/matt/public_html/speed.php on line 2

cellarius
29 Dec 2009, 07:39
Try reuploading the file, and make sure there are no characters before <?php.

stejoh
29 Dec 2009, 13:12
I have used this GREAT instructions to create a custom page.

I am aiming for a 2 or 3 column page but have not been able to sort out how to increase padding around the table cells.

My code looks 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}</title>
{vb:raw headinclude}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

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

<h2 class="blockhead">About 99nicu</h2>
<div class="blockbody">
<div class="blockrow">

<table border="0" width="100%" cellpadding="25">
<tr>

<td width="33%" valign="top">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</td>

<td width="33%" valign="top">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</td>


<td width="33%" valign="top">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</td>

</tr>
</table>

</div>
</div>

{vb:raw footer}

</body>
</html>

Changing the "cellpadding"-value in <table> does not change cell padding.

Anyone here who have a clue which StyleVar to change?

Lynne
29 Dec 2009, 15:23
Changing the "cellpadding"-value in <table> does not change cell padding.

Anyone here who have a clue which StyleVar to change?
If we had a link to the page, it would be much easier to see what is going on.

ARadarDetector
29 Dec 2009, 15:58
Try reuploading the file, and make sure there are no characters before <?php.

there is no characters before it, my file is in the main root (i have vbulletin 4.0 with the new cms homepage) named "speed.php" and my template is called "TRAPS" my website url is: Radar-Detector.Net here is the file:

<?php

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

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

define('THIS_SCRIPT', '/home/matt/public_html/speed.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('TRAPS',
);

// 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 = 'SPEED TRAPS';

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

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

?>

Lynne
29 Dec 2009, 16:18
Try changing this line:
define('THIS_SCRIPT', '/home/matt/public_html/speed.php');

to this:
define('THIS_SCRIPT', 'speed');

Also, what editor are you using? Are you using a text editor and not something like Word?

ARadarDetector
29 Dec 2009, 17:06
changed that and still not working? I am using a text editor: wordpad

darsalles
29 Dec 2009, 19:20
I dont understand to much and im really interested on this :(

I created the test.php file with the first code, the file is on the forum root. Now on the part I have to create the TEST template with the code that shows there. How do I create that template D:???

ARadarDetector
29 Dec 2009, 19:29
Lynne thanks for the help!

For those that read my problem I was using "wordpad" instead of "notepad" and "wordpad" was adding a lot of random junk above the <php code....even though when I opened the file you couldnt see it....but was hiding it above it...fixed by saving to notepad then reuploading. Thanks Lynne!

Lynne
29 Dec 2009, 20:08
I dont understand to much and im really interested on this :(

I created the test.php file with the first code, the file is on the forum root. Now on the part I have to create the TEST template with the code that shows there. How do I create that template D:???
Style Manager > find your style > Add New Template

(I always add it to my MASTER STYLE.)

darsalles
29 Dec 2009, 23:39
Style Manager > find your style > Add New Template

(I always add it to my MASTER STYLE.)

Thanks now its working, i have another question xD... on the original thread u posted it shows how to add "Who is online" I want to add it on this one, but i coulnd't :(

Please modify the article and teach how to add that option :D

4ums
30 Dec 2009, 04:01
Hi lynne ive created a new tab for an arcade i want on my site i used ragteks mod create a new tab in the navbar http://www.vbulletin.org/forum/showthread.php?t=228313

So do i now have to use this mod for it to work i already have the flash game on my server.
but i also have to add some HTML..
<html>
<head>
<title>Pacman Advanced</title>
</head>
<body>
<center>
<h1>Pacman Advanced</h1>
<object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="600" height="400">
<param name="movie" value="pacmanadv.swf">
<param name="quality" value="high">
<embed src="pacmanadv.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="400">
</embed>
</object>
<br>
<a href="http://www.startgames.ws">Online flash game</a>
</center>
</body>
</html>

for the game to work and not sure where to put either been trying 13 hours now and the whte flag is nearly up so any kinda help apprieciated thanks..

Lynne
30 Dec 2009, 04:17
for the game to work and not sure where to put either been trying 13 hours now and the whte flag is nearly up so any kinda help apprieciated thanks..
If you need help with the modification, you need to ask in the modification thread. I have no idea what is needed for that modification to work.

4ums
30 Dec 2009, 04:45
If you need help with the modification, you need to ask in the modification thread. I have no idea what is needed for that modification to work.

Thanks lynne but even if we forget my games mod i was asking do i need your mod here to create a page to work for the new tab i have created with ragteks mod thanks.

stejoh
30 Dec 2009, 07:37
If we had a link to the page, it would be much easier to see what is going on.

Here's the page with the padding problem, i.e. which stylevar to change to add more padding around cells (since cellpadding="number" does not work.

http://99nicu.org/testforum/test.php

Lynne
30 Dec 2009, 15:04
Thanks lynne but even if we forget my games mod i was asking do i need your mod here to create a page to work for the new tab i have created with ragteks mod thanks.
No, you may create a tab for an existing page or any condition your want (I have mine highlighting on my test site for a couple of the forums).

Here's the page with the padding problem, i.e. which stylevar to change to add more padding around cells (since cellpadding="number" does not work.

http://99nicu.org/testforum/test.php
Try adding your padding inline:
<td width="33%" valign="top" style="padding: 25px;">

stejoh
30 Dec 2009, 15:11
Try adding your padding inline:
<td width="33%" valign="top" style="padding: 25px;">

Thanks for your help! Works!

darsalles
31 Dec 2009, 00:30
Could someone help me adding columns at both side of the content, but with the same style of the content bar??

rEd86
31 Dec 2009, 11:41
Thanks for a great tutorial. I have some custom pages I am creating and it only took a few minutes to do so by following this example code.

I didn't see this mentioned in the thread but there is one slight problem with the code as it exists. (or at least there was when I implemented it on my site)

In the php code, you load the page title in to variable pagetitle but in the template you have vboptions.bbtitle so the title for the page shows up as forums.

I changed the line in the template from:
<title>{vb:raw vboptions.bbtitle}</title>
to
<title>{vb:raw pagetitle}</title>

and it worked as expected.

Take care!

--Ed

garretbyrne
31 Dec 2009, 18:02
Thanks Lynne it was extremely helpful and easy.. was able to create loads of pages in a matter of minutes... Cheers

mandingo
31 Dec 2009, 23:29
How would I add my forum's sidebar,getting kinda stuck,brain turning to spaghetti.
a nudge in the right direction may be all I need.

SuperGLS
01 Jan 2010, 15:00
Couple questions about this one.

When I try to add any HTML code underneath the ###Your Custom Code Goes Here### section I get this error.

Parse error: syntax error, unexpected '<' in /home/elantrax/public_html/forums/cotm.php on line 41

When I just add regular text underneath the ###Your Custom Code Goes Here### section it only displays the word "text" no matter what I have typed in.

Here's the URL. Everything else seems to be working fine.

http://www.elantraxd.com/forums/cotm.php

simon157
01 Jan 2010, 15:49
Hi, could someone please, please help me as I'm struggling adding code containing php code to my template. It's driving me nuts !! The code I want to add is the following so it loads within the forum environment, but I'm completely stuck...

<?php require_once('Connections2/databasecon.php'); ?>
<?php
$maxRows_usersightings = 15;
$pageNum_usersightings = 0;
if (isset($_GET['pageNum_usersightings'])) {
$pageNum_usersightings = $_GET['pageNum_usersightings'];
}
$startRow_usersightings = $pageNum_usersightings * $maxRows_usersightings;

mysql_select_db($database_databasecon, $databasecon);
$query_usersightings = "SELECT * FROM sightings ORDER BY id DESC";
$query_limit_usersightings = sprintf("%s LIMIT %d, %d", $query_usersightings, $startRow_usersightings, $maxRows_usersightings);
$usersightings = mysql_query($query_limit_usersightings, $databasecon) or die(mysql_error());
$row_usersightings = mysql_fetch_assoc($usersightings);

if (isset($_GET['totalRows_usersightings'])) {
$totalRows_usersightings = $_GET['totalRows_usersightings'];
} else {
$all_usersightings = mysql_query($query_usersightings);
$totalRows_usersightings = mysql_num_rows($all_usersightings);
}
$totalPages_usersightings = ceil($totalRows_usersightings/$maxRows_usersightings)-1;
?>
<div id="container">
<div style="padding-left: 10px; padding-top:5px;">
<a href="index.php?pageid=sightingssubmit.php"><strong>Submit a sighting </strong></a> | <a href="index.php?pageid=Sightings.php"><strong>Show all sightings </strong></a>| <a href="index.php?pageid=Sightings.php&<?php printf("%spageNum_usersightings=%d%s", $currentPage, max(0, $pageNum_usersightings - 1), $queryString_usersightings); ?>">Previous</a> | <span class="style55"><a href="index.php?pageid=Sightings.php&<?php printf("%spageNum_usersightings=%d%s", $currentPage, min($totalPages_usersightings, $pageNum_usersightings + 1), $queryString_usersightings); ?>">Next</a>

<span class="style55"> </div>
<br />
<table width="95%" border="0" align="center" bgcolor="#FCFCFC">
<tr>
<td bgcolor="#848E7B"><div align="left" class="style1">No.</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Species</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Date</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Location</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Recorder</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Details</div></td>
</tr>
<?php do { ?>
<tr>
<td width="30" valign="top" bgcolor="#FFFff4"><div align="left" class="style131 "> <?php echo $row_usersightings['id']; ?></div></td>
<td width="150" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['species']; ?></div></td>
<td width="50" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['date']; ?></div></td>
<td width="120" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['location']; ?></div></td>
<td width="100" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['recorder']; ?></div></td>
<td width="350" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['Notes']; ?></div></td>
</tr>
<?php } while ($row_usersightings = mysql_fetch_assoc($usersightings)); ?>
</table>
</div>

Hope you can help :(

Simon

Lynne
01 Jan 2010, 16:02
How would I add my forum's sidebar,getting kinda stuck,brain turning to spaghetti.
a nudge in the right direction may be all I need.
I have no idea how to add sidebars. That is a template thing and you can probably find a tutorial or mod that will show you the code to add to your template to do that.

Couple questions about this one.

When I try to add any HTML code underneath the ###Your Custom Code Goes Here### section I get this error.

Parse error: syntax error, unexpected '<' in /home/elantrax/public_html/forums/cotm.php on line 41

When I just add regular text underneath the ###Your Custom Code Goes Here### section it only displays the word "text" no matter what I have typed in.

Here's the URL. Everything else seems to be working fine.

http://www.elantraxd.com/forums/cotm.php
You don't just add text in a php file. You need to assign it to a variable and then out put the variable in the template. Or, just put the text in the template.
Hi, could someone please, please help me as I'm struggling adding code containing php code to my template. It's driving me nuts !! The code I want to add is the following so it loads within the forum environment, but I'm completely stuck...

Hope you can help :(

Simon
You do not put php in templates. You put the php in the php page and then assign the output to a variable and put the variable in the template. Don't forget to register the variable for use in the template first.

simon157
01 Jan 2010, 16:07
Thanks Lynne, but could you possibly help me with the coding for the first one. Once I have an idea then I will be able to cover the rest of my pages. Sorry, if I'm asking to much, but I'm by no means a programmer and new to vbulletin. Thanks very much.

Simon

Lynne
01 Jan 2010, 16:16
You should post out in the main forums for help with converting your code for use in a page (that really isn't what this article is about and your stuff will get lost in here among other posts). You may also want to look at how vbulletin does it in their pages. You will probably want a second template for your while loop stuff also.

SuperGLS
01 Jan 2010, 16:52
I see. So can you give me an example of what type of "stuff" should go underneath the ###### YOUR CUSTOM CODE GOES HERE ##### part of the xxxxxx.php file that you've instructed us to make?

EDIT- I know this is newb question!

cellarius
02 Jan 2010, 08:39
I see. So can you give me an example of what type of "stuff" should go underneath the ###### YOUR CUSTOM CODE GOES HERE ##### part of the xxxxxx.php file that you've instructed us to make?

EDIT- I know this is newb question!
There already is an example in the code given. Assigning a value to the variable $pagetitle, then registering $pagetitle for use in the template.

SuperGLS
02 Jan 2010, 13:42
Ohhh, I think I understand now, so...

<?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', <<<<Change this to the template name (case sensitive)
);

// 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')); <<<<Change this to what you want to show in the navbar
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title'; <<<<<Make 'My Page Title' the name of the .php file that you want to display & do NOT add any other code (html/php/whatever) to this area.

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

?>

Make the template from the code in the first post, but don't change anything there, right?

Upload whatever .php file you want to call to the yoursite/forum/ folder.

So, does everything I've <<<<<'d next to and everything I've marked in red look ok? Thanks in advance!

simon157
02 Jan 2010, 15:09
You should post out in the main forums for help with converting your code for use in a page (that really isn't what this article is about and your stuff will get lost in here among other posts). You may also want to look at how vbulletin does it in their pages. You will probably want a second template for your while loop stuff also.

I've posted my issue out in the forums as suggested but still no response. I've come to a complete stand still until I can get this sorted. Any chance of some help.

Thanks

Simon

cellarius
02 Jan 2010, 15:20
Ohhh, I think I understand now, so...
Sorry to say: No, you don't...

Make the template from the code in the first post, but don't change anything there, right?

Upload whatever .php file you want to call to the yoursite/forum/ folder.
Both is wrong. Of course you can change the template, that's what templates are for, and the only php file is the one where you put the php-code from firstpost. Where it says to put your custom code, you need to put your custom code.

Have you tried to get it running as is, i.e. exactly like explained in the article before making any changes?

What exactly are you trying to do anyway? What php-code do you want to execute?

simon157
02 Jan 2010, 15:59
Sorry to say: No, you don't...


Both is wrong. Of course you can change the template, that's what templates are for, and the only php file is the one where you put the php-code from firstpost. Where it says to put your custom code, you need to put your custom code.

Have you tried to get it running as is, i.e. exactly like explained in the article before making any changes?

What exactly are you trying to do anyway? What php-code do you want to execute?

I have the same problem Cellarius. I'm trying to run the following code in a new template and I've completely stuck. Can you help at all?? I've tried everything, but I'm not a coder.

<?php require_once('Connections2/databasecon.php'); ?>
<?php
$maxRows_usersightings = 15;
$pageNum_usersightings = 0;
if (isset($_GET['pageNum_usersightings'])) {
$pageNum_usersightings = $_GET['pageNum_usersightings'];
}
$startRow_usersightings = $pageNum_usersightings * $maxRows_usersightings;

mysql_select_db($database_databasecon, $databasecon);
$query_usersightings = "SELECT * FROM sightings ORDER BY id DESC";
$query_limit_usersightings = sprintf("%s LIMIT %d, %d", $query_usersightings, $startRow_usersightings, $maxRows_usersightings);
$usersightings = mysql_query($query_limit_usersightings, $databasecon) or die(mysql_error());
$row_usersightings = mysql_fetch_assoc($usersightings);

if (isset($_GET['totalRows_usersightings'])) {
$totalRows_usersightings = $_GET['totalRows_usersightings'];
} else {
$all_usersightings = mysql_query($query_usersightings);
$totalRows_usersightings = mysql_num_rows($all_usersightings);
}
$totalPages_usersightings = ceil($totalRows_usersightings/$maxRows_usersightings)-1;
?>
<div id="container">
<div style="padding-left: 10px; padding-top:5px;">
<a href="index.php?pageid=sightingssubmit.php"><strong>Submit a sighting </strong></a> | <a href="index.php?pageid=Sightings.php"><strong>Show all sightings </strong></a>| <a href="index.php?pageid=Sightings.php&<?php printf("%spageNum_usersightings=%d%s", $currentPage, max(0, $pageNum_usersightings - 1), $queryString_usersightings); ?>">Previous</a> | <span class="style55"><a href="index.php?pageid=Sightings.php&<?php printf("%spageNum_usersightings=%d%s", $currentPage, min($totalPages_usersightings, $pageNum_usersightings + 1), $queryString_usersightings); ?>">Next</a>

<span class="style55"> </div>
<br />
<table width="95%" border="0" align="center" bgcolor="#FCFCFC">
<tr>
<td bgcolor="#848E7B"><div align="left" class="style1">No.</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Species</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Date</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Location</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Recorder</div></td>
<td bgcolor="#848E7B"><div align="left" class="style1">Details</div></td>
</tr>
<?php do { ?>
<tr>
<td width="30" valign="top" bgcolor="#FFFff4"><div align="left" class="style131 "> <?php echo $row_usersightings['id']; ?></div></td>
<td width="150" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['species']; ?></div></td>
<td width="50" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['date']; ?></div></td>
<td width="120" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['location']; ?></div></td>
<td width="100" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['recorder']; ?></div></td>
<td width="350" valign="top" bgcolor="#FFFff4"><div align="left" class="style131"><?php echo $row_usersightings['Notes']; ?></div></td>
</tr>
<?php } while ($row_usersightings = mysql_fetch_assoc($usersightings)); ?>
</table>
</div>

Thanks Simon

SuperGLS
03 Jan 2010, 02:04
Sorry to say: No, you don't...

Haha, ok, don't feel bad, can't hurt my feelings!

Both is wrong. Of course you can change the template, that's what templates are for, and the only php file is the one where you put the php-code from firstpost. Where it says to put your custom code, you need to put your custom code.

Have you tried to get it running as is, i.e. exactly like explained in the article before making any changes?

What exactly are you trying to do anyway? What php-code do you want to execute?

I know you can change the template, but I don't need to change anything in it, right?

From what you are saying here I understand now I'm supposed to have just one template and one php file (the one included above that will include all of my custom code).

Right now I have it running exactly how it is. See here.

http://www.elantraxd.com/forums/cotm.php

The template works great and it seems ok, but whenever I try to add anything to the ###add your custom code### section of that PHP file I throw errors.

Maybe this isn't the right thing for me. I don't need to add php stuff I guess, just HTML code, but I figured that would still be possible. Guess not? If not that's ok too, I can jump on another solution. Basically I want it to look like this:

http://www.elantraxd.com/forums/misc.php?do=page&template=cotm

I just found this HOW TO guide from Lynne after I used a different HOW TO guide to make that above. The reason I wanted to use this one from Lynne is because the URL would be a lot better.

So, am I out of luck or what? Thanks a great deal for any help!

cory_booth
03 Jan 2010, 04:07
I saw earlier instructions to take care of the WOL (Who's Online Location) display. It required editing a few standard VB files.
Seeing examples from plugins I thought I'd remention it here:

Create a plugin called XXXX WOL Process
Place it on the hook called: online_location_process
Insert the following code (edited to your needs)

if ($filename == 'xxx.php')
$userinfo['activity'] = 'xxx';

Then create another plugin called XXX WOL Display
Place it on the hook called: online_location_unkown
Insert the following code (edited to your needs)

if ($userinfo['activity'] == 'xxx')
{
$userinfo['where'] = "<a href='./xxx.php'>The link displayed</a>";
$userinfo['action'] = "What is displayed";
$handled = true;
}

Ofcourse in this plugin code, you can copy and paste over and over to cover the extra pages you have created.

All this does is:
1st, sets the "user activity" value based on the actual php file name.
2nd, when the WOL location is "unknown" then the script checks your custom php settings and if found - sets the user location display value and a link to the actual page.

Lynne
03 Jan 2010, 04:36
Right now I have it running exactly how it is. See here.

http://www.elantraxd.com/forums/cotm.php

The template works great and it seems ok, but whenever I try to add anything to the ###add your custom code### section of that PHP file I throw errors.

Maybe this isn't the right thing for me. I don't need to add php stuff I guess, just HTML code, but I figured that would still be possible. Guess not? If not that's ok too, I can jump on another solution. Basically I want it to look like this:

http://www.elantraxd.com/forums/misc.php?do=page&template=cotm
If you don't want any code, then that's fine. You could just add all html to the template and create a page with the url cotm.php. That's just fine.

cellarius
03 Jan 2010, 06:49
I know you can change the template, but I don't need to change anything in it, right?
That depends on what you want to achieve :)

From what you are saying here I understand now I'm supposed to have just one template and one php file (the one included above that will include all of my custom code).
That also depends. If the site you linked below is static (=plain html), you don't need any php code and all html code goes into the template.

The template works great and it seems ok, but whenever I try to add anything to the ###add your custom code### section of that PHP file I throw errors.
It would be helpful for us to help if you simply would show us what you try to add.

Maybe this isn't the right thing for me. I don't need to add php stuff I guess, just HTML code, but I figured that would still be possible. Guess not? If not that's ok too, I can jump on another solution.
As I said: php code goes into the php file, html code into the template. If you just dump html into the php file (as I suspect you did), you'll get errors.

I just found this HOW TO guide from Lynne after I used a different HOW TO guide to make that above. The reason I wanted to use this one from Lynne is because the URL would be a lot better.
You can easily do everything you can do with that other method what using this one, including what you want.

So, am I out of luck or what? Thanks a great deal for any help!
Just show us the code you try to use, so we have something to talk about.

SuperGLS
03 Jan 2010, 13:00
Ahhhhhhh! The HTML goes in the template (which is obvious now considering that's how I did it in the other HOW TO guide). Thanks to you both!

Now www.elantraxd.com/forums/cotm.php is working great! I just have to redo the HTML so it doesn't look so bad. Actually, one further question, if I want to set up this page using <div> codes and such instead of the outdated <table> codes where would I need to put any of the CSS info associated with that stuff?

Thanks again!!!

Lynne
03 Jan 2010, 15:27
CSS goes in the <head> If you are using CSS that is already defined (like the same CSS used on the index.php page) but not included in the headinclude template (like forumbits.css), then you can just include that same CSS template into your page:
<link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}css.php?sheet=forumbits.css" />

Allan
03 Jan 2010, 15:34
How add others pages 'within' current vBulletin files ?

as in this example: http://www.vbulletin.org/forum/showthread.php?t=62164

SuperGLS
03 Jan 2010, 15:51
Thanks Lynne. I have much learning to do about CSS before I start down that path, thanks though.

Allan
03 Jan 2010, 21:01
How add others pages 'within' current vBulletin files ?

as in this example: http://www.vbulletin.org/forum/showthread.php?t=62164
Little dump ^^

SuperGLS
04 Jan 2010, 02:33
I saw earlier instructions to take care of the WOL (Who's Online Location) display. It required editing a few standard VB files.
Seeing examples from plugins I thought I'd remention it here:

Create a plugin called XXXX WOL Process
Place it on the hook called: online_location_process
Insert the following code (edited to your needs)

if ($filename == 'xxx.php') <<<<<I changed this to 'extras.php'
$userinfo['activity'] = 'xxx'; <<<<<I changed this to 'extras'

Then create another plugin called XXX WOL Display
Place it on the hook called: online_location_unkown
Insert the following code (edited to your needs)

if ($userinfo['activity'] == 'xxx') <<<<I changed this to 'extras'
{
$userinfo['where'] = "<a href='./xxx.php'>The link displayed</a>"; <<<<<I changed this to <a href='./extras.php'>Extras</a>
$userinfo['action'] = "What is displayed";
$handled = true;
}

Ofcourse in this plugin code, you can copy and paste over and over to cover the extra pages you have created.

All this does is:
1st, sets the "user activity" value based on the actual php file name.
2nd, when the WOL location is "unknown" then the script checks your custom php settings and if found - sets the user location display value and a link to the actual page.

Cory, can you give any examples of what we should replace here? I've replaced what I think should be replaced but I still get the Unknown Location message. Take a look.

https://www.vbulletin.org/forum/external/2010/01/67.png

Thanks in advance.

Lynne
04 Jan 2010, 03:28
I do my WOL a little different and just added the code to the first post.

Verionia
04 Jan 2010, 05:31
I've set this up on my test site, and it works OK while i'm logged in, but when I'm not logged in, and I visit this custom page, I just get a plain white screen.

looking at a source of this plain white pages shows me:

<!-- BEGIN TEMPLATE: dkp_template -->

<!-- END TEMPLATE: dkp_template -->


Here is the code currently used in the template for this custom .php 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}</title>
{vb:raw headinclude}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
<li class="popupmenu">
<h2 class="blockhead">The MCO DKP System</h2>
<h2 class="blocksubhead"> <vb:if condition="$show['modcplink']">
<a href="javascript://" class="popupctrl">Administration</a>
<ul class="popupbody popuphover">
<li><a href="/25manwrathplus/admin/" target=”dkp_frame”>Admin Index</a></li>
<li><a href="sublink2.php">SubLink 2</a></li>
<li><a href="sublink3.php">SubLink 3</a></li>
</ul>
</li>
</vb:if> </h2>

<div class="blockbody">
<div {height:auto;}>

<iframe name="dkp_frame" width=100% height=1700px SCROLLING=no FRAMEBORDER=0 src="/25manwrathplus">dkp_frame</iframe>

</div>
</div>

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


How can I get the page to auto size the website in the frames so that I don't have to use scrolling or parts of the website is cut off?

SuperGLS
05 Jan 2010, 00:03
I do my WOL a little different and just added the code to the first post.

That worked great (and thanks for color coding it for us, that's perfect). Thanks yet again Lynne.

RDX1
05 Jan 2010, 05:16
Great article, only issue is notices are showing up with no way to dismiss them, also the login box shows and won't go away even when logged in. Any idea how to remove this?

Lynne
05 Jan 2010, 15:46
Great article, only issue is notices are showing up with no way to dismiss them, also the login box shows and won't go away even when logged in. Any idea how to remove this?
Since those are both issues in the navbar and header which aren't touched in this article, I think it's an issue with the way you have your site set up.

pisymbol
11 Jan 2010, 02:40
Lynne, anyone, I have copied pasted the exact tutorial and I see nothing. First off, where should I see the results?

I have test.php in my $ROOTIDR (permissions are 755), I have TEST registered in my MASTER style with the exact code above. I understand fundamentally waht I'm doing here but I see no results.

How to I test this? I see no error in my error_logs.


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

?>


I created two plugins associated with the right hooks. The code is identical to what is shown on the first page.

The template is registered, if I customize/edit it:


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


I am using latest 4.0 Gold PL1, php 5.3.0, apache 2.2.x (its installed on my local MBP (Snow Leopard)).

tafreeh
11 Jan 2010, 20:45
great article.. i was able to create the page... but my content doesnt support basic html tags .... why is that?????

mokujin
11 Jan 2010, 21:17
Does anyone how to disable all notices in custom page? Thank you

pisymbol
12 Jan 2010, 02:05
Alright, my code looks good but I have two questions:

1) To get to my test page I do:

http://localhost/test.php

I see my test page.

2) If I then go to WOL link, I see My Page underneath it. So that works though I guess I didn't understand the point of the test page.

However, I noticed that the link under WOL is:

http://localhost/test.php?

With no vbulletin session state passed to it. Is that right?

Lynne
12 Jan 2010, 15:51
There will not be a session state if you are logged in.

meissenation
12 Jan 2010, 18:46
Anyone know why <strong></strong> and <ul></ul><li></li> tags do not work in the custom page? I've never seen HTML just be ignored like that. I can view it in the source code for the page so I know it's not my cache just not refreshing but yet it's not doing what the HTML tags say to do.

http://www.mifbody.com/vbulletin/advertise.php

If you view the source and then compare where it says "SOLD" in red - it should be strong. All the headings should be strong for that matter.


Edit:
Weird - <b></b> works perfectly fine, though...

Lynne
12 Jan 2010, 19:05
Anyone know why <strong></strong> and <ul></ul><li></li> tags do not work in the custom page? I've never seen HTML just be ignored like that. I can view it in the source code for the page so I know it's not my cache just not refreshing but yet it's not doing what the HTML tags say to do.

http://www.mifbody.com/vbulletin/advertise.php

If you view the source and then compare where it says "SOLD" in red - it should be strong. All the headings should be strong for that matter.


Edit:
Weird - <b></b> works perfectly fine, though...
View your css using something like firebug and you'll see that vb has added css that deals with those tags. If you don't like it, then modify it. You can add css to your own page to override the other.

glen290
12 Jan 2010, 19:08
Been trying to get this to work all day with no luck, just get a blank page every time, copied it exactly but no joy :mad:

meissenation
12 Jan 2010, 19:13
Been trying to get this to work all day with no luck, just get a blank page every time, copied it exactly but no joy :mad:

I was getting a blank page too. This line has to be the EXACT name and case (upper case vs lower case) as your template name:
$templater = vB_Template::create('test');

For example - if your template is named TEST, you'll get a blank page.

psypher
12 Jan 2010, 19:14
Awesome job, works great for me.

glen290
12 Jan 2010, 19:21
I was getting a blank page too. This line has to be the EXACT name and case (upper case vs lower case) as your template name:
$templater = vB_Template::create('test');

For example - if your template is named TEST, you'll get a blank page.


Checked that a few times and still the same, must be doing something wrong creating the template.

I went in to style manager / add new template and named it test then pasted in the info from the first page (2nd box) is this correct ?

meissenation
12 Jan 2010, 19:30
View your css using something like firebug and you'll see that vb has added css that deals with those tags. If you don't like it, then modify it. You can add css to your own page to override the other.

Thanks for the info, Lynne. Lots of learning to do. I absolutely hate this CSS stuff... wish I could just disable it and go back to the old system where everything just worked and looked correct. Change the CSS in one thing and now you've completely ruined the look of something totally unrelated. What happened to the good old days when you could just put <strong> if you want it to be strong and use UL?! LOL Crazy. Way too overcomplicated.

Anyway - thanks for the info, Lynne. Guess I'll have to create my own CSS (yuck) just to be able to use strong and ordered lists...

PS - frustration directed at VB development team, not you Lynne.

Lynne
12 Jan 2010, 21:05
Checked that a few times and still the same, must be doing something wrong creating the template.

I went in to style manager / add new template and named it test then pasted in the info from the first page (2nd box) is this correct ?
Make sure you added the template to the style you are using on your site.

Thanks for the info, Lynne. Lots of learning to do. I absolutely hate this CSS stuff... wish I could just disable it and go back to the old system where everything just worked and looked correct. Change the CSS in one thing and now you've completely ruined the look of something totally unrelated. What happened to the good old days when you could just put <strong> if you want it to be strong and use UL?! LOL Crazy. Way too overcomplicated.

Anyway - thanks for the info, Lynne. Guess I'll have to create my own CSS (yuck) just to be able to use strong and ordered lists...

PS - frustration directed at VB development team, not you Lynne.
I just looked at your site. You aren't using your tags correctly. You need to go:
<ul>
<li>stuff</li>
<li>more stuff</li>
</ul>
You have <ul> tags all over in your list.

As for the css for strong, just add this in your custom css for the page:
<style type="text/css">
strong {font-weight:bold;}
ul.unordered li {list-style-type: disc;list-style-position:inside;}
</style>
And then for your list:
<ul class="unordered">
<li>stuff</li>
<li>more stuff</li>
</ul>

glen290
13 Jan 2010, 11:35
Make sure you added the template to the style you are using on your site.




Only using the default style on my test board, still no joy..:( :(

meissenation
13 Jan 2010, 12:54
Make sure you added the template to the style you are using on your site.


I just looked at your site. You aren't using your tags correctly. You need to go:
<ul>
<li>stuff</li>
<li>more stuff</li>
</ul>
You have <ul> tags all over in your list.

As for the css for strong, just add this in your custom css for the page:
<style type="text/css">
strong {font-weight:bold;}
ul.unordered li {list-style-type: disc;list-style-position:inside;}
</style>
And then for your list:
<ul class="unordered">
<li>stuff</li>
<li>more stuff</li>
</ul>

Lynne -

Thanks for your help, I sincerely appreciate it. The UL tags are being used correctly, though. I extracted just the content of the block and pasted it here:
Advertising with the Michigan FBody Association is a sure fire way to get more customers to your local shop! What better way to get local customers interested in your products than to advertise them on a website that thousands of Michigan residents would see? Let's take a look at the features that each Sponsor gets!<br>
<br>

<b>Premier Package - $200 per Year</strong> - Ultimate Exposure! </b><b><font color="red">SOLD!</font></b>
<UL>
<LI>Premier Package = Ultimate in Company Exposure!</LI>
<UL>
<LI>This package is only available to ONE company at a time! With this package, you not only do you get everything that is offered in the "Gold" package, but your company will have sponsored <strong>FOUR</strong> trophies for the annual Spring Meet & Greet! That's right, each <b>1st Place</b> Generation-Specific trophy (1st Place - 1st Generation, 1st Place - 2nd Generation, etc) will be sponsored by your company with this package! Instant recognition for being a sponsor that helps make our Meet & Greet possible, your company's name will be mentioned throughout the course of the Meet & Greet and at the Awards ceremony!</LI>
</UL>
<LI>Banner on EVERY MiFbody.com Page</LI>
<UL>
<LI>Your banner will be displayed in the top right corner of every single page on MiFbody.com. Your banner will also rotate in the Horizontal Banner section as well as the Right Sponsor Bar section. That's right - your banner is guaranteed to be displayed once on every single page, and the potential for up to three different locations on the page! <b>Now that's some exclusive exposure!</b></LI>
</UL>
<LI>SubForum under the Sponsor Section</LI>
<UL>
<LI>The sub forum allows sponsors to post specific company information, deals, specials, new products, etc that you want to advertise.</LI>
</UL>
<LI>Right Sponsor Bar Banner</LI>
<UL>
<LI>A 100 pixel wide banner is displayed on the main vBulletin templates such as the Forum Home, Forum Display, and Show Thread templates. </LI>
</UL>
<LI>Horizontal Banner Section</LI>
<UL>
<LI>To ensure even more exposure, we've implemented a random rotating banner section that displays above the main content area. That way your company's banner will get maximum exposure on many pages that the average user navigates through. </LI>
</UL>
<LI>Banner Statistics (Upon request)</LI>
<UL>
<LI>Banner Impressions (times the banner is shown on the page) and Banner Clicks are logged by default. Upon request, we can pull up your impressions and clicks to let you know how well your banner is doing.</LI>
</UL>
<LI>Company Flier / Brochure</LI>
<UL>
<LI>At our annual Spring Meet & Greet, we will hand out a Sponsor-provided flier upon registration and check-in. This will get your product information into the hands of over 200 people! </LI>
</UL>
</UL>
<br>

<b>Platinum Package - $150 per Year</b> - Better Exposure!
<UL>
<LI>Two Sponsored Spring Meet & Greet Trophies!</LI>
<UL>
<LI>With the Gold "Plus" Package, your company will be sponsoring two Non-Generation specific trophies for our Annual Spring Meet & Greet! This will give you even more exposure than the Gold and Silver package! When we are holding the awards ceremony, your company's name will be mentioned as being the sponsor of the trophy! This is a great way to get recognition for your company.</LI>
</UL>
<LI>SubForum under the Sponsor Section</LI>
<UL>
<LI>The sub forum allows sponsors to post specific company information, deals, specials, new products, etc that you want to advertise.</LI>
</UL>
<LI>Right Sponsor Bar Banner</LI>
<UL>
<LI>A 100 pixel wide banner is displayed on the main vBulletin templates such as the Forum Home, Forum Display, and Show Thread templates. </LI>
</UL>
<LI>Horizontal Banner Section</LI>
<UL>
<LI>To ensure even more exposure, we've implemented a random rotating banner section that displays above the main content area. That way your company's banner will get maximum exposure on many pages that the average user navigates through. </LI>
</UL>
<LI>Banner Statistics (Upon request)</LI>
<UL>
<LI>Banner Impressions (times the banner is shown on the page) and Banner Clicks are logged by default. Upon request, we can pull up your impressions and clicks to let you know how well your banner is doing.</LI>
</UL>
<LI>Company Flier / Brochure</LI>
<UL>
<LI>At our annual Spring Meet & Greet, we will hand out a Sponsor-provided flier upon registration and check-in. This will get your product information into the hands of over 200 people! </LI>
</UL>
</UL>
<br>

<b>Gold Package - $100 per Year</b> - Good Exposure!
<UL>
<LI>SubForum under the Sponsor Section</LI>
<UL>
<LI>The sub forum allows sponsors to post specific company information, deals, specials, new products, etc that you want to advertise.</LI>
</UL>
<LI>Right Sponsor Bar Banner</LI>
<UL>
<LI>A 100 pixel wide banner is displayed on the main vBulletin templates such as the Forum Home, Forum Display, and Show Thread templates. </LI>
</UL>
<LI>Horizontal Banner Section</LI>
<UL>
<LI>To ensure even more exposure, we've implemented a random rotating banner section that displays above the main content area. That way your company's banner will get maximum exposure on many pages that the average user navigates through. </LI>
</UL>
<LI>Banner Statistics (Upon request)</LI>
<UL>
<LI>Banner Impressions (times the banner is shown on the page) and Banner Clicks are logged by default. Upon request, we can pull up your impressions and clicks to let you know how well your banner is doing.</LI>
</UL>
<LI>Company Flier / Brochure</LI>
<UL>
<LI>At our annual Spring Meet & Greet, we will hand out a Sponsor-provided flier upon registration and check-in. This will get your product information into the hands of over 200 people! </LI>
</UL>
</UL>
<br>

<b>Silver Package - $50 per Year</b>
<UL>
<LI>Right Sponsor Bar Banner</LI>
<UL>
<LI>A 100 pixel wide banner is displayed on the main vBulletin templates such as the Forum Home, Forum Display, and Show Thread templates. </LI>
</UL>
<LI>Banner Statistics (Upon request)</LI>
<UL>
<LI>Banner Impressions (times the banner is shown on the page) and Banner Clicks are logged by default. Upon request, we can pull up your impressions and clicks to let you know how well your banner is doing.</LI>
</UL>
<LI>Company Flier / Brochure</LI>
<UL>
<LI>At our annual Spring Meet & Greet, we will hand out a Sponsor-provided flier upon registration and check-in. This will get your product information into the hands of over 200 people! </LI>
</UL>
</UL>
<br>

<b>Spring Meet & Greet Trophy Sponsorship - $30 / trophy</b><br>
Each year, we hold a Spring Meet & Greet car show. We have a number of trophies that are awarded to show winners and for a small price you can get recognition at our show too! For only $30 per trophy, you can sponsor one of the trophies at our Meet & Greet - when we get to awarding the trophy, your company's name will be announced to everyone at the show! Likewise, we will have a small flier that will be given out at registration/check-in that will thank all of the trophy sponsors and will give their company information - website, address, contact information. The people at our show know where to go to thank you by buying your products! <strong>Please note: the trophy sponsorship will be applied at the next possible car show. If you sponsor the trophy before this year's show, it will be applied to this year's show. Obviously, if you sponsor a trophy after our car show has already happened for the year, it will be applied to next year's show.</strong>

<br><br>
Want to know more information about advertising with the Michigan Fbody Association? Send an email to our advertising e-mail address and we will be in contact with you as soon as possible to discuss the packages in more detail.<br><br><center><a href="mailto:advertising@mifbody.com">Advertising Email Address</center>
</font>

If you copy and paste that into notepad and save it as an HTML it will work correctly - the UL tags that are all over the place are creating nested lists.

Lynne
13 Jan 2010, 15:24
Try this for your css:
<style type="text/css">
strong {font-weight:bold;}
ul.unordered li {list-style-type: disc;list-style-position:inside; display: list-item; margin-left: 2.5em; padding-left: 0;}

ul.unordered ul li {list-style-type: circle; display: list-item;margin-left: 2.5em; padding-left: 0;}
</style>
And you aren't nesting them correctly. The <li></li> needs to be around the nested list, ie:
<LI>SubForum under the Sponsor Section
<UL>
<LI>The sub forum allows sponsors to post specific company information, deals, specials, new products, etc that you want to advertise.</LI>
</UL>
</LI>

glen290
13 Jan 2010, 16:36
throwing in the towel, cant get no joy with this lol

TheSupportForum
13 Jan 2010, 18:15
i need help in doing the following but not sure how to

found a mod for 3.8 and need to update this error, i need to update this in either a plugin or template and need help

fetch_template() calls should be replaced by the vB_Template class

Lynne
13 Jan 2010, 18:39
Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide (http://www.vbulletin.org/forum/showthread.php?t=228078)

TheSupportForum
13 Jan 2010, 18:53
Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide (http://www.vbulletin.org/forum/showthread.php?t=228078)

thx but this is for a php file and not a template i need to replace

eval('$tblreports_list .= "'.fetch_template in a template

Lynne
13 Jan 2010, 19:31
thx but this is for a php file and not a template i need to replace

eval('$tblreports_list .= "'.fetch_template in a template
He explains what php code to use to render templates. You no longer use:
eval('$mytemplate = "' . fetch_template('mytemplate') . '";');

You now use something similar to:
$templater = vB_Template::create('mytemplate');
$templater->register('my_var', $my_var);
$templater->register('my_array', $my_array);
$templater->render();

It's all explained in that article.

pisymbol
13 Jan 2010, 20:27
There will not be a session state if you are logged in.

Got it. Thanks. I think the article should put somewhere that you should go to:

http://<site url>/test.php

to verify. I was focused on the WOL hooks and got very confused about EXPECTED output (it was so obvious I didn't realize it).

Thanks!

tafreeh
14 Jan 2010, 00:24
since too many common html codes are not working...
i would like to know

which code should i use to break the line( change the link)
<p> </br> doesnt work

how do i break the line?

plus what code should i use for a list?

ul and li dont seem to work at all..

Please Advice.

Lynne
14 Jan 2010, 00:54
since too many common html codes are not working...
i would like to know

which code should i use to break the line( change the link)
<p> </br> doesnt work

how do i break the line?

plus what code should i use for a list?

ul and li dont seem to work at all..

Please Advice.
It's all just the way the css is set up by vBs in the css stylesheets. You can change it to be however you want by adding your own css, like I posted above for the lists.

Breaks work just fine. Your html is wrong... it's <br />.

PukkaBen
14 Jan 2010, 12:18
Worked great for me!! Cheers Lynne!! This How To is just awesome!!

Lynne
14 Jan 2010, 17:33
How add others pages 'within' current vBulletin files ?

as in this example: http://www.vbulletin.org/forum/showthread.php?t=62164
Sorry, I missed this. You would just do something like this...
<?php

.......

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

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

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

// ###### When do == 'xxx' #####
if ($_REQUEST['do'] == 'xxx')
{
$pagetitle = 'My Page Title';

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

// ###### When do == 'yyy' #####
if ($_REQUEST['do'] == 'yyy')
{
$pagetitle = 'My Page Title';

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

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

$pagetitle = 'My Page Title';

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


?>There are all sorts of different ways to do it, but that is one simple way.

Allan
14 Jan 2010, 22:15
Sorry, I missed this. You would just do something like this...
<?php

.......

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

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

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

// ###### When do == 'xxx' #####
if ($_REQUEST['do'] == 'xxx')
{
$pagetitle = 'My Page Title';

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

// ###### When do == 'yyy' #####
if ($_REQUEST['do'] == 'yyy')
{
$pagetitle = 'My Page Title';

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

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

$pagetitle = 'My Page Title';

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


?>There are all sorts of different ways to do it, but that is one simple way.
Thank you for your help :)

Switch3130
15 Jan 2010, 01:21
Great work.

PukkaBen
15 Jan 2010, 11:53
Hey everyone!! I have had some great joy with this article, and it has helped me out a lot, but now I am wanting to do a bit more with it. I have now got so many custom pages that I was wondering if I could put them all together to pull up different templates.

For example...
radio.php would be the only PHP file I need to build.
Then I have a link to radio.php?id=status, that will pull up the status template.
radio.php?id=schedule, that will pull up the schedule template
And so on.

This would then cut down the amount of pages I have on my web server, but keep what I have done already!!

I tried using the example above to no avil... not sure how that is supposed to work but it didn't!! I wonder if you could you the "if, elsif, else" solution on it though?


<?php

.......

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

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

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

// ###### When do == 'xxx' #####
if ($_REQUEST['do'] == 'xxx')
{
$pagetitle = 'My Page Title';

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

// ###### When do == 'yyy' #####
elseif ($_REQUEST['do'] == 'yyy')
{
$pagetitle = 'My Page Title';

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

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

$pagetitle = 'My Page Title';

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


?>


Any help would be greatly appreciated, so thanks in advance!!

Lynne
15 Jan 2010, 15:20
If you are using id as the passed variable, then you need to use $_REQUEST['id'] in the code, not $_REQUEST['do']

PukkaBen
15 Jan 2010, 15:42
Okay, here is what I am using...


<?php

// pre-cache templates used by all actions
$globaltemplates = array('about',
'news',
'notfound',
'schedule',
'status',
);

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

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

// ###### When do == 'xxx' #####
if ($_REQUEST['id'] == 'about')
{
$pagetitle = 'About Pukka Radio';

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

// ###### When do == 'yyy' #####
elseif ($_REQUEST['id'] == 'news')
{
$pagetitle = 'Pukka Radio News';

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

// ###### When do == 'yyy' #####
elseif ($_REQUEST['id'] == 'schedule')
{
$pagetitle = 'Radio Schedule';

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

// ###### When do == 'yyy' #####
elseif ($_REQUEST['id'] == 'status')
{
$pagetitle = 'Radio Status';

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

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

$pagetitle = 'You Are Lost!!';

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


?>



When I load up radio.php I get the error...

Fatal error: Call to undefined function construct_navbits() in /home/pukkarad/public_html/forum/radio.php on line 15

Lynne
15 Jan 2010, 15:53
Okay, here is what I am using...


<?php

// pre-cache templates used by all actions
$globaltemplates = array('about',
'news',
'notfound',
'schedule',
'status',
);

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

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

// ###### When do == 'xxx' #####
if ($_REQUEST['id'] == 'about')
{
$pagetitle = 'About Pukka Radio';

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

// ###### When do == 'yyy' #####
elseif ($_REQUEST['id'] == 'news')
{
$pagetitle = 'Pukka Radio News';

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

// ###### When do == 'yyy' #####
elseif ($_REQUEST['id'] == 'schedule')
{
$pagetitle = 'Radio Schedule';

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

// ###### When do == 'yyy' #####
elseif ($_REQUEST['id'] == 'status')
{
$pagetitle = 'Radio Status';

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

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

$pagetitle = 'You Are Lost!!';

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


?>

When I load up radio.php I get the error...

Fatal error: Call to undefined function construct_navbits() in /home/pukkarad/public_html/forum/radio.php on line 15
Please take a look again at the first post and see all the stuff above the START MAIN SCRIPT part of the page that is *required* for the page to work.

PukkaBen
15 Jan 2010, 15:57
Sorted!! Was just missing one thing. But now, how do I make sure that the tab shows selected for that page? Page name is "radio.php"?

Lynne
15 Jan 2010, 17:59
Sorted!! Was just missing one thing. But now, how do I make sure that the tab shows selected for that page? Page name is "radio.php"?
You should ask that question in the thread where you got the code for your tab. There are several mods and several articles on how to add a tab and they all seem to do it a bit differently, so you need to ask in that thread.

ragtek
15 Jan 2010, 20:37
you don't need all the templates in the globaltemplates array;)

If you need them only for a special action (do == 'xxx') you can use the actiontemplates

Lynne
15 Jan 2010, 21:30
you don't need all the templates in the globaltemplates array;)

If you need them only for a special action (do == 'xxx') you can use the actiontemplates
I've never understood the difference in those arrays (although I must admit to not having looked very hard into the issue).

ragtek
15 Jan 2010, 21:53
globaltemplates => cached global for the page (allways)

actiontemplates => cached if a special action is called ($_GET['do'] == 'whatever')

you could also make:

$globaltemplates = array('foo', 'bar');

if ($_REQUEST['do'] == 'xy')
{
$globaltemplates[] = 'xyz';
$globaltemplates[] = 'newpost_preview';
}


with actiontemplates:


$globaltemplates = array('foo', 'bar');
$actiontemplates = array(
'xy' => array(
'xyz', 'newpost_preview',
)
);

Lynne
15 Jan 2010, 22:20
Thank you for that explanation! It makes more sense to me now.

PukkaBen
16 Jan 2010, 11:36
Hey Lynne!! I am wondering, is there a way to get a "tree" on where the links have gone on each page?

For example, I have the main tab heading as "Radio" and then "Schedule" as a drop-down menu with each Day listed below. Just like you get Member List > Username at the top.

Cheers.

Lynne
16 Jan 2010, 16:08
Sorry PukkaBen, I don't understand what you are wanting at all. An image might help.

PukkaBen
16 Jan 2010, 16:52
Okay, I have the screen shot below to help explain what I'd like to get out of it.

http://www.vbulletin.org/forum/attachment.php?attachmentid=110144&stc=1&d=1263664260

But I'd like it to follow my links in the navigation. So on the "Tuesday" schedule page it would be
Radio -> Schedule -> Tuesday

I hope that helps.

Lynne
16 Jan 2010, 17:06
You mean the navbits - what says Member List > PukkaHQ right now? You'd have to look at the API for construct_navbits to find out what to pass to have it listed how you want. I've never really looked at that function, so I don't know exactly what you want to do.

oddmud
19 Jan 2010, 22:35
too complicated for this brain today. :(

chingon
21 Jan 2010, 20:27
Hello Lynne, very nice but any idea why my link is not showing up in the navbar? I did the template exactly as yoiurs but named it news. In the php I named it news.php and changed the 2 red test to news then changed test page to news page.

Lynne
21 Jan 2010, 20:40
Hello Lynne, very nice biu any idea why my link is not showing up in the navbar?
This article has nothing to do with the navbar, so I have no idea what link you are talking about.

ragtek
21 Jan 2010, 20:40
There is no automatic link in the navbar;)

chingon
21 Jan 2010, 21:06
Oops, sorry brain not working. I saw this post:

http://www.vbulletin.org/forum/showpost.php?p=1931936&postcount=63

and without reading thought it created that link. Actually reading it I see its anither mod. Sorry, works outstanding then, thank you.

orlybriceno
21 Jan 2010, 23:58
Is there a way to do a custom page from the vB CMS? Thanks

Lynne
22 Jan 2010, 00:08
Is there a way to do a custom page from the vB CMS? Thanks
You create articles in the CMS and can do various things to have them look like custom pages, but that is not something that this article is about at all. Help for the CMS is provided on vbulletin.com.

glen290
22 Jan 2010, 15:23
throwing in the towel, cant get no joy with this lol

Sort of got this working now, just got to try and get the php page i already have to work with it..:)

glen290
23 Jan 2010, 21:02
Can anybody help me with getting this to work on my new page please ?

<?php
/*
Copyright 2004 Greg Williams and Serena Swan, All Rights Reserved.

This file is part of BowlingDB.

BowlingDB is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

BowlingDB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with BowlingDB; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

require("bowlingfuncs.inc.php");
printDoctype();

?>
<head>
<title>Bowling Database</title>
<link href="bowling.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php $homedir=""; include("menuheader.php"); ?>
<?php include("pagebottom.php"); ?>
</body>
</html>



I get this error


Parse error: syntax error, unexpected '<' in /home/tenpinfo/public_html/BowlingDB/index.php on line 43

nsilva
25 Jan 2010, 23:32
I'm having a little trouble. I got the page to work, but now I want it to show something if a user is logged in, and something else if a guest views the page. How could I do this?

Lynne
26 Jan 2010, 00:19
I'm having a little trouble. I got the page to work, but now I want it to show something if a user is logged in, and something else if a guest views the page. How could I do this?
Put a condition around the stuff in the template:

<vb:if condition="$show['member']">
stuff to show logged in members
<vb:else />
stuff to show non-logged in users (guests)
</vb:if>

nsilva
26 Jan 2010, 00:31
Thank you! I had been trying all sorts of conditions but I just kept screwing them up. I would have been up all night trying to figure this out, I had at least 20 tabs open on the subject.

skylab
26 Jan 2010, 15:40
hey there. how could i make it so that only certain groups can view the page? thanks!

Lynne
26 Jan 2010, 16:18
Just add something after you include the global.php file:
if (!is_member_of($vbulletin->userinfo, x, y, z))
{
// no permission if you aren't a member of usergroupid x, y, or z
print_no_permission();
}

skylab
26 Jan 2010, 23:49
Just add something after you include the global.php file:
if (!is_member_of($vbulletin->userinfo, x, y, z))
{
// no permission if you aren't a member of usergroupid x, y, or z
print_no_permission();
}

I apologize for my ignorance but could you tell me in more detail?

Lynne
27 Jan 2010, 00:51
I'm not sure what else I can tell you about that. It's an statement that says "if the user is not a member of usergroup x,y, or z, then give them the No Permission page" I'm not sure what else you want to know about it.

skylab
27 Jan 2010, 02:22
Where to put it.... You had said after global.php statement. Am I just pasting it right after that call? Would it be too much to ask if you could give me an example with everything?

orlybriceno
27 Jan 2010, 03:20
You create articles in the CMS and can do various things to have them look like custom pages, but that is not something that this article is about at all. Help for the CMS is provided on vbulletin.com.

Hey everyone,

thanks Lynne for the quick reply, sadly I didn't see it on time, great tutorial, I haven't been able to implement it because the server where the vB4 installation that I work with resides doesn't allow me system access, so I only can work within vB.

So I want to know if someone knows where to find a guide or tutorial to accomplishing this, creating a custom page but withing the vB 4 CMS.

Thanks to all in advance

Lynne
27 Jan 2010, 15:10
Where to put it.... You had said after global.php statement. Am I just pasting it right after that call? Would it be too much to ask if you could give me an example with everything?
Here is just fine:
require_once('./global.php');

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

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




Hey everyone,

thanks Lynne for the quick reply, sadly I didn't see it on time, great tutorial, I haven't been able to implement it because the server where the vB4 installation that I work with resides doesn't allow me system access, so I only can work within vB.

So I want to know if someone knows where to find a guide or tutorial to accomplishing this, creating a custom page but withing the vB 4 CMS.

Thanks to all in advance
The only guides I am familiar with regarding the CMS are the artciles over on vb.com.

If you cannot add pages (can't ftp them), then you may want to look at this article - [HOW TO - vB4] Create a own vBulletin page (without plugin and php file)

orlybriceno
27 Jan 2010, 15:58
The only guides I am familiar with regarding the CMS are the artciles over on vb.com.

If you cannot add pages (can't ftp them), then you may want to look at this article - [HOW TO - vB4] Create a own vBulletin page (without plugin and php file)

Hey Lynne, thanks again, I checked the article you suggested It's handy, I could use it some other time, in this case my project manager wants us to use the CMS specifically, I'm following your article from vB.com CMS-How-to-get-a-layout-like-vBulletin-com (http://www.vbulletin.com/forum/content.php?182-CMS-How-to-get-a-layout-like-vBulletin-com)

Hope it can help me, if you stumble across more information about the CMS I would really appreciate it.

Cheers

netshaq
30 Jan 2010, 16:37
Lynne,

all i get is a blank page. please help I really need to add custom pages to my site
here is my test page.

http://www.netshaq.com/forum/test.php

can you figure out what i am doing wrong ?

thanks
steve

Lynne
30 Jan 2010, 19:03
Did you create the template in the style you are using? You will get a blank page if that style does not have that template. If that isn't the problem, you will need to post your exact code - please use the php and html tags when you do.

claystation
04 Feb 2010, 15:46
Is there any way to get your own vbulletin page to show up on the the internal vbulletin search?
Thanks,
Andy

Lynne
04 Feb 2010, 21:02
Is there any way to get your own vbulletin page to show up on the the internal vbulletin search?
Thanks,
Andy
You would have to write code to include what you have on that page into the search engine. I have no idea how to do this.

persianvb
05 Feb 2010, 08:23
hi

How do I remove the advertising and Announcements?

Thanks,

firstimecaller
08 Feb 2010, 12:14
Any tips on using these fundamentals for creating a vB wrapper for other scripts?

edit: I've got this part sorted pretty much. I'm making static files updated by chron'ed script to save on overhead.

I want the look of the vB4 style I've created to wrap around some other scripts on my site. I've used a plugin to create new tabs to cover these sections. I need to generate the top and bottom (a wrapper) of the page to include in the templates of these other scripts.

So, I need to set which tab is 'on' and then generate segments of the page.

Lynne
08 Feb 2010, 20:42
Some of the navtab mods allow you to set a navtab on, and some don't. I know my article and ragtek's artilce about adding navtabs cover setting them on, but I don't know about other mods.

borbole
08 Feb 2010, 23:53
Thank you Lynne. I was looking for something like this and it helped me a lot in the hack that I created. :)

teamshultz
09 Feb 2010, 02:46
How would you apply one of the built in layouts to a custom page? I'd like to do this so I can easily add widgets.

Lynne
09 Feb 2010, 04:24
How would you apply one of the built in layouts to a custom page? I'd like to do this so I can easily add widgets.
This article has nothing to do with building pages for the CMS. You may only use the layouts and widgets on pages within the CMS.

teamshultz
10 Feb 2010, 00:00
Ahh, I see. Thank you. Could you possibly direct me to some reading materials?

OcR Envy
10 Feb 2010, 15:08
Hi Lynne!

So I'm trying to create an extra page in my UserCP. I'm finding that although it renders the UserCP template correctly it's missing some fields on the left sidebar.

The following don't display:
Inbox, Sent Items, Edit Email & Password, Edit Ignore List, All Moderation Listings(Deleted Items, Moderated Items, New Items)

My code thus far:

<?php

error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT', 'shoop');
define('CSRF_PROTECTION', true);
$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array('USERCP_SHELL',
);
$actiontemplates = array();
require_once('./global.php');
require_once('includes/functions_user.php');

$navbits = construct_navbits(array('' => 'shoop'));
construct_usercp_nav('pokersites');
$navbar = render_navbar_template($navbits);

$pagetitle = 'shoop';


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

?>

Lynne
10 Feb 2010, 20:23
Ahh, I see. Thank you. Could you possibly direct me to some reading materials?
Tons of stuff over on vb.com. Go to their Home page link and you should see Don's name on the third (I think) article. Click to see all his articles.
Hi Lynne!

So I'm trying to create an extra page in my UserCP. I'm finding that although it renders the UserCP template correctly it's missing some fields on the left sidebar.

The following don't display:
Inbox, Sent Items, Edit Email & Password, Edit Ignore List, All Moderation Listings(Deleted Items, Moderated Items, New Items)

My guess would be you need to include a certain phrasegroup in the phrasegroup array.

OcR Envy
11 Feb 2010, 12:55
Yep for anyone interested I just edited up usercp.php to my liking :)

firstimecaller
11 Feb 2010, 13:30
cool! link us to the best docs/posts you referenced

Grae
14 Feb 2010, 13:31
Thank you Lynne :up:

I noticed that the code you provided registers two variables, navbar and pagetitle. However, there are six variables listed in the template: vboptions.bbtitle, pagetitle, headinclude, header, navbar, and footer. It seems that four of these variables don't need to be manually registered. Is there a list of all variables that don't need to be registered?

TheSupportForum
15 Feb 2010, 11:28
is it poosible to make the php files more W3C Complaint along with the templates
my templates for the php files are perfect except there not W3C complaint and would like like help converting templates to W3C Complaint

Conc
16 Feb 2010, 18:49
Sorry if this has been asked before--I was looking for a similar problem but couldn't find any:

Is there a way to include widgets (specifically, I'm thinking of the "Recent Articles" & "Recent Forum Posts" widgets) in a custom page template? Easily, maybe?

Thanks much for this impressive walkthrough.

Lynne
16 Feb 2010, 18:51
Sorry if this has been asked before--I was looking for a similar problem but couldn't find any:

Is there a way to include widgets (specifically, I'm thinking of the "Recent Articles" & "Recent Forum Posts" widgets) in a custom page template? Easily, maybe?

Thanks much for this impressive walkthrough.
Widgets are for CMS only. I do not know how to get them to work on other pages.

Sarcoth
17 Feb 2010, 21:15
Thanks Lynne. This helped me fix a few problems in my template code.

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

Hello all, can you please direct me to where I can learn how to complete this part? Thanks

Lynne
18 Feb 2010, 05:28
Hello all, can you please direct me to where I can learn how to complete this part? Thanks
The manual should help you on how to add a template - Editing the Templates (http://www.vbulletin.com/docs/html/stylemanager_edit_templates)

Alien
18 Feb 2010, 05:55
Don't forget to add:

{vb:raw headinclude_bottom}

...before the closing </head> tag, as vBulletin 4.01+ has added by default. :)

Still works great!

Lynne
19 Feb 2010, 00:55
Don't forget to add:

{vb:raw headinclude_bottom}...before the closing </head> tag, as vBulletin 4.01+ has added by default. :)

Still works great!
Thank you for the reminder!

Added to the first post.

TheSupportForum
19 Feb 2010, 21:18
lynne,

please can you help with template issues

everytime i create a template now, i get the following error for IE8


Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed

Lynne
19 Feb 2010, 22:17
Sorry, but this thread isn't for debuging template issues. If you need help on something other than writing a vB page, you really need to post in the main forums (and possibly on vb.com if this is not regarding a modification).

patrick91
21 Feb 2010, 16:49
First! thanx for evething!;) but i have a little thing that is going wrong! the footer...

A i see i fixed! forgot a div. ;)

djbaxter
23 Feb 2010, 02:50
I'm trying to create a custom page as described above.

However, if I insert HTML where it says "Text" in the template:

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

The HTML isn't processed (e.g., UL, OL, LI, H2, H3 tags, etc.).

Lynne
23 Feb 2010, 04:09
I'm trying to create a custom page as described above.

However, if I insert HTML where it says "Text" in the template:

<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">
Text
</div>
</div>The HTML isn't processed (e.g., UL, OL, LI, H2, H3 tags, etc.).
Take a look at the CSS in the page. It could be that the CSS is changing what you would think of as the default style for those tags.

djbaxter
23 Feb 2010, 05:31
Tnanks, Lynne. That does seem to be the problem. I'm not certain where the CSS is being set but it seems to have disabled some HTML features, while others are allowed.

For now, I can work around it.

Joseph Witchard
28 Feb 2010, 03:07
Great article:) In your examples, what is mypage referring to?

Skreech94
03 Mar 2010, 04:52
I didn't read through this thread to see if it was asked, so I apologize in advanced just in case.
Anyways, I dont want my guests viewing the page I made, but I want my members to view it. How would I do this?

TalkVirginia
03 Mar 2010, 05:50
This is giving me a MAJOR Migraine!! Please-- Can someone help me with this??

I'm trying to append some text or link at the end of the footer using the parse_templates hook in a plugin..

This is my code:



$myfooter = 'my test string';
vB_Template::preRegister('footer',array('myfooter' => $myfooter));

Lynne
04 Mar 2010, 04:48
I didn't read through this thread to see if it was asked, so I apologize in advanced just in case.
Anyways, I dont want my guests viewing the page I made, but I want my members to view it. How would I do this?
Right after Start Main Script add something like:
if (!isset($vbulletin->userinfo['userid']) OR $vbulletin->userinfo['userid'] == 0)
{
print_no_permission();
}
This is giving me a MAJOR Migraine!! Please-- Can someone help me with this??

I'm trying to append some text or link at the end of the footer using the parse_templates hook in a plugin..
This has nothing to do with this article. Your best bet it to post in the main forums for help with this.

TalkVirginia
04 Mar 2010, 09:35
This has nothing to do with this article. Your best bet it to post in the main forums for help with this.

I have. ...and as usual, I haven't been able to get help with this so I thought I would post in several places that related to the issue I was having.

Lynne
04 Mar 2010, 14:31
I have. ...and as usual, I haven't been able to get help with this so I thought I would post in several places that related to the issue I was having.
I don't have a quick answer for you as I have never needed to add something to the end of that template that I couldn't just put in the ad template or do a str_replace with.

TalkVirginia
04 Mar 2010, 15:17
I don't have a quick answer for you as I have never needed to add something to the end of that template that I couldn't just put in the ad template or do a str_replace with.

That's ok Lynne. I appreciate the response anyway. I actually found what I was looking for in another thread. It was so simple it's scary. :eek:

http://www.vbulletin.org/forum/showpost.php?p=1996768&postcount=82

Lynne
04 Mar 2010, 18:31
That's ok Lynne. I appreciate the response anyway. I actually found what I was looking for in another thread. It was so simple it's scary. :eek:

http://www.vbulletin.org/forum/showpost.php?p=1996768&postcount=82
Thank God for str_replace. :) Glad you found a solution.

nykegodess
05 Mar 2010, 18:30
Thank you very much, it took me ages to work out (my silliness). I read every post, just as i was about ask a question, i figured it out.

My advice to others read through before posting and double check everything, the smallest mistake will ruin your efforts! :D

Thank you again!

Joseph Witchard
07 Mar 2010, 06:59
What exactly is the point of making extra pages? Is it to run certain scripts, like from a mod you make or something?

TalkVirginia
07 Mar 2010, 11:02
Thank you very much, it took me ages to work out (my silliness). I read every post, just as i was about ask a question, i figured it out.

My advice to others read through before posting and double check everything, the smallest mistake will ruin your efforts! :D

Thank you again!

I know the feeling Godess.. I thought I was going to have a meltdown, but it turned out to be easier than I thought.

Glad to hear you got yours to work for you! :)

--------------- Added 1267963665 at 1267963665 ---------------

What exactly is the point of making extra pages? Is it to run certain scripts, like from a mod you make or something?

Yes, exactly... When you're using php to create pages, generally it will be use in developing some sort of mod or addon. This allows your page to show dynamically generated data instead of data that doesn't change like a plain HTML page.

Joseph Witchard
08 Mar 2010, 03:28
Okay. If you wanted to create a script to run in the Admin CP, how exactly would you get the page to go (look-wise) with the other pages in the Admin CP? Same question applies for a page in the main forum area.

Lynne
08 Mar 2010, 04:27
Okay. If you wanted to create a script to run in the Admin CP, how exactly would you get the page to go (look-wise) with the other pages in the Admin CP? Same question applies for a page in the main forum area.
Pages in the Admin CP are done a totally different way. They do not use templates at all. I don't understand your question about it applying to the main forum area since this makes a page that looks just like the rest of the forum (same header, navbar, footer, you just fill in the stuff in between).

Joseph Witchard
08 Mar 2010, 04:41
I just meant that all the pages in the Admin area have a common theme with each other (the navigation menu on the left, the same colors, same style of buttons, etc.). In the same way, the main forum area has its own theme with its pages (same colors and buttons, etc.). What I was asking is what do you do to get your custom pages to go with the theme of the area they're in. If you're making a page to run in the Admin CP, how do you get it to look similar to the other pages in the Admin CP? If you're making a page for the main forum area, how do you make it where it looks like the rest of your forum pages?

Lynne
08 Mar 2010, 21:31
I just meant that all the pages in the Admin area have a common theme with each other (the navigation menu on the left, the same colors, same style of buttons, etc.). In the same way, the main forum area has its own theme with its pages (same colors and buttons, etc.). What I was asking is what do you do to get your custom pages to go with the theme of the area they're in. If you're making a page to run in the Admin CP, how do you get it to look similar to the other pages in the Admin CP? If you're making a page for the main forum area, how do you make it where it looks like the rest of your forum pages?
In the case of the forums, using the template system with common templates is what makes the pages look the same. In the case of the admincp, it's a frame, so you don't need to do much to make it look the same.

Joseph Witchard
09 Mar 2010, 01:10
What are the common templates in your example? And do you mean that you have to build an Admin page from scratch? There are no common templates for it?

CoZmicShReddeR
09 Mar 2010, 01:41
Hello Lynne, could you please help meh figure out how to fix inframe page for this setup? I tried but the information is posting above the header...

http://www.cozworld.com/hlstatsx.php

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'HLstatsX';
echo "<iframe src =\"http://www.cozworld.com/hlxstats/hlstats.php\" frameborder=0 width=100% height=800 scrolling=yes> \n";
echo "</iframe> \n";
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

Here is the actual link http://www.cozworld.com/hlxstats/hlstats.php

Thanks...

Lynne
09 Mar 2010, 02:44
What are the common templates in your example? And do you mean that you have to build an Admin page from scratch? There are no common templates for it?
The header, headinclude, footer, and navbar are all used in the test template I posted. You don't have to include them, but if you don't, then you won't get the look of the forums.

This article is really not about the admin cp. The admin cp doesn't use templates at all.

Hello Lynne, could you please help meh figure out how to fix inframe page for this setup? I tried but the information is posting above the header...

http://www.cozworld.com/hlstatsx.php

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'HLstatsX';
echo "<iframe src =\"http://www.cozworld.com/hlxstats/hlstats.php\" frameborder=0 width=100% height=800 scrolling=yes> \n";
echo "</iframe> \n";
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######Here is the actual link http://www.cozworld.com/hlxstats/hlstats.php

Thanks...
echo just echos the info wherever the code happens to be called in the page - which is not somewhere in the middle of the template where you want it to go. If you look at my example, output is entered into a variable and the variable is placed in the template where you want the output to go.

CoZmicShReddeR
09 Mar 2010, 08:41
Wow, thanks so much I was going nutz! :)

Joseph Witchard
10 Mar 2010, 03:05
All right then. Thanks, Lynn. Appreciate it:)

Affixxx
11 Mar 2010, 02:24
Hey Lynne,
Whats wrong with using the GENERIC_SHELL?

Heres a function I made that uses it

function generatePage($pagetitle, $navbar, $content, $template='GENERIC_SHELL')
{
//Page Generation Function by Affix
$templater = vB_Template::create($template);
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('HTML', '<br />' . $content);
print_output($templater->render());
}

That way all you really need to do is

$content = 'Your Content';
$pagetitle = 'Test Content';
$navbits = construct_navbits(array('' => 'Test Page'));
$navbar = render_navbar_template($navbits);
generatePage($pagetitle, $navbar, $content);

Fairly Simple and it will save space in your Database and it uses what vBulletin already provides you.

Joseph Witchard
11 Mar 2010, 03:08
Hey Lynne,
Whats wrong with using the GENERIC_SHELL?

Heres a function I made that uses it

function generatePage($pagetitle, $navbar, $content, $template='GENERIC_SHELL')
{
//Page Generation Function by Affix
$templater = vB_Template::create($template);
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('HTML', '<br />' . $content);
print_output($templater->render());
}

That way all you really need to do is

$content = 'Your Content';
$pagetitle = 'Test Content';
$navbits = construct_navbits(array('' => 'Test Page'));
$navbar = render_navbar_template($navbits);
generatePage($pagetitle, $navbar, $content);

Fairly Simple and it will save space in your Database and it uses what vBulletin already provides you.

Speaking of functions, are you not required to preRegister them as you are with variables?

Lynne
11 Mar 2010, 03:25
The GENERIC_SHELL would be fine. Some people like to fill their template with a bunch of html and would rather type it out in the template rather than assign it all to a variable to be output. You are welcome to put up an article on how to do this using the GENERIC_SHELL - users welcome having options to pick from when they do things.

desi-boy
15 Mar 2010, 20:14
thnxxxx Excellent!

can u help me
how can i add an iframe ( it's A html Page) in this ... i mean in Test.php