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 |
#1042
|
||||
|
||||
I really don't know enough about Facebook and their code to help out on this.
|
#1043
|
|||
|
|||
Quote:
Wow. You can't explain why the Blog and the Forum, when their links are Shared or physically-added to a Facebook wall, that those links display a list of images to select from ... while this custom page does NOT? Really? You can't explain that or give help to overcome this? Impressive. Thanks. |
#1044
|
|||
|
|||
Your negative reply to Lynne is not a pleasant invitation for others to help you. You might want to rethink abusing the volunteers in this community. This is an enthusiast community for vBulletin, and is not official vBulletin support. If you would like help please be nice, we try to be.
|
#1045
|
||||
|
||||
Correct, and just because some one is considered a "top person" does not mean they know all there is to know about vBulletin, or a third party integration such as Facebook, I my self have over 60 mods released, and I could not tell you one thing about it, I don't even have a Facebook page.
|
#1046
|
|||
|
|||
When I have a chance I will take a look at your code, but I am currently working on a backlog of tasks for other vbulletin.org members.
|
#1047
|
|||
|
|||
Quote:
|
Благодарность от: | ||
ozzy47 |
#1048
|
||||
|
||||
Believe me, I know how frustrating things are when they don't work as intended, or as you would like them to. I have spent many hours yelling at my screen when things don't go my way.
The people here will do their best to help anyone out, and yes it can get quite aggravating when things just won't cooperate, but patience is a virtue. Hopefully someone here has ran into the issue before, and can help out. |
Благодарность от: | ||
tbworld |
#1049
|
|||
|
|||
Quote:
I have been working on the customization of this site for 2 years, and we're ready to launch. The entire sum & substance of our functionality and advertisement hinges on these custom image pages being able to be "Shared" onto Facebook walls ... so the author of this tutorial "not knowing how" to connect and override to FB is no small omission. Thanks again. --------------- Added [DATE]1394112600[/DATE] at [TIME]1394112600[/TIME] --------------- Here is an example of one of our Image pages: I have coded the button to share the post to the person's wall, successfully, but instead of presenting a thumbnail of the desired photo, all that is being posted is a thumbnail of my forum logo, as such: Failed vBulletin Custom Share showing Forum Logo I don't want my forum logo displayed; I want a thumbnail of the desired image displayed. I cannot figure out how to override this glitch and include the desired picture in the Facebook popup for posting, rather than my logo. I know it is possible to get the desired image, and I thought I had coded it as such. For example, in the vBulletin Blog, when I use the Facebook Share Button there, I see the image I am trying to share *plus* the option for other images on the page: Successful Blog Post Share showing Desired Image When using the Blog, if I post the same 2 images and try to share them there, when the "Share pop-up" displays, you will notice that not only is the individual image that I want available to share, but that I have a total list of the 2 photos I can sort through and select from to share as well ... but I get no such thing from this vBulletin custom page! Again, here is my code: 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> What do I have to do to get the desired pic to override the default posting of the vBulletin logo? I am willing to pay for this $ervice, so PM me your price! Thank you, Jack --------------- Added [DATE]1394112849[/DATE] at [TIME]1394112849[/TIME] --------------- Quote:
|
#1050
|
|||
|
|||
I added you to my cue. Actually, I added you several days ago, but since I had a backlog already I did not answer. Obviously, I have to mock this up and it will be a three-four days minimum before I can get into it. Some members here have been waiting for my time for four weeks since my work sent me to Sochi for the Olympics. If you can be patient I can help.
|
#1051
|
|||
|
|||
Quote:
Cheers, |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|