PDA

View Full Version : $code getting parsed ?


74corvette
09-04-2008, 01:11 AM
I'm stumped. (Using VB3.6.8)

I have this code:

<? $pollid="1"; include("poll.php"); ?>

That when ran by itself outside of VB (in a test.php file) will produce the results just fine.

However when inserted in one of my templates it does NOT produce an output and when I look at the source code(using IE) all I see is this:

<? ="1"; include("poll.php"); ?>
Like it parsed the $pollid

I have tried it on different templates in different places with no luck. No matter what template it's in, it will not output. How do I get my template to run the the full code and not parse it out so my poll will show ?

Please tell me this is easy...:o

Thanks everyone.

74

MoT3rror
09-04-2008, 02:54 AM
You can't put php in templates, you must use plugins.

Marco van Herwaarden
09-04-2008, 06:02 AM
See: Including External Files (http://www.vbulletin.com/docs/html/main/templates_externalfiles)

74corvette
09-04-2008, 09:56 PM
Well I thought I was on to something. I looked over the Doc (thanks Marco) and did what the example said. Now it appers the plugin cant find the file ?? I double checked everything and the path statements are correct and the folder is 777. I going to keep digging, but in the mean time I thought I would post my progress. This is what I'm getting now.

Warning: Unknown(/forum/simplepoll/sample.php): failed to open stream: No such file or directory in /global.php(360) : eval()'d code on line 62

Warning: Unknown(/forum/simplepoll/sample.php): failed to open stream: No such file or directory in /global.php(360) : eval()'d code on line 62

Warning: (null)(): Failed opening '/forum/simplepoll/sample.php' for inclusion (include_path='.:/usr/local/lib/php') in /global.php(360) : eval()'d code on line 62

Here is my Plugin
ob_start();
include('/forum/simplepoll/sample.php');
$includedphp = ob_get_contents();
ob_end_clean();

and its in Global_Start

Opserty
09-04-2008, 11:21 PM
Isn't your forum already in the /forum/ directory?

74corvette
09-04-2008, 11:23 PM
Yeah Your right. It is a problem with the path. It worked when I specified the http:// location of the file so What is the forum root ?

Opserty
09-04-2008, 11:29 PM
global_start means the code will be executed in the global.php file.

I'm assuming you have it set up like this:
forum/
simplepoll
sample.php
global.php So, /forum/ is your root (forum) folder.

You don't need to use http:// something like:

include('./simplepoll/sample.php');