vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   does php work in templates (https://vborg.vbsupport.ru/showthread.php?t=230061)

Samish 12-12-2009 08:51 PM

does php work in templates
 
i need to add a php script into one of my templates does it work? or how can i make it work?

Lynne 12-12-2009 08:56 PM

You cannot add php to templates. You add the php to plugins and then put the output into the templates via a variable.

Samish 12-12-2009 08:59 PM

urrm tht made no sense haha

could you help i need to put this in there

Code:

<?php
        include("path/to/show_rares.php");
        ?>


Adrian Schneider 12-12-2009 09:04 PM

Which template?

You'd put something like this into a plugin (hook depends on template) :

PHP Code:

ob_start();
include(
'path/to/show_rares.php');
$rares ob_get_clean(); 

And stick $rares in your template.

global_start works for a lot of the templates if they use global scope and aren't evaluated before this hook.

Samish 12-12-2009 09:06 PM

i have no clue what you just said, basically i need that code to work in this template

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">RARE VALUES</td>
</tr>
<tr>
    <td class="alt1">
</td>
</tr>
</table>

$footer
</body>
</html>

Its a new page i just created :)

If you can help it would be great

Lynne 12-12-2009 09:09 PM

If it's a new page, then you don't need to put code in a plugin. You put the php code into your page that you just created. It's php which goes into the php page.

Samish 12-12-2009 09:12 PM

Quote:

Originally Posted by Lynne (Post 1929565)
If it's a new page, then you don't need to put code in a plugin. You put the php code into your page that you just created. It's php which goes into the php page.

how do you mean?
i followed that guide you gave me. and ive made the .php and linked it to the template... now what

Lynne 12-12-2009 09:48 PM

The article gives you the skeleton of what you need. You now enter your code under the are that says "START MAIN SCRIPT". And then the output from that should be a $variable and you put that $variable into your template.

If you look at a basic vbulletin page, you will see them do this.


All times are GMT. The time now is 01:02 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.01197 seconds
  • Memory Usage 1,726KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete