vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Embed PHP in Templates (https://vborg.vbsupport.ru/showthread.php?t=52775)

DraX 06-14-2003 09:49 AM

The problem with file inclusion is that this is completely contrary to the way in which vBulletin handles it's output buffering.

It doesn't generate line after line, it generates the entire page, and then sends that to the browser once it's compiled it.

For includes to work properly, anything (echos, output, etc.) would have to be stored as variables within the include, which are then echoed by the template itself.

gmarik 06-14-2003 10:28 AM

DraX - and what is the solution? Any code ideas?

Rob - PROMISE 06-19-2003 07:29 AM

Hello, sorry if this has been answered, I have read through and can't find anyhting relating to my problem.

I have installed the hack, I then dropped '<? ?>' (without the quotes) into the header of one of our templates. When I view the page it's not parsing the php, I can see the php tags in the source.

I then tried dropping an include in the same place but I then just get a blank page. I read that there are issues with using includes in the templates and I can live without using them although it would be very useful if I could.

Can you shead any light, let me know if you need any more details.

Thanks for your help people :)

gmarik 06-19-2003 08:43 AM

You're not the only one.
I can't get php working in my 2.3 templates too.
Any solutions in v3? Anybody, Fil, xenon?!

Veg 06-26-2003 10:54 AM

Can you retrive information from the database with this hack?

gmarik 06-26-2003 12:15 PM

Theoreticaly it operates template DB. Theoreticaly.

Importhookup 07-07-2003 11:45 AM

Great hack!

I am so glad that I found this hack, but the problem is that I'm having trouble installing it. I did exactly what is written in the file, the simple replacement of the code but this is what I get on the top of myVBindex.php.

Warning: Failed opening 'randomride.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/importhookup/public_html/forums/admin/functions.php(1095) : eval()'d code on line 1

Parse error: parse error, unexpected T_INCLUDE in /home/importhookup/public_html/forums/admin/functions.php(1095) : eval()'d code on line 1

Parse error: parse error, unexpected T_INCLUDE in /home/importhookup/public_html/forums/admin/functions.php(1095) : eval()'d code on line 1

Can someone help me with this? Thanks!

ChurchMedia 08-05-2003 04:26 AM

If I use include statements, it works but always puts the include file at the top of the page. Any way around this?

Thanks for the cool hack!

Link14716 09-08-2003 08:18 PM

Not working... at least not in the postbit.

Code used:
PHP Code:

<?
if (!empty($post[field7])) {
$postfollower = "<br><br>";
$postfollower = $postfollower."".bbcodeparse2($post[field7],0,1,1,1);
}
if (!empty($post[field5])) {
$posttextcolor = "color='".$post[field5]."'";
}
if (!empty($post[field6])) {
$postfontface = "face='".$post[field6]."'";
}
if (!empty($postfontface) || !empty($posttextcolor)) {
?>
<font $postfontface $posttextcolor>
<? } ?>
$post[message] 
<? if (!empty($postfontface) || !empty($posttextcolor)) { ?>
</font>
<? } ?>
$postfollower

View Source gives me this, of course on the page the code didn't work:
Code:

<?
if (!empty([b]Official[/b] Code +++++)) {
 = "<br><br>";
 = ."".bbcodeparse2([b]Official[/b] Code +++++,0,1,1,1);
}
if (!empty(blue)) {
 = "color='".blue."'";
}
if (!empty(WingDings)) {
 = "face='".WingDings."'";
}
if (!empty() || !empty()) {
?>
<font  >
<? } ?>
I've nailed the store, arcade, increased the arcade's number of games to 41, installed quick reply, and installed zajako's RPG hack. I'm done for tonight.
<? if (!empty() || !empty()) { ?>
</font>
<? } ?>


gmarik 09-09-2003 03:06 PM

Is it working in v3?

Tae-Hwan 09-27-2003 07:32 PM

