vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   $code getting parsed ? (https://vborg.vbsupport.ru/showthread.php?t=189982)

74corvette 09-04-2008 01:11 AM

$code getting parsed ?
 
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

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:
Code:

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


All times are GMT. The time now is 03:38 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.01031 seconds
  • Memory Usage 1,721KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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