PDA

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


Pages : 1 2 3 4 [5]

MacroPhotoPro
10-08-2013, 09:19 PM
Adding a Comments Box to the Page

Once again, this is a great piece to add to my site, and a great tutorial.

I am using this basic page to display photographs, but I want to add a "Comments Box" to each generated page (like the default Blog and Articles pages have).

How would I go about doing this?

Can I just copy/paste the appropriate material from the blog.php or article.php, or do I have to use customization?

Thanks again!

Jack

Lynne
10-08-2013, 10:51 PM
You would need to create a form in the template to do something with the comments and then you will need to write the php code to process any comment made. You will probably be able to copy alot of it from the blog/article page, but it will be different since you will be storing the data in a different table in the database.

MacroPhotoPro
10-10-2013, 04:57 PM
Thank you.

smirkley
10-12-2013, 03:09 AM
Just a statement,.. I will be posting my code, I just am covered up at the moment at home.

smirkley
10-14-2013, 02:19 AM
I love the way this mod works, and am building a functionality for my forum with it.

I have played with many variations of what I can do, but I found myself stuck in using my example.php page file to fill a variable array from a list in a custom database, and then get it to printout the list of database contents on the template form.

I will admit I havent read every page here (still workin on that lol), but I so far have not been able to figure this one out.

If anyone has sucessfully done something like this with this mod, throw me a clue of what I am not able to figure out. Thanks big time.

Ok, I am available now to address my intended integration of this tutorial into a custom product. (every time I tell my wife I want to do some coding, she always says "fine", but I always end up repainting a bedroom or remodeling a bathroom instead. I havent figured out how that works yet. lol)


This is what I have so far....

1 - I created a product xml that creates a database and supporting template very similar to the one posted by Lynne. The template has several if ($_REQUEST['do'] =='s installed for different page renderings depending on function desired. IE: home,list,add,edit,delete of database entries. So far, works perfectly.

Now I am working on the list part of the database. I have entered several rows of test data into the database manually through phpmyadmin. As I ventured into using if ($_REQUEST['do'] == 'history') in the php file I know that I have to build an array to send to the template (sorted by date).

Database structure: date field, data1, data2, data3, data4, data5, data6

I tried to build a loop to fill a variable array and it seemed that it was working, but I couldnt figure out how to list that array in the template. I am unsure if I have to register the variable, it is only used on this feature I am making.

When I tried to output the array in the template, it would print out one row of data (correctly), not the whole database, and it would be on the very top of my page above the header.

I am going to have to reconstruct it again to get to that point, I seemed to have trashed the experimental code in frustration of not getting it to work, and having to start the bedroom remodel. :(

Lynne
10-14-2013, 09:51 PM
You can't use echo or it will end up on the top of the page. You need to take your data and output it to a variable:

$myvar = '';
start of loop
$myvar .= "html here";
end of loop
make sure to register $myvar for use in your template

and in the template, put
{vb:raw myvar}

smirkley
10-14-2013, 10:42 PM
Thanks, will give that a try.

(I suppose you saw my error in stating that the multiple "do" functions were put in the template, I meant they were put in the php file, each one with a different template used.)

--------------- Added 1381803115 at 1381803115 ---------------

Ok, there is a reason I dont release mods here. Cous I seem to struggle with the obvious lol.

I have registered the variable,...
$templater->register('history', $history);

I thought I would just start simple and just have 1 row in my database. From there I will expand on it once I can get a simple read done.

This is my php query. (kinda found it while searching the forums and modified it to my purpose)


$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "history");

while ($l_history = $vbulletin->db->fetch_row($result)){
$history[] = $l_history[1];
}


But using {vb:raw history} in my template produces a blank whereas there is actual data in the database fields.

Lynne
10-15-2013, 09:17 PM
I would use fetch_array in case you to later have multiple rows and you should specify the field you want. Assuming you want history.field, then:

$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "history");

$l_history['field'] = '';
while ($l_history = $db->fetch_array($result)){
$history['field'] .= $l_history['field'];
}

and then in the template:
{vb:raw history.field}

FBRN_Andrew
10-15-2013, 10:49 PM
Hello FBRN_Andrew

if I'm not mistaken, and I understand the question in the template created, you just add this before the tag </head>
<style type="text/css">
#navbar_notice_1 {
display: none;
}
</style>

thanks for the reply
Greetings I added the lines you included, the page looks much better, but still seems to be in a "not logged in" mode.

I'm not much of a PHP coder so I don't really know what code I should paste in to explain.

--------------- Added 1381881251 at 1381881251 ---------------

Also since the 4.2.2 patch I removed the tabs hack and changed to navigation manager, using "member" as the group to see most tabs. so when I go to the new page the menu(tabs) also switch to logged out mode. however clicking the home link, or back puts you back to logged in status.

smirkley
10-16-2013, 02:50 AM
I would use fetch_array in case you to later have multiple rows and you should specify the field you want. Assuming you want history.field, then:

$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "history");

$l_history['field'] = '';
while ($l_history = $db->fetch_array($result)){
$history['field'] .= $l_history['field'];
}

and then in the template:
{vb:raw history.field}

Lynne, I do appreciate your valued input.
I tried to make it work but I produced db errors in the process.

Info: I have one row now, but I anticipate in the future many rows, each one containing 7 columns. And in this routine I wish to list on my page all the rows.

So this is what I did with your suggestion....



$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "history");

$l_history['field'] = '';
while ($l_history = $db->fetch_array($result)){
$history['datefield','field1','field2','field3','field4','f ield5','field6'] .= $l_history['datefield','field1','field2','field3','field4','f ield5','field6'];
}


with the variable registered as stated.


But this doesnt work nicely with sql.

My apologies for being not so sql inclined, and I dont wish to burdon you with 'teaching' me how to make this work, but I am not so skilled at database manipulation.
(I am hoping to learn how to make this work so I wont be such a bother in the future)

--------------- Added 1381977398 at 1381977398 ---------------

I have decided I am going to do a crash course on sql. I need to be able to do more than hope someone here can hold my hand making something that would otherwise add several pages in this thread. The above responces have indeed helped me, but what I am trying to create is going to be propietary to my website, and I am stumped on just the first section of it out of several. It is my responsibility to educate myself so my questions remain more attached to the subject.

