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)

GSXR 09-24-2008 03:25 PM

If you have more than one style, is it possible to use this on a style other than the predomanant style?

I can get it working hith the main style of my forum but if I create a new style and make a new template in the new style, all I get is a blank page.

Interestingly if I go to /forums/test/php?style=........whatever that style ID# is, I will get the page, HOWEVER, it changes the style of the forum to that ID style......

soundbarrierpro 09-24-2008 03:27 PM

Quote:

Originally Posted by GSXR (Post 1629322)
If you have more than one style, is it possible to use this on a style other than the predomanant style?

I can get it working hith the main style of my forum but if I create a new style and make a new template in the new style, all I get is a blank page.

Interestingly if I go to /forums/test/php?style=........whatever that style ID# is, I will get the page, HOWEVER, it changes the style of the forum to that ID style......

The templates have to be created in the new style as well. I don't know how or if they can be imported from your default or existing style you initially created the pages in.

Digital Jedi 09-24-2008 08:57 PM

Quote:

Originally Posted by soundbarrierpro (Post 1629254)
I have 45 pages created this way and they all work. However, I can not get them to recognize permsission. I don't want unregistered users to have access, but everything I've tried to manipulate the code doesn't work. It seems unregistered users can still browse to these pages no matter what I do.

I created my php file and called it 'test' and configured according to the hack specs.

I went to ACP>Style & Templates>Style Manager>Clicked drop down on my style>Selected Add New template.

I added the code the hack specified and named the new template custom_test

The page is now accessible with this link http://www.yourdomain.com/misc.php?d...&template=test

as is all my other pages I created the same exact way
http://www.yourdomain.com/misc.php?d...template=test1
http://www.yourdomain.com/misc.php?d...template=test2

and so on and so on.

Again, all the pages work fine. I just need to know how to make them permission based to block unregistered users from being able to browse to them.

Have you tried just wrapping the content of the template in an if conditional? Maybe do the same for links to the page?

soundbarrierpro 09-25-2008 11:24 AM

Quote:

Originally Posted by Digital Jedi (Post 1629556)
Have you tried just wrapping the content of the template in an if conditional? Maybe do the same for links to the page?

I've really tried with all of the replies made on this topic here. I've read every single page here and tried everything, but replies only seem to provide snippets. Do the conditionals go on the php file or the template? I tried everything on the php files. It seems extraordinarily simple for some here, but nothing works for me when I do it. I was entering the conditionals below the global statement. Can you put it in this code, so I can see exactly where it has to go and how it has to be edited? Thanks for your help.

This is one of the pages I got all the info to do the conditional. But everybody seems to have their own ideas and nothing worked for me. https://vborg.vbsupport.ru/showthrea...=62164&page=37

Code:

<?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 ############################
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') . '");');

?>


Lynne 09-25-2008 02:23 PM

Quote:

Originally Posted by soundbarrierpro (Post 1629965)
I've really tried with all of the replies made on this topic here. I've read every single page here and tried everything, but replies only seem to provide snippets. Do the conditionals go on the php file or the template? I tried everything on the php files. It seems extraordinarily simple for some here, but nothing works for me when I do it. I was entering the conditionals below the global statement. Can you put it in this code, so I can see exactly where it has to go and how it has to be edited? Thanks for your help.

This is one of the pages I got all the info to do the conditional. But everybody seems to have their own ideas and nothing worked for me. https://vborg.vbsupport.ru/showthrea...=62164&page=37

This is what I have under the START MAIN SCRIPT part of one of my pages where I only want users in usergroups 5, 6, and 32 to view the page. All others get a No Permission screen:
PHP Code:

if (!isset($vbulletin->userinfo['userid']) OR $vbulletin->userinfo['userid'] == OR !is_member_of($vbulletin->userinfo,5,6,32))
{
    
print_no_permission();


If you simply want it to block unregistered users, just remove the is_member_of part of the conditional:
PHP Code:

if (!isset($vbulletin->userinfo['userid']) OR $vbulletin->userinfo['userid'] == 0)
{
    
print_no_permission();



soundbarrierpro 09-25-2008 02:34 PM

Hi Lynne,

Thank you for responding.

After 'literally' going through every single thread and carefully re-reading @ Digital Jedi's responses, I have figured it out. Although my links were working this way:
http://www.mywebsite.com/misc.php?do...te=downloads_1

As DJ said, I had created my templates wrong. I went back and re-config'd my templates as just "downloads_1" and added this right below "Start Main Script"

Code:

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

    }

now I can browse my pages as http://www.mysite.com/downloads_1.php etc. with permissions so that you must register.

Whoooo! Thanks everybody for your expert help and for straightening me out :)

shahryar_neo 09-27-2008 06:10 PM

i got this error :


Unable to add cookies, header already sent.

Line: 1

and this is my page php code :

Code:

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

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

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

);

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

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

$navbits = array();
$navbits[$parent] = 'chatbox';

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

?>

what's the problem ?

Digital Jedi 09-27-2008 07:37 PM

I notice your template is named chatbox. Are you trying to use combine this with another modification?

shahryar_neo 09-28-2008 12:20 PM

Quote:

Originally Posted by Digital Jedi (Post 1631819)
I notice your template is named chatbox. Are you trying to use combine this with another modification?

yes . i want to put the shoutbox code in the chatbox template and after that when a user go to chatbox.php see the chatbox in vBulletin page template .

============

Edited : My Problem Solved but new problem appear! now it cache a bit more ! for example i have to press Ctrl+F5 to see something new on it ! why it cached ?

ru55ian 09-28-2008 09:23 PM

hey all, after reading through this thread i am a little lost, i need to create a page with php code from linkmarket embedded into it .
I was able to the the page running, having trouble addign PHP code to it. anyone can help?

This is what i got for my template:

Code:

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

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">

<tr class="tcat">
  <td><strong>Resouces</strong></td>
</tr>

<tr>
    <td class="alt1">
<?php ../mylinks.php ?>


    </td>
</tr>
</table>

$footer
</body>
</html>

although adding php file is not helping as it's not showing up.

here is the code i need to add:

Code:

<?php

 /*
  Link Market Link Page Module
  Copyright 2003 Link Market, All Rights Reserved.

  WARNING: Do not changecode below or your link page will not work!
 */

 $user_id = "";

 $url = "http://api.linkmarket.com/mng_dir/get_links.php?user_id="
            .$user_id."&cid=".$_GET['cid']."&start=".$_GET['start']."";

echo GetLMDSContent($url);

function GetLMDSContent($url)
{
$buffer = "";
$urlArr = parse_url($url);
if($urlArr[query])
{
$urlArr[query] = "?".$urlArr[query];
}

$fp = fsockopen($urlArr[host], 80, $errno, $errstr, 30);
if (!$fp){echo "$errstr ($errno)<br />\n";}
else
{
$out = "GET /".substr($urlArr[path], 1).$urlArr[query]." HTTP/1.0\r\n";
$out .= "Host: ".$urlArr[host]."\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp))
{
$buffer .= fgets($fp, 128);
}
fclose($fp);
}

$buffer = strstr($buffer,"\r\n\r\n");

return $buffer;
}

?>



All times are GMT. The time now is 11:46 AM.

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.03715 seconds
  • Memory Usage 1,795KB
  • 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
  • (5)bbcode_code_printable
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (4)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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