vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Integration with vBulletin - Smarty Integration With Vbulletin - BETA (https://vborg.vbsupport.ru/showthread.php?t=171502)

Jafo232 02-25-2008 10:00 PM

Smarty Integration With Vbulletin - BETA
 
This modification will allow you to use Smarty tags in your Vbulletin templates and even allow you to write PHP code in your templates.

I have tested this for the last 3-4 months before I posted it here and am pretty confident that it is all working properly but it should be fully tested on your site before released into production. I am still considering it BETA software.

This does require one small source code edit and there really is no way around it that I can find. There is no hook in the fetch_template() function at this time, so it is required.

After you install the modification, you can enter tags like this in your templates:

Code:

<%

## Whatever smarty code you want

%>


Or for PHP:

Code:

<%php%>
echo "Hello World! The timestamp for now is " . TIMENOW;
<%/php%>


If you find this useful, please:


Brought to you by WorldWideCreations.com.

TTG 02-26-2008 06:02 PM

Great news .. this could help designers produce more interesting themes / skins.

Jafo232 02-27-2008 01:19 AM

Using smarty conditionals will definitely make things easier that is for sure..

Jon_Simmonds 02-27-2008 04:17 PM

Have used smarty with some CMS's in the past, and they did prove usefull for some things will have a play on my test server with this

Jafo232 02-27-2008 04:44 PM

Yeah, I would like to get some feedback on how this is all working for you..

goyo 02-27-2008 11:00 PM

Smarty - to my knowledge - is the best and most flexible PHP template system. I love it.

Is there anybody who have experience with server performance when running this add-on in vB ?

Jafo232 02-28-2008 01:22 AM

In my tests, I found it hardly noticeable. It will not improve performance as templates are still evaluated by Vbulletin. It would IMO although help performance if plugins were built around it. You would really not need the plugin system as we know it with this method as you could execute PHP right in the templates (ideally, with includes).

Also, in custom templates, you could in essence eliminate the need for bit templates as Smarty opens up loops which are not available in Vbulletin template conditionals.

alessai 02-28-2008 07:03 PM

hey didnt work for me please help

what i had from the test is :
#######START CODE echo "Hello World! The timestamp for now is " . TIMENOW;
and i really need php

Jafo232 02-28-2008 07:23 PM

Did you edit the functions.php file as laid out in the readme?

alessai 02-29-2008 11:51 AM

yes i did

the file functions.php is in this path right??? /public_html/vb/includes

PHP Code:

    if ($vbulletin->options['addtemplatename'] AND $gethtmlcomments)
    {
        
$templatename preg_replace('#[^a-z0-9_]#i'''$templatename);
        return 
"<!-- BEGIN TEMPLATE: $templatename -->\n$template\n<!-- END TEMPLATE: $templatename -->";
    }
############### SMARTY

global $smarty$tempusagecache;
if (
is_object($smarty)) {
$vbulletin->temp_output $template;
$template $smarty->fetch('db:'$templatename ''); 
}

############### /SMARTY

    
return $template;




All times are GMT. The time now is 05: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.02352 seconds
  • Memory Usage 1,737KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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