Lynne, you have been a great help especially with this tutorial.
This is in fact an amazing addition to anyone that wishes to do custom pages using templates, php, etc, on a forum setup.

Thanks again.

stevectaylor
10-19-2013, 03:25 PM
Did you try just adding them into the template after the headininclude template is called?

<meta name="keywords" content="xxxx" />
<meta name="description" content="yyyy" />

and then change the condition in the headinclude template to not show those for your page:
<vb:if condition="$show['threadinfo'] OR Your Condition">

<vb:elseif condition="$show['foruminfo']" />
other stuff....
<meta name="keywords" content="{vb:raw vboptions.keywords}" />
<meta name="description" content="{vb:raw vboptions.description}" />
</vb:if>

Hi Lynn,

A little stuck on this?

--------------- Added 1382201159 at 1382201159 ---------------

And if just by a little fairy dust of posting that if came too me what I did wrong. lol

MacroPhotoPro
10-20-2013, 01:30 PM
Hello;

I am creating an image-hosting website for which I require custom pages. This page serves the purpose, but I notice that it does not automatically re-size like the other vBulletin pages (see attached).

For example, my main desktop monitor has 1920 screen resolution, whereas the ancient laptop I am on right now only has 1024 screen resolution.

When I view the vBulletin forum on the smaller screen, everything is automatically re-sized so that it fits my 1024 resolution screen. (it even gets re-sized to fit my smartphone screen.

However, my custom page does NOT automatically re-size, and so the excess images/text kind of "spills over" to the right (again see attachments for a comparison).

So my question is, how do I construct my custom pages so that they too automatically re-size to fit smaller screens?

Thanks for any help,

Jack

cellarius
10-20-2013, 03:19 PM
My guess: Do you use a mobile style? If that is the case, you need to have a fitting template for your cutom page in your mobile style.

MacroPhotoPro
10-20-2013, 04:13 PM
My guess: Do you use a mobile style? If that is the case, you need to have a fitting template for your cutom page in your mobile style.

Thank you for answering, but it has nothing to do with the mobile style. It has to do with some kind of auto-resolving I think.

For example, there is no mobile style being used when I click the forum tab, yet the forum.php page automatically resolves to fit the resolution of my smaller screen ... yet this same thing does not happen when I click my ImageHosting tab and get my imagehosting.php page.

In no case have I employed my mobile style. I have used my own customized style, yet some kind of coding is in my forum.php page that is not in my custom php page, and that "something" is what I am inquiring about :)

Thanks again,

Jack

Digital Jedi
10-20-2013, 04:47 PM
Hello;

I am creating an image-hosting website for which I require custom pages. This page serves the purpose, but I notice that it does not automatically re-size like the other vBulletin pages (see attached).

For example, my main desktop monitor has 1920 screen resolution, whereas the ancient laptop I am on right now only has 1024 screen resolution.

When I view the vBulletin forum on the smaller screen, everything is automatically re-sized so that it fits my 1024 resolution screen. (it even gets re-sized to fit my smartphone screen.

However, my custom page does NOT automatically re-size, and so the excess images/text kind of "spills over" to the right (again see attachments for a comparison).

So my question is, how do I construct my custom pages so that they too automatically re-size to fit smaller screens?

Thanks for any help,

Jack
What is the width parameters set for the large image displayed in the photo pages? Do you have a max-width set, because that seems to be what's pushing the images off screen.

MacroPhotoPro
10-20-2013, 04:56 PM
What is the width parameters set for the large image displayed in the photo pages? Do you have a max-width set, because that seems to be what's pushing the images off screen.


I don't know. Possibly, yes. We have different-sized thumbnails: tiny, small, medium, large, jumbo (150 px, 400 px, 800 px, 1200 px, and 2500 px).

I just use the template, and so maybe there can be some kind of "flexible" coding employed that adjusts???

Thank you.

Lynne
10-20-2013, 05:28 PM
I don't know. Possibly, yes. We have different-sized thumbnails: tiny, small, medium, large, jumbo (150 px, 400 px, 800 px, 1200 px, and 2500 px).

I just use the template, and so maybe there can be some kind of "flexible" coding employed that adjusts???

Thank you.
If you want images to automatically resize when you change the browser size, then you need to write some CSS to have it do this. The only way we can help with that is if you post a link to the custom page with the images on it.

Rudiere
10-23-2013, 10:45 PM
You can't use echo or it will end up on the top of the page. You need to take your data and output it to a variable:

$myvar = '';
start of loop
$myvar .= "html here";
end of loop
make sure to register $myvar for use in your template

and in the template, put
{vb:raw myvar}

Where do I put this code?

To perform within the models.

Lynne
10-24-2013, 01:32 AM
Where do I put this code?

To perform within the models.
The top is php code, so it goes into your php file. The bottom is template code so it goes into your template. But that was in answer to a question and isn't going to help you much unless you understood the original question and what was going on.

MacroPhotoPro
11-09-2013, 05:30 PM
One of the things I noticed on this "custom page" is that photographs which are put on the page do NOT display on Facebook ... whereas they DO display on default vBulletin pages.

For example, if I have a photo on a Forum post, or a Blog Post, or an Article post ... and if I place the URL to that post/article on Facebook ... I get a choice of photo thumbnails to choose from, to associate on Facebook, which includes the photos that I want displayed.

But that does not work for this custom page here. When I post the URL of any page I create with this template on FB, my choice of thumbnails only shows the vBulletin Logo or my Avatar ... any photos I post are not available. What do I have to do to change this?

When I have a photo on this custom page, and if I post the URL to it, I want my photos to be among the thumbnail choices I have.

How can I accomplish this?

Thanks,

Digital Jedi
11-10-2013, 01:38 AM
That would be outside the scope of the article, since that's a Facebook thing. You would need to look at their documentation or articles such as this one (http://cypressnorth.com/social-network-media-marketing/how-to-customize-preview-thumbnail-images-for-pages-on-your-website/) for what you need to do control how thumbnails show up.

MacroPhotoPro
11-10-2013, 11:13 PM
That would be outside the scope of the article, since that's a Facebook thing. You would need to look at their documentation or articles such as this one (http://cypressnorth.com/social-network-media-marketing/how-to-customize-preview-thumbnail-images-for-pages-on-your-website/) for what you need to do control how thumbnails show up.

Thank you.

Rudiere
11-10-2013, 11:50 PM
So how do I pull a php file in the models. Why can not I use php code.

Morrus
11-14-2013, 02:07 AM
First, thanks for the tutorial!

OK, this is probably a really silly question.

My template isn't fully parsing HTML. The test is fine, and a href links are fine. But line breaks and bullet points are being ignored.

Here's an example:

http://www.enworld.org/forum/features.php?styleid=14

It's ignring all the <ul>s and the <li>s. Any idea why that might be?

Lynne
11-14-2013, 02:48 AM
It's ignring all the <ul>s and the <li>s. Any idea why that might be?
Try a search in the thread because this has been covered several times already. :)

