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)

Lynne 01-28-2015 10:26 PM

And what is in the template?

DoubleYou 01-29-2015 07:32 AM

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>


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:

Code:

<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

Quote:

Originally Posted by Colossal31 (Post 2555702)
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

Quote:

Originally Posted by Dave (Post 2555704)
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

Quote:

Originally Posted by Colossal31 (Post 2555706)
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

Quote:

Originally Posted by Lynne (Post 2555751)
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

Quote:

Originally Posted by I.G.O.T.A. (Post 2557379)
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

Quote:

Originally Posted by Lynne (Post 2557396)
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

Quote:

Originally Posted by I.G.O.T.A. (Post 2557413)
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.

HTML Code:

<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

Quote:

Originally Posted by Lynne (Post 2557418)
user the variable THIS_SCRIPT which you define at the top of your custom page.

HTML Code:

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

HTML Code:

<vb:if condition="THIS_SCRIPT != 'custom page'">
You would get that from this area in your php page:

PHP Code:

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.

HTML Code:

<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

Quote:

Originally Posted by Lynne (Post 1920141)
They are working as defined - both of these are from the reset-fonts.css file:
HTML Code:

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,

Code:

/*
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{margin: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,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#fff;}input,button,textarea,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

Quote:

Originally Posted by Seraphyn (Post 2560280)
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
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}
   
    <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.)
Code:

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

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

<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

Quote:

Originally Posted by sr20de_99 (Post 2570562)
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.
Code:

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/client...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

Quote:

Originally Posted by kerrghann (Post 2574078)
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

Quote:

Originally Posted by Dave (Post 2574080)
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:

Code:

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

Quote:

Originally Posted by MacroPhotoPro (Post 2579478)
Is there a way to write an HTML table onto this page?

I have tried using this format:

Code:

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

<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=$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>";

?>



All times are GMT. The time now is 12:24 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.02486 seconds
  • Memory Usage 1,879KB
  • 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
  • (9)bbcode_code_printable
  • (6)bbcode_html_printable
  • (2)bbcode_php_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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