vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   How to create your own vBulletin-powered page! (uses vB templates) (https://vborg.vbsupport.ru/showthread.php?t=62164)

makange 05-25-2008 12:36 PM

does it work with vb 3.7.0 ??
I tried only to find nothing works. Just an page.

Mum 05-25-2008 06:28 PM

Quote:

Originally Posted by IR15H (Post 1530869)
"Revert" it.
(ADMIN CP > Styles & Templates > Style Manager > Edit Templates > Select Your Template > Revert)

Thank you so much :)

unleash 05-28-2008 12:55 PM

Thanks, I was looking for this

TimberFloorAu 05-30-2008 12:49 AM

Stupid question here, but where do i create the template?

Strike that lol !

Digital Jedi 06-02-2008 09:23 AM

Quote:

Originally Posted by makange (Post 1530901)
does it work with vb 3.7.0 ??
I tried only to find nothing works. Just an page.

Sure does. Retrace your steps or try again, making sure you followed the steps exactly. It seems a lot of folks are misinterpreting what making a PHP file and what making a template means.

made2kill 06-03-2008 10:54 PM

Hello,

I got about 20 pages in and realized it was a 49 page thread.

I followed the steps, and got the page working - no problem.
I'm sure this question was asked before, but...

How do you get PHP code working inside of the template?
All my pages have custom written PHP functions.

Thank you in advance.

amcd 06-04-2008 05:41 AM

Templates are not supposed to execute code. This is not just with vbulletin, but the entire concept of templating is separation of presentation from code (business logic).

Execute the php before calling the template, keep the presentation data in certain variables, and use the template just to show those variables.

made2kill 06-04-2008 12:48 PM

I'll give it a try, thanks.

soundbarrierpro 06-11-2008 07:18 PM

Can I configure this so that the user has to be logged in to see this? I have pages with content I don't want readily available to guests.

I'm using 3.7.0 and I want 'ONLY' registered users to see my vbpowered pages. I don't want them available to unregistered guests.

I checked herebut what template or folder page gets edited?

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

Quote:

Originally Posted by edgecutioner (Post 1310380)
thanks for the code guys!

EDIT: Works perfectly!

Here is what mine looks like. I can't get the permissions to work.
Code:

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'downloads'); // 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(
    'downloads',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if ($vbulletin->userinfo->userid==0)
{
    print_no_permission();
}
$navbits = array();
$navbits[$parent] = 'downloads';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('downloads') . '");');

?>


manuelsechi 06-14-2008 11:50 AM

hello all

is it possible to insert php code in this kind of pages?

thank you

Manuel

amcd 06-16-2008 09:35 AM

Quote:

Originally Posted by manuelsechi (Post 1549100)
hello all

is it possible to insert php code in this kind of pages?

thank you

Manuel

https://vborg.vbsupport.ru/showpost....&postcount=728

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

Quote:

Originally Posted by soundbarrierpro (Post 1546943)
Can I configure this so that the user has to be logged in to see this? I have pages with content I don't want readily available to guests.

I'm using 3.7.0 and I want 'ONLY' registered users to see my vbpowered pages. I don't want them available to unregistered guests.

I checked herebut what template or folder page gets edited?

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



Here is what mine looks like. I can't get the permissions to work.
Code:

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'downloads'); // 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(
    'downloads',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if ($vbulletin->userinfo->userid==0)
{
    print_no_permission();
}
$navbits = array();
$navbits[$parent] = 'downloads';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('downloads') . '");');

?>


What error do you get?

soundbarrierpro 06-16-2008 04:57 PM

Quote:

Originally Posted by amcd (Post 1550666)
https://vborg.vbsupport.ru/showpost....&postcount=728

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


What error do you get?

I don't get an error. When I browse to the page as a guest, it's all readily available. It doesn't get a permissions denied page. I'm able to do anything I want to do.

WEBDosser 06-21-2008 06:53 PM

does this work with latest VB..

Smiry Kin's 06-21-2008 07:07 PM

yep, example http://www.xentoo.com/privacy

amcd 06-21-2008 07:32 PM

Quote:

Originally Posted by soundbarrierpro (Post 1550978)
I don't get an error. When I browse to the page as a guest, it's all readily available. It doesn't get a permissions denied page. I'm able to do anything I want to do.

Code:

if ($vbulletin->userinfo->userid==0)
{
    print_no_permission();
}

If this doesn't keep guests out, then I have no answer. Maybe someone more experienced can help.

Trana 06-26-2008 05:10 AM