Morrus
11-14-2013, 10:16 AM
Try a search in the thread because this has been covered several times already. :)

The word "bullet" shows up in the search just once, and somewhat briefly ending with "but this goes outside the scope of this article".

--------------- Added 1384439034 at 1384439034 ---------------

OK, so a search for "HTML" gives a lot of results. The closest I can find is where yous ay to ad the following "to the custom CSS for your page". What does "the custom CSS for your page" mean? The only CSS stuff I'm familiar with is a bunch of CSS templates and a Main CSS editor thing. Where do I put the custom CSS for my page?

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


Plus, presumably, that's only one HTML thing? So to use HTML you need to pretty much code every HTML tag from scratch? Seems to rather defeat the point of an easy method of using HTML to create a custom page!

--------------- Added 1384452204 at 1384452204 ---------------

It's just occurred to me that I can accomplish the same effect with a CMS article in its own section. I'm not sure why that didn't occur to me before.

Digital Jedi
11-14-2013, 07:15 PM
The word "bullet" shows up in the search just once, and somewhat briefly ending with "but this goes outside the scope of this article".

--------------- Added 1384439034 at 1384439034 ---------------

OK, so a search for "HTML" gives a lot of results. The closest I can find is where yous ay to ad the following "to the custom CSS for your page". What does "the custom CSS for your page" mean? The only CSS stuff I'm familiar with is a bunch of CSS templates and a Main CSS editor thing. Where do I put the custom CSS for my page?



Plus, presumably, that's only one HTML thing? So to use HTML you need to pretty much code every HTML tag from scratch? Seems to rather defeat the point of an easy method of using HTML to create a custom page!

--------------- Added 1384452204 at 1384452204 ---------------

It's just occurred to me that I can accomplish the same effect with a CMS article in its own section. I'm not sure why that didn't occur to me before.
You would search for "list" rather. But yes, you need CSS defined for your lists in this area in order for the lists to work properly. If you decide to go that route, just take a look at W3Schools for some quick tutorials.

Morrus
11-15-2013, 10:12 AM
You would search for "list" rather. But yes, you need CSS defined for your lists in this area in order for the lists to work properly. If you decide to go that route, just take a look at W3Schools for some quick tutorials.

I know how to write basic CSS elements; it's not CSS that's my problem, it's vbulletin. What I don't know is where "to the custom CSS for your page" is. Does that mean creating a new CSS template specially for the new page? Adding CSS elements to an existing template such as additional.css? Somewhere else entirely?

I've poked around, and while there are CSS templates for *some* pages, named xxxx.css in the styles/template manager, there obviously isn't one for the new page unless I create it myself. Plus there's a whole "Main CSS" option in the style manager.

That all said, I just went with the article approach in the end. It looks pretty tidy if you strip away a lot of the surrounding stuff.

Lynne
11-15-2013, 07:08 PM
Just add your custom CSS for that page to the template for the page.

Morrus
11-17-2013, 12:09 AM
Just add your custom CSS for that page to the template for the page.

Oh, just right on the page template itself? That's simple enough. Thanks - I'll remember that for the future!

mort2412
11-27-2013, 09:11 PM
How would I go about adding an external web link to appear in the page, similar to how panjo appears

thanks

BBNZowner
12-23-2013, 11:08 PM
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.

usHealthy
02-05-2014, 04:54 AM
Will love to see this working on v5

FelipeB
02-26-2014, 06:01 PM
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...


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



and my tempate...
{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 class="blockbody">
<div class="blockrow">
TEST
</div>
</div>

{vb:raw footer}

</body>
</html>

Eq4bits
02-26-2014, 06:31 PM
you need to set an 'include' phrase that 'points' to the location of your css file

FelipeB
02-26-2014, 06:42 PM
Could you show me?? As I say, I'm new on this, and don't have idea where is the CSS of Vbulletin...

MacroPhotoPro
02-28-2014, 11:54 PM
That would be outside the scope of the article, since that's a Facebook thing. You would need to look at their documentation or articles such as this one (http://cypressnorth.com/social-network-media-marketing/how-to-customize-preview-thumbnail-images-for-pages-on-your-website/) for what you need to do control how thumbnails show up.


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.


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

A pic of what happens when I click the Facebook button is shown in the attached Pic (notice that other metatags are also being completely ignored.)

This is the picture that SHOULD be appearing on the Share:

http://www.macrophotopro.com/thumbnails/1/1_thumb_0000000548_tiny.jpg

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!

Lynne
03-01-2014, 05:07 PM
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.

MacroPhotoPro
03-01-2014, 09:48 PM
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.

Hi Lynne;

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

MacroPhotoPro
03-03-2014, 04:29 PM
Hello ...

Lynne
03-03-2014, 06:28 PM
I really don't know enough about Facebook and their code to help out on this.

MacroPhotoPro
03-06-2014, 11:34 AM
I really don't know enough about Facebook and their code to help out on this.

Really? You're one of the top people at vBulletin and you "can't help" with Facebook?

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.

tbworld
03-06-2014, 11:54 AM
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. :)

ozzy47
03-06-2014, 12:01 PM
Your negative reply to Lynne is not an inviting message to receive assistance from others. Who needs this kind of abuse when we are already volunteering our time. If you would like help please be nice. :)

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. :)

tbworld
03-06-2014, 12:08 PM
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.

MacroPhotoPro
03-06-2014, 12:12 PM
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. :)

Fair enough then.

ozzy47
03-06-2014, 12:18 PM
Fair enough then.

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. :p

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. :)