filburt, in your opinion does this render logician's conditionals hack obsolete? i'm fluent in php. i liked logician's conditionals a lot except that it was kinda slow..

drives fast 09-29-2003 01:12 AM

I have tried many combinations and haven't figured out this one yet

if someone would be so kind

this is what I had figured out in the vb3 conditionals:
PHP Code:

<if condition="$post[usergroupid]==11"><font color="#ffcc00" face="verdana, arial, helvetica" size="1"><b>Site Supporter</b></font> <img src="/forum/eimages/supporter.gif" width="11" height="11" border="0" /></if> 

how can that be modified to work within the <? ?> in the earlier vbulletin version that I have installed this hack in?

I have tried several things but only get parse errors displayed above the header

stuff like:
PHP Code:

<?
if (condition = $post[usergroupid]==11) {
$var = "<font color=\"#ffcc00\" face=\"verdana, arial, helvetica\" size=\"1\"><b>Site Supporter</b></font> <img src=\"/forum/eimages/supporter.gif\" width=\"11\" height=\"11\" border=\"0\" />"
}
?>

and:
PHP Code:

<?
if ($post[usergroupid] != 11) {
$var = "<smallfontcolor='#ffcc00'><b>Site Supporter</b></smallfont> <img src='/forum/eimages/supporter.gif' width='11' height='11' border='0' />"
}
?>

I know it is just because I don't know the language to use

thanks a bunch for any help

drives fast 10-02-2003 04:18 AM

once again...I couldn't get bit by a dog even with a steak hanging around my neck

Tae-Hwan 10-17-2003 08:10 PM

Quote:

Originally Posted by drives fast
once again...I couldn't get bit by a dog even with a steak hanging around my neck

hehe, i never heard that one before...

well, i don't have any experience in vbulletin 3, but if i'm understanding the code correctly, it should look something like this in php:

PHP Code:

<? 
if ($post[usergroupid]==11) { 
echo "<font color=\"#ffcc00\" face=\"verdana, arial, helvetica\" size=\"1\"><b>Site Supporter</b></font><img src=\"/forum/eimages/supporter.gif\" width=\"11\" height=\"11\" border=\"0\">";

?>


drives fast 10-18-2003 01:20 AM

thank you...I will give that a try.

it looks like it will work though....I forgot about the "echo"

gmarik 10-19-2003 03:06 PM

We all forget some times about the quotes or the echo ...

stephenv 11-13-2003 08:19 PM

I read through some of the other messages AFTER modifying/fixing the original script, I would have added the <?php ?> <php> </php> stuff but I can't be arsed. On a deadline for other stuff.

That said, attached is an updated version that uses output buffering (in case you want to echo text) and also fixes the str_replace that didn't do squat :)



Mail me at stephen AT natnet DOT com if you want to say thanks or have questions, today was my first day on the board and I probably won't be back (fixed for a client who wanted to use phpAdsNew).

NuclioN 12-08-2003 09:04 AM

Very usefull! I hope this will possible in vb3 soon. :)

spittingangels 01-14-2004 01:35 AM

Quote:

Originally Posted by stephenv
I read through some of the other messages AFTER modifying/fixing the original script, I would have added the <?php ?> <php> </php> stuff but I can't be arsed. On a deadline for other stuff.

That said, attached is an updated version that uses output buffering (in case you want to echo text) and also fixes the str_replace that didn't do squat :)

Mail me at stephen AT natnet DOT com if you want to say thanks or have questions, today was my first day on the board and I probably won't be back (fixed for a client who wanted to use phpAdsNew).


With these modifications, the hack works like a charm for what I needed it to do, which was to pull a php file into the header template via include(). the original hack would pull the file into the page but only at the top of the page and not where it was supposed to display.

For everyone else that had a similar problem, try this version. My thanks to both authors that worked on this.


All times are GMT. The time now is 03:33 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.01315 seconds
  • Memory Usage 1,772KB
  • 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
  • (5)bbcode_php_printable
  • (2)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
  • (19)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