vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Custom page Script... (https://vborg.vbsupport.ru/showthread.php?t=227974)

MarkFoster 11-14-2009 11:53 PM

Custom page Script...
 
From this mod: https://vborg.vbsupport.ru/showthread.php?t=62164

What wuld this script be if I would be to use vB 4.0?
Code:

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

I have loads of custom pages and I really need the proper script to change them all.

ForumsMods 11-15-2009 01:16 AM

PHP Code:

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT''test'); // change this depending on your filename
define('CSRF_PROTECTION'true);

// ################### 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 construct_navbits(array('' => 'Test Page'));
$navbar render_navbar_template($navbits);

$templater vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle''Test Page');
print_output($templater->render());

?>

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}</title>
    {vb:raw headinclude}
  </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>


TheLastSuperman 11-15-2009 01:18 AM

Quote:

Originally Posted by vB Style (Post 1914389)
PHP 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 construct_navbits(array('' => 'Test Page'));
$navbar render_navbar_template($navbits);

$templater vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle''Test Page');
print_output($templater->render());

?>

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}</title>
    {vb:raw headinclude}
  </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>


Right when I'm about to post LOL but good job!

HMBeaty 11-15-2009 01:24 AM

Actually, to make a quick correction (if I remember correctly)...

This
PHP Code:

error_reporting(E_ALL & ~E_NOTICE); 

Should be
PHP Code:

error_reporting(E_ALL & ~E_NOTICE & ~8192); 


Dismounted 11-15-2009 02:25 AM

Quote:

Originally Posted by HMBeaty (Post 1914392)
Actually, to make a quick correction (if I remember correctly)...

No need to suppress E_DEPRECATED warnings now, as they should be fixed.

HMBeaty 11-15-2009 02:30 AM

Quote:

Originally Posted by Dismounted (Post 1914411)
No need to suppress E_DEPRECATED warnings now, as they should be fixed.

Ok, sounds good. :) Thank you Dismounted

Cip 11-15-2009 05:09 AM

vB Style is god vBulletinized. :)

ragtek 11-15-2009 07:41 AM

Quote:

Originally Posted by vB Style (Post 1914389)
PHP 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 construct_navbits(array('' => 'Test Page'));
$navbar render_navbar_template($navbits);

$templater vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle''Test Page');
print_output($templater->render());

?>

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}</title>
    {vb:raw headinclude}
  </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>


1. forgett define('NO_REGISTER_GLOBALS', 1);
2. include the csrf protection


We shouldn't start posting the outdated stuff;)

winstone 11-15-2009 07:50 AM

what does following function do?
PHP Code:

$templater->register_page_templates(); 

can we include other templates inside it? e.g. $templater->register_page_templates('top_bit', 'side_bit', 'etc');

Shadab 11-15-2009 09:28 AM

Quote:

Originally Posted by winstone (Post 1914477)
what does following function do?
PHP Code:

$templater->register_page_templates(); 


It makes the header, footer and headinclude templates available to the template being evaluated.

Quote:

Originally Posted by winstone (Post 1914477)
can we include other templates inside it? e.g. $templater->register_page_templates('top_bit', 'side_bit', 'etc');

No. But you can do that via the register() method.
For example: [untested]

PHP Code:

$templater vB_Template::create('TEST');

$templater->register_page_templates();
$templater->register('navbar'$navbar);

$templater->register('my_sidebar_1'vB_Template::create('sidebar_1')->render());

print_output($templater->render()); 


This would make the sidebar_1 template accessible via {vb:raw my_sidebar_1}
in your main TEST template.


All times are GMT. The time now is 09:56 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.01156 seconds
  • Memory Usage 1,801KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_html_printable
  • (8)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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