MacroPhotoPro
03-06-2014, 12:18 PM
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.

I would appreciate this greatly.

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 1394112600 at 1394112600 ---------------

Here is an example of one of our Image pages:

http://www.macrophotopro.com/advertisements/share.jpg

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:

http://www.macrophotopro.com/advertisements/failedshare.jpg
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:

http://www.macrophotopro.com/advertisements/blogsucceed.jpg
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:


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

It is as if all the "meta" tags on this custom page are being completely ignored by something inside vBulletin. Yet somehow they are able to get through on the forum and blog postings. I tried to follow the FB Developer instructions, and it simply doesn't work. I believe this is beyond a FB problem, it's a problem intrinsic to some omission in this vBulletin custom page, and it's driving me nuts.

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 1394112849 at 1394112849 ---------------

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. :p

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. :)

Thank you.

tbworld
03-06-2014, 12:40 PM
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.

MacroPhotoPro
03-06-2014, 01:09 PM
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.

Okay, thank you. Let me know.

Cheers,

rupak
03-13-2014, 06:44 AM
How to create new post page

ozzy47
03-13-2014, 10:30 AM
You need to explain a bit more detail what it is you want to do.

Lynne
03-13-2014, 06:57 PM
How to create new post page
This is a tutorial on how to create the new page. The coding for what the page actual does is up to you. There is nothing in this tutorial to help you with actually coding your page.

AndyBaines
04-20-2014, 09:43 AM
I've got this "How-To" sussed completely fine from your instructions so thank you very much, but I'm having an issue with Twitch.tv chat embedding that I cannot find anywhere else...

I can embed the video section no issue, but the chat window just doesn't seem to load, I tried loads of things last night to no avail, this morning remoted into work and tested with both IE and Firefox which led the issue to only appear on IE.

<object type="application/x-shockwave-flash" height="378" width="620" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=videogamertv" bgcolor="#000000"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /><param name="flashvars" value="hostname=www.twitch.tv&channel=videogamertv&auto_play=true&start_volume=25" /></object>

The above video embed works fine.

<iframe frameborder="0" scrolling="no" src="http://twitch.tv/videogamertv/chat?popout=" height="500" width="350"></iframe>

The above chat window does not, nothing loads and if I change the frameborder to 1 then I get the frame.

I don't own that channel and see chat embedded on various sites using the same code but I am not having any luck.

Any suggestions or tips would be greatly appreciated.

Thank you

Andy :)

--------------- Added 1397990875 at 1397990875 ---------------

I grabbed the chat HTML code over into Dreamweaver and previewed it in my browser from my local machine, the chat box loaded fine, that's the reason I've posted here before posting on the Twitch support site, it looks like it may be vBulletin related and from what I've seen there are a lot of knowledgeable people on this site..!

Enough compliments..? ;)

--------------- Added 1397991195 at 1397991195 ---------------

One last thing to note, I've just uploaded the HTML page to the host and gone to the page, chat loaded fine.

Just enabled html on a forum, check the embed code in a forum post and the chat didn't load, looks like it's not related to this custom page. /doh

K4GAP
08-15-2014, 09:54 PM
Is your tutorial current to use with 4.2.2 ?

ozzy47
08-15-2014, 09:57 PM
Yes it will still work. :)

K4GAP
08-15-2014, 10:22 PM
So, you know how? :)

Lynne
08-15-2014, 10:32 PM
So, you know how? :)
I have a test.php page (made using this method) on my test site and it still works in 4.2.2.

ozzy47
08-15-2014, 10:41 PM
So, you know how? :)

Because I use it quite often. :p

K4GAP
08-15-2014, 10:43 PM
Because I use it quite often. :p

So it's a whiz to do? :)

ozzy47
08-15-2014, 10:59 PM
Yeah if you follow the instructions, it is a breeze.

K4GAP
08-15-2014, 11:07 PM
What template does this refer too?

"- Open up test.php and add the following (replace TEST with whatever template you want to show - WARNING: the template name is CASE SENSITIVE!!!):"

ozzy47
08-15-2014, 11:23 PM
That would be the template you are going to use to display the new page.

Sarab
08-29-2014, 10:54 PM
Hello,

Why who is online showing now unknown page? even for my mods it seems, is there something should be changed?

K4GAP
08-29-2014, 11:33 PM
That would be the template you are going to use to display the new page.

And that template would be ... ?

tbworld
08-30-2014, 12:34 AM
Hello,

Why who is online showing now unknown page? even for my mods it seems, is there something should be changed?

If this is your own vbulletin page, did you generate the hook code for your WOL? Go back to the original article and re-read the section "Instructions to Add your Page to the Who's Online List (WOL)". :)

Sarab
08-30-2014, 12:41 AM
If this is your own vbulletin page, did you generate the hook code for your WOL? Go back to the original article and re-read the section "Instructions to Add your Page to the Who's Online List (WOL)". :)

Yup, and I did, it was working perfectly but suddenly it stop working, and I think upgrading vbulletin have something to do with it, did the code changed?

tbworld
08-30-2014, 12:44 AM
What template does this refer too?

"- Open up test.php and add the following (replace TEST with whatever template you want to show - WARNING: the template name is CASE SENSITIVE!!!):"

If you have not created a template, create a new template name it "TEST". Make the template simple just to get it working.


<!-- template: TEST -->
<div>
<div>My first template!<div><br />
My variable: {vb:raw myfirstvar}
</div>
The name of this template is case sensitive and must match the name you inserted in the PHP code. In this case "TEST". :)

Lynne
08-30-2014, 12:51 AM
Yup, and I did, it was working perfectly but suddenly it stop working, and I think upgrading vbulletin have something to do with it, did the code changed?
What version did you upgrade from and to? And are their errors in your error_logs (if you don't know where they are, ask your host)? And, what is the *exact* code you put into the plugins for the WOL online plugin? And, what is the link to the custom page?

tbworld
08-30-2014, 12:52 AM
Yup, and I did, it was working perfectly but suddenly it stop working, and I think upgrading vbulletin have something to do with it, did the code changed?

I would have to know what version you were running and what version you upgraded to. What version of PHP are you now using? :)

