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)

MacroPhotoPro 04-05-2012 12:25 AM

Quote:

Originally Posted by Lynne (Post 2316698)
Please give us a URL to view the page. My guess is the HTML did show up, but your CSS is causing it to not do what you want.
Search this article for discussions on the problems using <li> on this page and the CSS you need to add to fix it.


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


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

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

More text.

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


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

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

?>

This is my template:

Code:

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

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


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

Jack

AusPhotography 04-05-2012 01:19 AM

If you want a simple skeleton page bundled together as a vB product see:
https://vborg.vbsupport.ru/showthread.php?t=266449
It provides a tab and a Google search.

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

Kym

MacroPhotoPro 04-05-2012 02:33 AM

Quote:

Originally Posted by snoopytas (Post 2316858)
If you want a simple skeleton page bundled together as a vB product see:
https://vborg.vbsupport.ru/showthread.php?t=266449
It provides a tab and a Google search.

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

Kym


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

And nice to meet another photographer too :D

Cheers,

Jack

michaelbang 04-08-2012 11:01 PM

Is it possible to create a new page, containing a new forum with new sections? I mean, basically copy the excisting "Forum" page to a new page with a new title, new sections, new forums etc?

Lynne 04-09-2012 03:09 AM

Quote:

Originally Posted by michaelbang (Post 2318155)
Is it possible to create a new page, containing a new forum with new sections? I mean, basically copy the excisting "Forum" page to a new page with a new title, new sections, new forums etc?

Sure, you could do that. You will need to tweak some of the code, but it will be possible. It isn't really anything to do with this article though.

dadoc 04-14-2012 03:56 AM

How can I add my forum sidebar to the page?

Lynne 04-14-2012 04:41 PM

You would need to add the template code from the FORUMHOME template into your template for the block and also add all the php from the forum.php file for the block to your php file (along with any templates needed, etc.)

karabaja3 04-18-2012 08:52 PM

Quote:

Originally Posted by Lynne (Post 1918511)
Did you add the template to the MASTER STYLE or just to one of your styles? And is that style the default style for unregistered users?


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

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

Update: solved

wilford brimley 04-19-2012 04:05 AM

im working on this, thanks got my page going. Ive been looking through the 50 page sbut cant find my answers.

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

Lynne 04-19-2012 03:18 PM

1. Then you need to add the template to all the skins.

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

wilford brimley 04-20-2012 04:10 AM

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

I;ll search, thanks.

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

found it, thanks.

addamroy 04-22-2012 01:32 PM

Can anyone either direct me to the appropriate post, or tell me how I can execute PHP code in these custom pages?

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

cellarius 04-22-2012 03:09 PM

By putting it into the php file? Right after "// ###### YOUR CUSTOM CODE GOES HERE #####"?

Eq4bits 04-23-2012 07:09 PM

vB4.1.12

successfully created php file
successfully created template

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

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

Anatoliy2 05-28-2012 10:00 AM

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

Thanks in advance!

Lynne 05-28-2012 05:05 PM

Quote:

Originally Posted by Anatoliy2 (Post 2333834)
Thank you very much for describing how to make a custom page. I made it and everything worked like a charm! I have a question. I made a new nav tab "Links" and pointed it to my custom page links.php. How can I make that when I'm in, the "Links" tub would be highlighted, not the "Forum" as it is now. My site is www.oregonfishingforum.com

Thanks in advance!

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

thecoo1est 05-30-2012 03:36 AM

Hi Lynne, Would you answer one question for me? Im not sure I fully understand how to call additional templates in to existance.

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

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

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

Anatoliy2 05-30-2012 07:22 AM

Quote:

Originally Posted by Lynne (Post 2333947)
You would enter into the Tab Script(s) field what you entered as THIS_SCRIPT in your page.

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

Lynne 05-30-2012 04:28 PM

Quote:

Originally Posted by thecoo1est (Post 2334528)
Hi Lynne, Would you answer one question for me? Im not sure I fully understand how to call additional templates in to existance.

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

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

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

You need to first render the "slideshow" template and then add the results of it as a variable into the "custom home" template.

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

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

Quote:

