The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
[HOW TO - vB4] Create your own vBulletin page
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 took the time to write this out. And his work is based on the article by Gary King here - How to create your own vBulletin-powered page! (uses vB templates) 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!!!): Code:
<?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()); ?> 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: HTML 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 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: Code:
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: Code:
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 |
#1032
|
|||
|
|||
How would I go about adding an external web link to appear in the page, similar to how panjo appears
thanks |
#1033
|
||||
|
||||
This is great. Just need to sort out my text coding and it will be sweet. Might even solve a few annoying errors I've had by using CMS articles as pages instead of custom pages.
|
#1034
|
|||
|
|||
Will love to see this working on v5
|
#1035
|
|||
|
|||
Hi, I'm new on this, and I'm having trouble to create a page out off the Forum root, inside the root everything is fine, but out side is without CSS...
My Forum is in: /var/www/forum My page is in: /var/www/tests.php This is my code... Code:
// ####################### 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('/var/www/forum/'); require_once('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = construct_navbits(array('' => 'TEST')); $navbar = render_navbar_template($navbits); // ###### YOUR CUSTOM CODE GOES HERE ##### $pagetitle = 'TEST'; // ###### NOW YOUR TEMPLATE IS BEING RENDERED ###### $templater = vB_Template::create('TEST'); $templater->register_page_templates(); $templater->register('navbar', $navbar); $templater->register('pagetitle', $pagetitle); print_output($templater->render()); Code:
|
#1036
|
|||
|
|||
you need to set an 'include' phrase that 'points' to the location of your css file
|
#1037
|
|||
|
|||
Could you show me?? As I say, I'm new on this, and don't have idea where is the CSS of Vbulletin...
|
#1038
|
|||
|
|||
Quote:
Hello again, I am creating a photography database application, so sharing pictures is an absolute must. When a person is on the "view pic" page, a facebook link is there as well so that the person can share the pic on facebook. I am able to share the post to the person's wall, successfully, but instead of presenting a thumbnail of my desired photo, all that is being posted is a thumbnail of my forum logo. I cannot figure out how to override this and include the desired picture in the Facebook popup for posting. I tried to follow the instructions on your link, and it simply doesn't work. It's beyond a FB problem, it's intrinsic to vBulletin, and it's driving me nuts. Before I make the dynamic solution to this problem, my goal is to first establish a static proof-of-concept. Here is the html I am using in the root directory. Notice I am intending on using the Facebook OpenGraph tool to a linked picture: It is as if all the custom "meta" tags are being completely ignored by something inside vBulletin. How can I include a custom pic in my Facebook Shares? Your help is greatly appreciated. Code:
<html> <head> <meta property='fb:app_id' content='473597412755690' /> <meta property='og:site_name' content='Nature Photography Resource & Database' /> <meta property='og:description' content='Online community for dedicated macro photographers worldwide.' /> <meta property='og:url' content='http://www.macrophotopro.com' /> <meta property='og:type' content='website' /> <meta property='og:image' content='http://www.macrophotopro.com/thumbnails/1/1_thumb_0000000548_tiny.jpg'> </head> <body> <div id='fb-root'></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = '//connect.facebook.net/en_US/all.js#xfbml=1&appId=473597412755690'; fjs.parentNode.insertBefore(js, fjs); } (document, 'script', 'facebook-jssdk')); </script> <div class='fb-share-button' data-href='http://www.macrophotopro.com/' data-type='button_count'> </div> </body> </html> This is the picture that SHOULD be appearing on the Share: However, the attached below (my forum logo) is what's actually getting displayed. What do I have to do to get the desired pic to override the default posting of the logo? Help is greatly appreciated! |
#1039
|
||||
|
||||
Right now, if I go to your site, you have it turned off. That means an Unregistered user may not see a thing. And, if you are testing your script while it is turned off, remember that Facebook is an Unregistered User and so the only image they can grab is your logo.
|
#1040
|
|||
|
|||
Quote:
I am not sure I made myself clear. What we're trying to do has nothing to do with a person being registered, logged-in, or anything like that. This has to do with a Facebook "share" button on our custom page NOT being able to share a desired image onto FB. A person should NOT have to be registered onto my site, at all, for the share button to work nor for the image to be displayed. The share button works, and the image should display because of the coding, but yet it is not. I do understand what you're saying about the forum being turned off, but we did test the procedure with it turned on, and still got the logo, not the desired image. The meta content is structured so that the spider image should display, but yet only the logo displays. I believe vBulletin has some static, overriding code to where only vBulletin's logo displays (or whatever logo is up there), and we are trying to circumvent or identify this code and change it. It should have absolutely nothing to do with whether a person is logged in to our site or not. In fact, the whole idea is to advertise to NON customers of our site, to Facebook, so they can click on the FB image and be taken back to our site. These people will not be customers, so their being logged in should have no bearing on seeing the image or not. We believe we have the coding correctly ... we have the reference to the correct thumbnail ... yet it's showing only the logo. What overriding code to we need to get rid of to get what we want displayed, displayed? Thanks and I hope this was clear Jack PS: Click this link, click the FB button, and see what I mean: http://www.macrophotopro.com/fb.html |
#1041
|
|||
|
|||
Hello ...
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|