Sarab
08-31-2014, 02:26 AM
What version did you upgrade from and to? And are their errors in your error_logs (if you don't know where they are, ask your host)? And, what is the *exact* code you put into the plugins for the WOL online plugin? And, what is the link to the custom page?
Wow it seems it's just a problem I have xD
*a year thinking it's a change in vbulletin ="D*
I think the problem raised when I upgraded from 4.1.x to 4.2.1 (my current version )
the error log contain this:

[30-Aug-2014 00:25:38 UTC] PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /????/????/public_html/forum/includes/functions_digest.php(260) : eval()'d code on line 5
[30-Aug-2014 00:25:38 UTC] PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /????/????/public_html/forum/includes/functions_digest.php(260) : eval()'d code on line 5
[30-Aug-2014 00:25:38 UTC] PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /????/????/public_html/forum/includes/functions_digest.php(260) : eval()'d code on line 5
[30-Aug-2014 00:25:38 UTC] PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ']' in /????/????/public_html/forum/includes/functions_digest.php(260) : eval()'d code on line 5
[30-Aug-2014 00:46:14 UTC] die 4 false
[30-Aug-2014 00:56:18 UTC] die 4 false
[30-Aug-2014 00:58:53 UTC] PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 122880 bytes) in /????/????/public_html/forum/includes/functions.php(1939) : eval()'d code on line 60
[30-Aug-2014 01:37:55 UTC] die 4 false
[30-Aug-2014 01:54:07 UTC] die 4 false
[30-Aug-2014 02:55:33 UTC] die 4 false
[30-Aug-2014 04:20:47 UTC] die 4 false
[30-Aug-2014 06:57:53 UTC] die 4 true
[30-Aug-2014 07:24:25 UTC] die 4 false
[30-Aug-2014 07:24:26 UTC] die 4 false
[30-Aug-2014 08:16:48 UTC] PHP Fatal error: Call to undefined method vB_Friendly_Url_Error::get_uri() in /????/????/public_html/forum/includes/init.php on line 358
[30-Aug-2014 09:35:16 UTC] die 4 false
[30-Aug-2014 10:06:08 UTC] die 4 true
[30-Aug-2014 10:06:09 UTC] die 4 true
[30-Aug-2014 10:06:09 UTC] die 4 true
[30-Aug-2014 10:06:09 UTC] die 4 true
[30-Aug-2014 10:06:10 UTC] die 4 true
[30-Aug-2014 10:06:10 UTC] die 4 true
[30-Aug-2014 10:06:10 UTC] die 4 true
[30-Aug-2014 10:34:00 UTC] die 4 false
[30-Aug-2014 10:35:39 UTC] die 4 false
[30-Aug-2014 10:37:12 UTC] die 4 true
[30-Aug-2014 12:11:03 UTC] die 4 false
[30-Aug-2014 12:39:17 UTC] die 4 false
[30-Aug-2014 12:39:17 UTC] die 4 false
[30-Aug-2014 14:30:35 UTC] die 4 false
[30-Aug-2014 14:30:35 UTC] die 4 false
[30-Aug-2014 16:11:53 UTC] die 4 false
[30-Aug-2014 16:11:53 UTC] die 4 false
[30-Aug-2014 16:11:53 UTC] die 4 false
[30-Aug-2014 17:08:35 UTC] die 4 false
[30-Aug-2014 17:26:19 UTC] die 4 false
[30-Aug-2014 17:26:19 UTC] die 4 false
[30-Aug-2014 17:26:21 UTC] die 4 false
[30-Aug-2014 17:26:21 UTC] die 4 false
[30-Aug-2014 18:20:12 UTC] die 4 true
[30-Aug-2014 18:35:50 UTC] die 4 false
[30-Aug-2014 18:35:51 UTC] die 4 false
[30-Aug-2014 18:38:58 UTC] die 4 false
[30-Aug-2014 18:39:01 UTC] die 4 false
[30-Aug-2014 18:39:30 UTC] die 4 false
[30-Aug-2014 18:39:30 UTC] die 4 false
[30-Aug-2014 18:39:38 UTC] die 4 false
[30-Aug-2014 18:39:38 UTC] die 4 false
[30-Aug-2014 18:39:47 UTC] die 4 false
[30-Aug-2014 18:39:47 UTC] die 4 false
[30-Aug-2014 18:39:57 UTC] die 4 true
[30-Aug-2014 18:40:42 UTC] die 4 false
[30-Aug-2014 18:40:42 UTC] die 4 false
[30-Aug-2014 18:41:07 UTC] die 4 false
[30-Aug-2014 18:41:07 UTC] die 4 false
[30-Aug-2014 18:41:21 UTC] die 4 true
[30-Aug-2014 18:42:17 UTC] die 4 false
[30-Aug-2014 18:42:17 UTC] die 4 false
[30-Aug-2014 18:42:34 UTC] die 4 false
[30-Aug-2014 18:42:34 UTC] die 4 false
[30-Aug-2014 18:42:45 UTC] die 4 false
[30-Aug-2014 18:42:46 UTC] die 4 false
[30-Aug-2014 18:44:31 UTC] die 4 false
[30-Aug-2014 18:44:31 UTC] die 4 false
[30-Aug-2014 18:44:40 UTC] die 4 false
[30-Aug-2014 18:44:40 UTC] die 4 false
[30-Aug-2014 18:44:55 UTC] die 4 false
[30-Aug-2014 18:44:56 UTC] die 4 false
[30-Aug-2014 18:45:11 UTC] die 4 false
[30-Aug-2014 18:45:12 UTC] die 4 false
[30-Aug-2014 18:45:15 UTC] die 4 false
[30-Aug-2014 18:46:34 UTC] die 4 false
[30-Aug-2014 18:46:36 UTC] die 4 false
[30-Aug-2014 18:46:45 UTC] die 4 false
[30-Aug-2014 18:46:46 UTC] die 4 false
[30-Aug-2014 18:47:02 UTC] die 4 false
[30-Aug-2014 18:47:02 UTC] die 4 false
[30-Aug-2014 18:47:10 UTC] die 4 false
[30-Aug-2014 18:47:10 UTC] die 4 false
[30-Aug-2014 18:47:23 UTC] die 4 false
[30-Aug-2014 18:47:23 UTC] die 4 false
[30-Aug-2014 19:55:07 UTC] PHP Fatal error: Cannot redeclare construct_depth_mark() (previously declared in /????/????/public_html/forum/awards.php:98) in /????/????/public_html/forum/includes/adminfunctions.php on line 1922

the code for wol I put is:

switch ($filename)
{
case 'PhantomGroup.php':
$userinfo['activity'] = 'آل فانتوم';
break;
// add more cases here if you have more than one custom page. no need for multiple plugins. one plugin can handle all.
}


switch ($userinfo['activity'])
{
case 'فريق فانتوم':
$userinfo['where'] = '<a href="PhantomGroup.php?'.$vbulletin->session->vars[sessionurl].'">فريق فانتوم</a>';
$userinfo['action'] = "يشاهد صفحة آل فانتوم";
$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 url to the page:
http://www.alphantom.com/forum/PhantomGroup.php

it seems the problem is picky, where some pages show fine and some not, like here:
https://vborg.vbsupport.ru/external/2014/08/2.png

I would have to know what version you were running and what version you upgraded to. What version of PHP are you now using? :)

from 4.1.x to 4.2.1, and the php version is: 5.3.27 =D

Sarab
09-06-2014, 05:40 AM
="D no fix =")?

Mark.B
09-06-2014, 08:45 AM
The code for adding custom who's online entries has not changed at all.

My suspicion is that your issue may be related to the URLs people are actually using...why is there a trailing slash (/) after .php in your URLs?

index.php/ will report differently to index.php and thus may not be picked up by the custom WOL code you've entered.

doctorsexy
09-08-2014, 11:52 AM
Thank for this Lynne.. really easy to follow the instructions...

addamroy
11-01-2014, 01:09 PM
This does not work correctly on mobile devices. :(

I couldn't figure out why my custom pages wouldn't load on my smart phone and would only work on a computer.

Once I turned off the designated style for mobile users via the vbulletin style settings, the pages load. But now I am unable to automatically assign the mobile style for mobile users which is a problem.

Is there a workaround for this lynne?

Either to turn off the mobile style for custom pages, or re-work the code so the custom pages are either mobile friendly, or load with a non-mobile style by default?

Essentially i get a blank white page if I visit one of these custom pages with a smart phone - Unless I DO NOT assign the mobile style to mobile users via the style settings in admincp.

cellarius
11-01-2014, 01:24 PM
You did add your custom template to the mobile style, too, did you?

addamroy
11-01-2014, 02:21 PM
You did add your custom template to the mobile style, too, did you?

lmfao. No, I didn't.

That fixed the problem. (smacks forehead)

Thanks!

DoubleYou
01-28-2015, 10:26 AM
I am probably beeing extra dumb today, but I think I followed the instructions carefully. My template is called static and my page is called 404.php. Uploaded it to the directory of the vbulletin installation and get the following when I try to open the page:

'404 Seite')); $navbar = render_navbar_template($navbits); // ###### YOUR CUSTOM CODE
GOES HERE ##### $pagetitle = '404 Fehlerseite'; // ###### NOW YOUR TEMPLATE IS BEING RENDERED
###### $templater = vB_Template::create('static'); $templater->register_page_templates();
$templater->register('navbar', $navbar); $templater->register('pagetitle', $pagetitle);
print_output($templater->render()); ?>

Any hints are greatly appreciated.

Dave
01-28-2015, 11:05 AM
@DoubleYou, you literally see the PHP code on the screen? That means you forgot to put the code after a <?php tag.

DoubleYou
01-28-2015, 11:27 AM
yes however not all of it. here is the code of the 404.php


<?php

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

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

define('THIS_SCRIPT', '404');
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('static',
);

// 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('' => '404 Seite'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = '404 Fehlerseite';

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

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

?>

Lynne
01-28-2015, 10:26 PM
And what is in the template?