I can't seem to get this to work outside of my VB forum.

I used this:

chdir('../forum/');
require_once('./global.php');

But it doesn't work properly. The script is located in ../xxxx/yyyy/test.php and my VB install is in ../forum

Also, I am running this on IIS.

Maybe something is wrong with my chdir?

Thanks!

amcd 06-26-2008 07:00 AM

Your script is 2 levels down from the website root, so you have to use .. twice.

chdir('../../forum/');

Trana 06-26-2008 02:40 PM

Quote:

Originally Posted by amcd (Post 1559268)
Your script is 2 levels down from the website root, so you have to use .. twice.

chdir('../../forum/');

Like I said, I'm running IIS, so I don't think that will work.

Trana 06-28-2008 04:14 AM

Can anyone help me with this?

I have:

/ (root)
/forum (VB forum)
/test/test2 (where my script resides)

What do I set the require_once or chdir to in order to have the script in my test directory find global.php?

Thanks!

made2kill 06-29-2008 06:34 PM

Worked like a charm. Thank you.

Quote:

Originally Posted by amcd (Post 1540325)
Templates are not supposed to execute code. This is not just with vbulletin, but the entire concept of templating is separation of presentation from code (business logic).

Execute the php before calling the template, keep the presentation data in certain variables, and use the template just to show those variables.


amcd 06-30-2008 08:05 AM

Quote:

Originally Posted by Trana (Post 1559610)
Like I said, I'm running IIS, so I don't think that will work.

I think it will.

ragtek 06-30-2008 08:10 AM

Quote:

Originally Posted by amcd (Post 1555618)
Code:

if ($vbulletin->userinfo->userid==0)
{
    print_no_permission();
}

If this doesn't keep guests out, then I have no answer. Maybe someone more experienced can help.

1. it is $vbulletin->userinfo['userid']
2. you can use
[php]
$show['guest'] and $show['member']

PHP Code:

if ($show['guest'])
    {
        
print_no_permission();

    } 

guests will get the no permission page:)
hth

Goomzee 07-02-2008 04:05 AM

this is my Template Coding

Quote:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">Title</td>
</tr>
<tr>
<td class="alt1">Text</td>
</tr>
</table>

$footer
</body>
</html>
and this is my test.php file coding

Quote:

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'test'); // 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 ############################
chdir('/home/username/public_html/');
require_once('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

$navbits = array();
$navbits[$parent] = 'Test Page';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('TEST') . '");');

?>
Also, please use the PHP BB Code
and it's my page URL

http://www.mknexusonline.com/test.php

but it's not working someone plz tell what i did wrong

Smiry Kin's 07-02-2008 05:57 AM

Quote:

Originally Posted by Goomzee (Post 1564463)
this is my Template Coding



and this is my test.php file coding



and it's my page URL

http://www.mknexusonline.com/test.php

but it's not working someone plz tell what i did wrong

chdir('/home/username/public_html/');

correct this in your php file

Goomzee 07-02-2008 07:01 AM

you see above i already did this in test.php

Quote:

// ######################### REQUIRE BACK-END ############################
chdir('/home/username/public_html/');
require_once('./global.php');


Digital Jedi 07-02-2008 07:26 AM

Quote:

Also, please use the PHP BB Code
Is that in your PHP code or did you just wrap your QUOTE tags incorrectly?

Goomzee 07-02-2008 08:59 AM

what do you mean in my test.php i just added below code
Quote:

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'test'); // 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 ############################
chdir('/home/username/public_html/');
require_once('./global.php');

// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

$navbits = array();
$navbits[$parent] = 'Test Page';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('TEST') . '");');

?>
it's was copy paste mistake that i line i removed it

amcd 07-02-2008 09:32 AM

Where have you kept test.php? If it is in the same directory as vbulletin, you dont need this line:

Code:

chdir('/home/username/public_html/');
If your test.php is in a different directory then you need this line, but you must change it and write the directory where your vbulletin is.

Goomzee 07-02-2008 09:43 AM

my file is there http://www.mknexusonline.com/test.php
my forums link is this
http://www.mknexusonline.com/forums

now what should i do

Digital Jedi 07-02-2008 03:14 PM

Quote:

Originally Posted by Goomzee (Post 1564661)
my file is there http://www.mknexusonline.com/test.php
my forums link is this
http://www.mknexusonline.com/forums

now what should i do

Take out chdir('/home/username/public_html/'); for right now. Put your test.php in your forum root folder, like so: www.mknexusonline.com/forums/test.php. It should start working for you now.