Originally Posted by Anatoliy2 (Post 2334560)
Thanks for the answer! That's what I did originally and it doesn't work. :( I created file links.php (put it in the root), created a new template TEST, made a new nav tab Links, put links.php in the Tab Script(s) field. Doesn't work. The "Forum" link is highlighted when I'm on links.php page. :( Please help to understand what I'm doing wrong.

Tab Script is probably just "links" - check to see what variable you defined as THIS_SCRIPT at the top of the page.

Anatoliy2 05-30-2012 08:15 PM

Quote:

Originally Posted by Lynne (Post 2334750)
Tab Script is probably just "links" - check to see what variable you defined as THIS_SCRIPT at the top of the page.

It works! Thank you very much!

Dave-ahfb 06-01-2012 03:44 PM

How can we get custom pages to pull a custom child style?

Lynne 06-01-2012 03:48 PM

Quote:

Originally Posted by Dave-ahfb (Post 2335472)
How can we get custom pages to pull a custom child style?

I don't understand what you mean. You want a certain style on your custom page? Then write that in the PHP of your page.

Dave-ahfb 06-01-2012 04:27 PM

Quote:

Originally Posted by Lynne (Post 2335476)
Then write that in the PHP of your page.

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

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

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

red

blue

yellow

kh99 06-01-2012 05:01 PM

Quote:

Originally Posted by Dave-ahfb (Post 2335495)
Each forum section on my site uses its own template set, I would like to utilize the different styles in the respected off forum sections.


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

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

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

Dave-ahfb 06-01-2012 05:38 PM

Quote:

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

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

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

Now I am beginning to understand.

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

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

cellarius 06-01-2012 05:41 PM

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

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

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

Dave-ahfb 06-01-2012 05:47 PM

Can you give me an example?

cellarius 06-01-2012 05:57 PM

Well, it's everything there, really.

In your own page, do something like this:
After "define('THIS_SCRIPT', 'test');", add
PHP Code:

$force_my_style 5

where 5 needs to be replaced with the styleid of the style you want to use on that page.

Then create a plugin at global_bootstrap_init_start
PHP Code:

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


Not tested, should work.

Dave-ahfb 06-01-2012 08:13 PM

not working, even tried registering $force_my_style on the custom page, still the parent style

kh99 06-01-2012 08:27 PM

That's my fault - [S]try using hook global_bootstrap_init_complete.[/S]

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

Code:

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


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

Dave-ahfb 06-01-2012 09:14 PM

Works great, thanks!

This will help maintaining different ads per category

cellarius 06-02-2012 07:47 AM

Quote:

Originally Posted by kh99 (Post 2335589)
BTW, nice solution, cellarius. Maybe this should be added to the article.

Well, I'll return the applause :cool: After all, the idea came from you, and you've been the one refining it :up:

kh99 06-02-2012 10:56 AM

Quote:

Originally Posted by cellarius (Post 2335724)
Well, I'll return the applause :cool: After all, the idea came from you, and you've been the one refining it :up:

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

stb74 06-05-2012 02:40 PM

I have been able to create my custom pages ok and use the following code for my templates

Code:

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

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

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

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

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

$pagetitle = 'NI Football Fantasy League';

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

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

Lynne 06-05-2012 02:43 PM

Quote:

Originally Posted by stb74 (Post 2336775)
I have been able to create my custom pages ok and use the following code for my templates

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

Sounds to me like you are having problems setting up your tab in the Navigation Manager, not that you are having problems with your page itself. I'd suggest you post in the main forums for help with your NM settings.

fotoking 06-16-2012 03:35 AM

Hello everyone,

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

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

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

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

I appreciate all the help I can get. Thanks Guys

Lynne 06-16-2012 05:21 PM

Quote:

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

I appreciate all the help I can get. Thanks Guys

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

kkinsey 06-21-2012 04:29 PM

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

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

Here's the relevant section of my PHP script:
PHP Code:


$navbits 
construct_navbits($navbits);
$navbar render_navbar_template($navbits);
//$templater = vB_Template::create('footer');
//if (!is_object($templater)) { die("template not object!"); }
//$footer = $templater->render();
//if (!is_object($footer)) { die("footer not object!"); }
$templater vB_Template::create('pfs');
        
$templater->register_page_templates();
        
$templater->register('navbar'$navbar);
        
$templater->register('checked'$checked);
//        $templater->register('footer',$footer);
print_output($templater->render()); 

You can see I've been fudging around trying to figure this out. I even read about 24 pages of this thread before giving in to the temptation to bug you about it. ;) Not that's that would be any consolation for you, I'm afraid.

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

Here's the 'pfs' template code:
Code:

{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml"<vb:if condition="$vboptions['enablefacebookconnect']"> xmlns:fb="http://www.facebook.com/2008/fbml"</vb:if> dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}">
<head>
        {vb:raw headinclude}
        <title>My Page Title</title>
        {vb:cssfile faq.css}
        {vb:raw headinclude_bottom}
</head>
<body>

{vb:raw header}

{vb:raw navbar}

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

<!-- FOOTER TEMPLATE IS INCLUDED BELOW THIS LINE -->
<vb:raw footer>
</body>
</html>

I can comment out the IFrame, but it doesn't seem to matter; the footer's not output/shown regardless. I do see the closing /BODY and /HTML tags.

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

kh99 06-21-2012 07:08 PM

Quote:

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

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

kkinsey 06-21-2012 08:20 PM

Doh! Too much stuff this week for brain to function properly! Thanks much!

Where do you want your cookies sent? :)


All times are GMT. The time now is 12:40 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.02371 seconds
  • Memory Usage 1,877KB
  • 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
  • (5)bbcode_code_printable
  • (3)bbcode_php_printable
  • (18)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