vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Php in templates (https://vborg.vbsupport.ru/showthread.php?t=70959)

blueuniverse 10-25-2004 06:48 AM

Php in templates
 
Basically, I want the function to be able to use PHP in the template system.

Would anybody be able to do this?

Johnny 10-25-2004 12:40 PM

<a href="http://www.vbulletin.com/docs/html/main/templates_phpinclude_start" target="_blank">http://www.vbulletin.com/docs/html/m...pinclude_start</a>

vb docs explains it all.

blueuniverse 10-25-2004 12:49 PM

Ok, so if I had a load of code, that I wanted to be displayed on one page only, I'd have to include it on every page?

Colin F 10-25-2004 01:02 PM

Quote:

Originally Posted by blueuniverse
Ok, so if I had a load of code, that I wanted to be displayed on one page only, I'd have to include it on every page?

No. Use a templateconditional in the form of:
PHP Code:

<if condition="THIS_SCRIPT == bla">include(foo.php);</if> 


Zachery 10-25-2004 02:04 PM

Quote:

Originally Posted by Colin F
No. Use a templateconditional in the form of:
PHP Code:

<if condition="THIS_SCRIPT == bla">include(foo.php);</if> 


You cant do that, and you cannot use php in the templates, you need to hack the files :)

blueuniverse 10-27-2004 07:19 AM

So is there, absolutely no way to do it at the moment. If there isn't, would anybody be kind enough to make a hack?

Andreas 10-27-2004 07:39 AM

As already said, you can't use PHP in templates (except a few functions in <if ...>-statements.

What you can do is put code in phpinclude_start|end, you can also do this conditional by using

PHP Code:

if (THIS_SCRIPT == 'foobar') {
  
// Do smth for that specific page


Modifying vB so it is possible to use PHP in templates generally is a bad idea due to security issues.

blueuniverse 10-27-2004 07:43 AM

Well, Zachery just said

Quote:

You cant do that, and you cannot use php in the templates, you need to hack the files
It may be a bad idea security wise, but I do need to find some way of getting this code onto some pages (maybe not through templates) as I need the code to use the styles that the user has set.

Andreas 10-27-2004 07:45 AM

Hmm ... and what's the problem with putting the code in phpinclude_start?

blueuniverse 10-27-2004 08:57 AM

So in the PHP start template, I'd put what (if I had loads of code, where would it go in the code you gave me).

Code:

if (THIS_SCITPT == 'foobar') {
  // Do smth for that specific page
}

It just seems weird having to put all the code for each page in the php include start template, when I only need it on one page.


All times are GMT. The time now is 03:44 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.01153 seconds
  • Memory Usage 1,738KB
  • 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_php_printable
  • (3)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