DoubleYou
01-29-2015, 07:32 AM
{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>

Lynne
01-29-2015, 06:20 PM
Hmmm, nothing really wrong there.

It seems to not like this line:
$navbits = construct_navbits(array('' => '404 Seite'));

Try retyping it and see if that may help. (Even remove it for a sec, which will break things, but see what happens.)

Yogesh Sarkar
02-24-2015, 10:21 AM
Hello Lynne. What code do we need to add to the custom page to make it a login page for users? Currently users cannot directly access the login page.

Lynne
02-24-2015, 05:58 PM
I do not have the code to create a login page. You would need to make your template have a login form. You would need to create that yourself.

Duckface
04-23-2015, 11:58 AM
How would you add php within the template?

Because I have the following and it's not working:

<form action=" <?php echo basename($_SERVER['PHP_SELF']); ?>" method="POST">

https://vborg.vbsupport.ru/external/2015/04/7.png

Lynne
04-23-2015, 09:29 PM
You add php to the .php page. You cannot enter php into a template.

friendlymela
07-21-2015, 03:32 PM
i want to make a different kind of home page someone help me?

Colossal31
09-24-2015, 08:06 PM
Does anyone know how I could make this a memberlist page that shows just one usergroup?

Dave
09-24-2015, 08:18 PM
Does anyone know how I could make this a memberlist page that shows just one usergroup?

You could simply copy the "showgroups.php" script for this and make some modifications to it so it only shows the usergroup you want to display:
- Removing the $groupcache/$modcache functionality.
- Select the right usergroupid's.

If however your usergroup contains a lot of members, you should copy the memberlist.php script and make your modifications to it.
Or just simply hook into memberlist_fetch its $hook_query_where variable and make sure it only selects specific usergroup's based on a GET variable.

Colossal31
09-24-2015, 08:29 PM
You could simply copy the "showgroups.php" script for this and make some modifications to it so it only shows the usergroup you want to display:
- Removing the $groupcache/$modcache functionality.
- Select the right usergroupid's.

If however your usergroup contains a lot of members, you should copy the memberlist.php script and make your modifications to it.
Or just simply hook into memberlist_fetch its $hook_query_where variable and make sure it only selects specific usergroup's based on a GET variable.

Ok so how would I identify the specific usergroups. I am not the strongest at this I am learning as I go. SO any help would be appreciated. Thanks.

Lynne
09-25-2015, 02:55 PM
Ok so how would I identify the specific usergroups. I am not the strongest at this I am learning as I go. SO any help would be appreciated. Thanks.
If you look at admincp > Usergroups > Usergroup Manager, then you will see the usergroupid in the dropdown next to the usergroup name.

Colossal31
09-27-2015, 07:11 PM
If you look at admincp > Usergroups > Usergroup Manager, then you will see the usergroupid in the dropdown next to the usergroup name.

What I am meaning is in the code how do I identify the usergroup I wanna display? Like what do I need to change to show just that one usergroup.

I.G.O.T.A.
10-21-2015, 10:56 AM
If I wanted to add a custom description and keywords would I add that to the your custom code goes here?

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Test Page';
<meta name="description" content="Testing page" />
<meta name="keywords" content="testing, page," />

Lynne
10-21-2015, 04:53 PM
If I wanted to add a custom description and keywords would I add that to the your custom code goes here?

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Test Page';
<meta name="description" content="Testing page" />
<meta name="keywords" content="testing, page," />
You would just add it to the template you are creating for the page.

I.G.O.T.A.
10-21-2015, 08:06 PM
You would just add it to the template you are creating for the page.

Ok when I added it to the template I now have two meta descriptions and tags. How do I override the vB one that is pulling from the database?

Lynne
10-21-2015, 08:50 PM
You would need to put some sort of condition around the 'other' tags so that they won't show on your custom page.

I.G.O.T.A.
10-21-2015, 09:05 PM
Can you point me in the right direction? I don't even know what to do first, lol.

Thank you.

Lynne
10-22-2015, 12:18 AM
Can you point me in the right direction? I don't even know what to do first, lol.

Thank you.
user the variable THIS_SCRIPT which you define at the top of your custom page.

<vb:if condition="THIS_SCRIPT != 'yourscript'">
meta tag stuff here in global template (header?)
</vb:if>

I.G.O.T.A.
10-22-2015, 08:57 AM
user the variable THIS_SCRIPT which you define at the top of your custom page.

<vb:if condition="THIS_SCRIPT != 'yourscript'">
meta tag stuff here in global template (header?)
</vb:if>

So would it look like this?

<vb:if condition="custom_page != 'custom 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>test</title>
<meta charset="UTF-8">
<meta name="description" content="test">
<meta name="keywords" content="test">
<meta name="author" content="I.G.O.T.A.?">
</vb:if>

Lynne
10-22-2015, 09:23 PM
THIS_SCRIPT is the actual variable name, so...

<vb:if condition="THIS_SCRIPT != 'custom page'">

You would get that from this area in your php page:

define('THIS_SCRIPT', 'test');

Replace 'custom page' with whatever you set that variable to in your php (in the above example, it would be 'test').

I.G.O.T.A.
10-22-2015, 09:53 PM
I did that and now for some reason getting this. It looks like all tags are closed, but obviously I'm missing one, lol.

The following error occurred when attempting to evaluate this template:
Unclosed Tag
This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

Lynne
10-23-2015, 12:09 AM
I didn't look closely at the code, but you only want the tags around the specific code you are adding to your page and don't want doubled.


<vb:if condition="THIS_SCRIPT != 'custom page'">
<meta name="description" content="test">
<meta name="keywords" content="test">
<meta name="author" content="I.G.O.T.A.?">
</vb:if>

Alice
12-12-2015, 03:15 PM
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.

Okay so I checked the css template and I found that the tags: UL, OL, LI; which are necessary for coding bullet points onto the page, are already there and properly defined, and yet, this page still will not show the properly formatting of bullet points. I have included the exact code that is present in my reset-fonts.css template below.

I would appreciate any support that you are able to provide.

Thank you,

/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.7.0
*/
html{color:#000;background:#FFF;}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{m argin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption, cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align: {vb:stylevar left};}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,a cronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#fff;}input,button,te xtarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;}body{font:13px/1.231 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}select,input,button,textarea,button{font:99 % arial,helvetica,clean,sans-serif;}table{font-size:inherit;font:100%;}pre,code,kbd,samp,tt{font-family:monospace;*font-size:108%;line-height:100%;}

Dragonsys
12-12-2015, 04:14 PM
Okay so I checked the css template and I found that the tags: UL, OL, LI; which are necessary for coding bullet points onto the page, are already there and properly defined, and yet, this page still will not show the properly formatting of bullet points. I have included the exact code that is present in my reset-fonts.css template below.

I would appreciate any support that you are able to provide.

Thank you,



For your list, create a custom class and use it to define the bullets

sr20de_99
05-11-2016, 11:51 AM
Should the samples listed in the first post work for a custom page when people aren't logged in?

Based on what was in the first post I've created the following, which seems to only work if I'm logged in. I need to setup a custom public page for people to sign up for various events.

ACME_CUSTOM_PAGE_TEMPLATE

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

<h2 id="acme_bannerTitle"class="blockhead">{vb:raw bannerTitle}</h2>
<div class="blockbody">
<div class="blockrow">
<div id="acmeContents">
{vb:raw my_var}
</div>
</div>
</div>

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


acme_vbPublic.php (This is the file that my vBulletin "Public" Tab points to.)

<?php
$tabScriptName = 'PublicTabScript';
$pagetitle = 'ACME Public ($pagetitle)';
$phpFile = './acme_custom/acme_public.php';
$navTitle = 'Public Tab';
$bannerTitle = 'Public Page Example';

require_once($_SERVER['DOCUMENT_ROOT'] . "/acme_custom/acme_vb.php");
?>


acme_vb.php

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', $tabScriptName);
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('ACME_CUSTOM_PAGE_TEMPLATE');

// 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');
chdir($_SERVER['DOCUMENT_ROOT']);
require_once('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################
$navbits = construct_navbits(array('' => $navTitle));
$navbar = render_navbar_template($navbits);

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

<?php

ob_start();
include($phpFile);
$includedphp = ob_get_contents();
ob_end_clean();

$my_var .= $includedphp;

$templater = vB_Template::create('ACME_CUSTOM_PAGE_TEMPLATE');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('bannerTitle', $bannerTitle);
$templater->register('my_var', $my_var);
print_output($templater->render());
?>


acme_public.php

<div>
This is my public page.
</div>


Navigation Tab Setup
https://vborg.vbsupport.ru/external/2016/05/22.png

Dave
05-11-2016, 01:10 PM
Based on the code you posted, I don't see anything out of the ordinary that should cause such thing to happen.

sr20de_99
05-11-2016, 01:31 PM
ARGH!!!

Nothing to see here, move along. I figured it out. My template is currently only applied to one style. When I'm not logged in and visit the page, the style where my template is not selected. When I select the style then click on my "Public" tab, then everything works.

MarkFL
05-11-2016, 01:34 PM
ARGH!!!

Nothing to see here, move along. I figured it out. My template is currently only applied to one style. When I'm not logged in and visit the page, the style where my template is not selected. When I select the style then click on my "Public" tab, then everything works.

Put your site into debug mode, and then add the template to the "Master Style" so it will be auto-added to every style. :)

sr20de_99
06-02-2016, 07:38 PM
OK I'm back again. Everything seems to work fine for me on my local machine, but I ran into 404 errors when trying my code on my live site.

On my live site vBulletin is loaded directly under httpdocs folder. I have placed all of my code under httpdocs/acme_custom. When I load the page all of the styling is off, and upon further investigation I have a bunch of 404 errors, and none of the standard vBulletin links like Forum or Contact Us work. If I place my custom php file (acme_vbPublic.php) in httpdocs then everything works.

I performed a chgdir prior to the globl.php, so I'm not sure where I've gone wrong.

chdir($_SERVER['DOCUMENT_ROOT']);
require_once('./global.php');


Here's a screen shot of the page and the errors:
https://vborg.vbsupport.ru/external/2016/06/9.png

If I inspect the 404 errors, the request url is http://my-site.ca/acme_custom/clientscript/yui/yuiloader-dom-event/yuiloader-dom-event.js?v=423

I do not reference any of those resources that have 404 errors, I'm assuming that they are part of the global.php script.

Any clues? I'd prefer to keep all of my code under the acme_custom directory.

sr20de_99
06-04-2016, 08:50 AM
I might have figured it out. Under the Admin CP -> Settings -> Site Name / URL / Contact Details

I had the following:
URL of your forum: http://mySite.ca
Always use Forum URL as Base Path: No

Chaging the Always use Forum URL as Base Path to Yes seemed to do the trick. Does that seem right?

netzoner
06-18-2016, 06:53 AM
thanks
i will tray it

kerrghann
07-28-2016, 01:06 PM
So I'm having a bit of trouble finding this anywhere.

Is there a way to make it so that my custom page is only view-able by a specific usergroup?

Dave
07-28-2016, 01:39 PM
So I'm having a bit of trouble finding this anywhere.

Is there a way to make it so that my custom page is only view-able by a specific usergroup?

If you're not that familiar with PHP, just add an if-condition to your template.
https://vborg.vbsupport.ru/showthread.php?t=231525

kerrghann
07-28-2016, 03:54 PM
If you're not that familiar with PHP, just add an if-condition to your template.
https://vborg.vbsupport.ru/showthread.php?t=231525

I'm alright with PHP, the vBulletin syntax was kicking my butt though. This list is great, much appreciated, solved all my issues.

MacroPhotoPro
12-15-2016, 05:56 PM
Is there a way to write an HTML table onto this page?

I have tried using this format:

OutputTxt('<table><tr><td><th>
</th></td></tr></table>');

But it's not working :(

Any suggestions on how to insert an HTML table onto this blank php page?

Thanks!

Lynne
12-15-2016, 09:08 PM
Is there a way to write an HTML table onto this page?

I have tried using this format:

OutputTxt('<table><tr><td><th>
</th></td></tr></table>');

But it's not working :(

Any suggestions on how to insert an HTML table onto this blank php page?

Thanks!
Put the HTML into the template, not the php. Or, assign the HTML code to a variable, register it for use in the main template, and then put the variable in the template (see the example for $pagetitle in the first post).

MacroPhotoPro
12-15-2016, 09:42 PM
I've got it working now, Lynne, thank you.

Just want to say that this thread is a GREAT resource!

Much appreciated ... once again :)

Jack

Mattwhf
06-18-2017, 07:56 AM
Thanks Lynne!

From your awesome guide, I could create my first vBulletin page
It is a page to list top web hosting companies and it worked as what I expected.

I am thinking I will add some new features as rating, comment box...for it to make it better.

Regards,

john7911
07-07-2017, 04:18 PM
Hi :)
How can I add PHP code in this page?
Thank you ;)
-------------------
for example i want to put this code in a new page:

<form action="<?php $_SERVER['PHP_SELF']; ?>" method="get">
Diametre-Inter: <input type="text" name="Diametre-Inter"><br>
Diametre-Exter: <input type="text" name="Diametre-Exter"><br>
Division: <input type="text" name="division"><br>
<input type = "submit" value = "Calculer">
</form>

Diametre Interrieur: <?php echo $_GET["Diametre-Inter"]; ?><br>
Diametre Exterieur: <?php echo $_GET["Diametre-Exter"]; ?><br>
Division: <?php echo $_GET["division"]; ?><br>

<?php
$rayon_Inter = $_GET["Diametre-Inter"]/2;
$rayon_Exter = $_GET["Diametre-Exter"]/2;
$divis = $_GET["division"];
for($i=0 ; $i<=360;$i+=360/$divis){
$r = deg2rad ($i);
$k = cos($r) * $rayon_Inter;
$l = sqrt ( pow($rayon_Exter,2)-pow ($k,2));
$x = $rayon_Exter - $l;


echo $x . "<br>";


}



echo "<hr>";
echo $rayon_Inter . "<br>";
echo $rayon_Exter . "<br>";
echo "<hr>";

?>

vbem2
06-28-2018, 06:45 PM
Hi all -

I've been using multiple custom vB pages for years and years without any problem.

However, after moving the forum to a new machine and implementing https (maybe just a coincidence), just one of the pages broke, and I can't figure it out.

The page in question is outside of the forum directory (index.php in the site's root dir), and it previously worked fine with the chdir path specified in the PHP.

However, CSS is no longer rendering. Strangely, when looking at the page source, the "base path" is missing from the header. Thus no CSS.

The code is there in the headinclude template, but for some reason, vB is stripping it out for this page:

<base href="{vb:raw basepath}" /><!--[if IE]></base><![endif]-->

Why would vB delete that line? I'm stumped.

EDIT: I have updated the site URL with "https" in the ACP.