Smiry Kin's 07-02-2008 03:42 PM

Quote:

Originally Posted by Goomzee (Post 1564566)
you see above i already did this in test.php

yes but have you entered the correct username?

Goomzee 07-03-2008 03:50 AM

Quote:

Originally Posted by Digital Jedi (Post 1564927)
Take out chdir('/home/username/public_html/'); for right now. Put your test.php in your forum root folder, like so: www.mknexusonline.com/forums/test.php. It should start working for you now.

that i know it will works but i want to add this page here

soundbarrierpro 07-03-2008 11:47 AM

Quote:

Originally Posted by Goomzee (Post 1564463)
this is my Template Coding



and this is my test.php file coding



and it's my page URL

http://www.mknexusonline.com/test.php

but it's not working someone plz tell what i did wrong

You need to name your template "custom_test". Your .php file must be named "test.php" for the template call to work.

Every new template must have the prefix "custom" and an underscore, ie. custom_test

this is the link you should use for every custom page you create. just replace the last word with your custom page name
Code:

http://www.yourdomain.com/misc.php?do=page&template=test

Digital Jedi 07-03-2008 03:37 PM

Quote:

Originally Posted by soundbarrierpro (Post 1565723)
You need to name your template "custom_test". Your .php file must be named "test.php" for the template call to work.

Every new template must have the prefix "custom" and an underscore, ie. custom_test

this is the link you should use for every custom page you create. just replace the last word with your custom page name
Code:

http://www.yourdomain.com/misc.php?do=page&template=test

That's not how this tutorial works. You'll notice it says to create a template called TEST, not custom_TEST. It's says nothing about adding a prefix. That URL that you posted takes you to misc.php and is very much how the custom pages within vBadvanced work. But how can you possibly get to a file named test.php when your navigating to misc.php? Their two different pages. This tutorial teaches you how to create a page without the do= string at the end.

For example, the very first page I created using this tutorial is here: www.cogonline.net/forums/banners.php

The template name I use is BANNERS. The file is banners.php. Navigating to misc.php misc isn't going to take me anywhere near this page.

soundbarrierpro 07-03-2008 04:05 PM

Dude, did you miss the part where I said I have over 40 pages created like this? Each page .php page has it's own name and that name matches up with custom_same page name.

test.php matches up with custom_test =
Code:

http://www.yourdomain.com/misc.php?do=page&template=test
test1.php matches up with custom_test1=
Code:

http://www.yourdomain.com/misc.php?do=page&template=test1
test2.php matches up with custom_test2 =
Code:

http://www.yourdomain.com/misc.php?do=page&template=test2
Don't tell me it doesn't work, because this is how this mod works.

amcd 07-04-2008 06:21 AM

Quote:

Originally Posted by soundbarrierpro (Post 1565933)
Don't tell me it doesn't work,

ok.
Quote:

Originally Posted by soundbarrierpro (Post 1565933)
because this is how this mod works.

no.

And this is an article, not a mod.

Lord Singo 07-04-2008 07:53 AM

How can I put sound files or rss feeds into a page like this?

Digital Jedi 07-04-2008 08:57 AM

Quote:

Originally Posted by soundbarrierpro (Post 1565933)
Dude, did you miss the part where I said I have over 40 pages created like this? Each page .php page has it's own name and that name matches up with custom_same page name.

test.php matches up with custom_test =
Code:

http://www.yourdomain.com/misc.php?do=page&template=test
test1.php matches up with custom_test1=
Code:

http://www.yourdomain.com/misc.php?do=page&template=test1
test2.php matches up with custom_test2 =
Code:

http://www.yourdomain.com/misc.php?do=page&template=test2
Don't tell me it doesn't work, because this is how this mod works.

I didn't say it didn't work. I said that's not how this tutorial works. This tutorial creates individual .php pages with unique names for each one. With your method, the .php pages your creating aren't even being used. Not to mention, the point of the tutorial is to navigate to a page called test.php, not misc.php. You'll notice that nothing your saying is even mentioned in this tutorial.

Lord Singo 07-04-2008 01:25 PM

I can't seem to force users to login to view my page created with this script.

What do I need to do to force guests to login so they can view the page?

mackers8923 07-04-2008 01:36 PM

Folks

Could someone please confirm that this works with 3.7.2 ?

VMT


All times are GMT. The time now is 07:25 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.02620 seconds
  • Memory Usage 1,872KB
  • 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
  • (13)bbcode_code_printable
  • (1)bbcode_php_printable
  • (25)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)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