vb.org Archive

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

Allan 01-14-2010 09:15 PM

Quote:

Originally Posted by Lynne (Post 1955688)
Sorry, I missed this. You would just do something like this...
PHP Code:

<?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 01-15-2010 12:21 AM

Great work.

PukkaBen 01-15-2010 10:53 AM

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

<?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 01-15-2010 02:20 PM

If you are using id as the passed variable, then you need to use $_REQUEST['id'] in the code, not $_REQUEST['do']

PukkaBen 01-15-2010 02:42 PM

Okay, here is what I am using...

PHP Code:

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

HTML Code:

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

Lynne 01-15-2010 02:53 PM

Quote:

Originally Posted by PukkaBen (Post 1956560)
Okay, here is what I am using...

PHP Code:

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

HTML Code:

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 01-15-2010 02:57 PM

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 01-15-2010 04:59 PM

Quote:

Originally Posted by PukkaBen (Post 1956578)
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 01-15-2010 07:37 PM

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 01-15-2010 08:30 PM

Quote:

Originally Posted by ragtek (Post 1956810)
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 01-15-2010 08:53 PM

globaltemplates => cached global for the page (allways)

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

you could also make:
PHP Code:

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

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


with actiontemplates:

PHP Code:

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


Lynne 01-15-2010 09:20 PM

Thank you for that explanation! It makes more sense to me now.

PukkaBen 01-16-2010 10:36 AM

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 01-16-2010 03:08 PM

Sorry PukkaBen, I don't understand what you are wanting at all. An image might help.

PukkaBen 01-16-2010 03:52 PM

1 Attachment(s)
Okay, I have the screen shot below to help explain what I'd like to get out of it.

https://vborg.vbsupport.ru/attachmen...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 01-16-2010 04:06 PM

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 01-19-2010 09:35 PM

too complicated for this brain today. :(

chingon 01-21-2010 07:27 PM

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 01-21-2010 07:40 PM

Quote:

Originally Posted by chingon (Post 1962678)
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 01-21-2010 07:40 PM

There is no automatic link in the navbar;)

chingon 01-21-2010 08:06 PM

Oops, sorry brain not working. I saw this post:

https://vborg.vbsupport.ru/showpost....6&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 01-21-2010 10:58 PM

Is there a way to do a custom page from the vB CMS? Thanks

Lynne 01-21-2010 11:08 PM

Quote:

Originally Posted by orlybriceno (Post 1962877)
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 01-22-2010 02:23 PM

Quote:

Originally Posted by glen290 (Post 1954562)
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 01-23-2010 08:02 PM

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 01-25-2010 10:32 PM

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 01-25-2010 11:19 PM

Quote:

Originally Posted by nsilva (Post 1966605)
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:
HTML Code:

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


nsilva 01-25-2010 11:31 PM

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 01-26-2010 02:40 PM

hey there. how could i make it so that only certain groups can view the page? thanks!

Lynne 01-26-2010 03:18 PM

Just add something after you include the global.php file:
Code:

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 01-26-2010 10:49 PM

Quote:

Originally Posted by Lynne (Post 1967140)
Just add something after you include the global.php file:
Code:

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 01-26-2010 11:51 PM

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 01-27-2010 01:22 AM

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 01-27-2010 02:20 AM

Quote:

Originally Posted by Lynne (Post 1962892)
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 01-27-2010 02:10 PM

Quote:

Originally Posted by skylab (Post 1967579)
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:
PHP Code:

require_once('./global.php');

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

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

Quote:

Originally Posted by orlybriceno (Post 1967603)
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 01-27-2010 02:58 PM

Quote:

Originally Posted by Lynne (Post 1968010)

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

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

Cheers

netshaq 01-30-2010 03:37 PM

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 01-30-2010 06:03 PM

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 02-04-2010 02:46 PM

Is there any way to get your own vbulletin page to show up on the the internal vbulletin search?
Thanks,
Andy

Lynne 02-04-2010 08:02 PM

Quote:

Originally Posted by claystation (Post 1974716)
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.


All times are GMT. The time now is 12:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02580 seconds
  • Memory Usage 1,935KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_html_printable
  • (7)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete