vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [vBulletin 4] Simple way of including an external PHP file (https://vborg.vbsupport.ru/showthread.php?t=242454)

acast 12-30-2012 12:24 PM

Quote:

Originally Posted by kh99 (Post 2393594)
So far that all looks OK.

So, i have to make a plugin to register those two variables or what? I am little bit missing right now.

kh99 12-30-2012 12:26 PM

Well, right, you'd have to do that in php, which means a plugin or modifying a script. But the issue seems to be where those variables are coming from. The code you posted looks like you're trying to capture the entire output of vbtrade.php into each of those variables, which won't work. But I'm not sure what to tell you to do instead of that.

Edit: I'm thinking now that you don't need this "include external files" thing at all. If you're trying to modify vbtrade.php to work with vb4, then you probably want to edit that script and change the way the templates are rendered.

acast 12-30-2012 02:02 PM

1 Attachment(s)
Quote:

Originally Posted by kh99 (Post 2393602)
Well, right, you'd have to do that in php, which means a plugin or modifying a script. But the issue seems to be where those variables are coming from. The code you posted looks like you're trying to capture the entire output of vbtrade.php into each of those variables, which won't work. But I'm not sure what to tell you to do instead of that.

Edit: I'm thinking now that you don't need this "include external files" thing at all. If you're trying to modify vbtrade.php to work with vb4, then you probably want to edit that script and change the way the templates are rendered.

You mean the end of my vbtrade.php?

Code:

$templater = vB_Template::create('forumdisplay_sortarrow');
$templater->register_page_templates();
$templater = vB_Template::create('vbtrade_main');
$templater->register_page_templates();
        $templater->register('pagetitle', $pagetitle);
        $templater->register('alt', $alt);
        $templater->register('stocktable', $stocktable);
        $templater->register('preview', $preview);



print_output($templater->render());

How can i change the way the templates are rendered?

kh99 12-30-2012 02:10 PM

OK, that's already written for vb4, so it doesn't need to be changed. Sorry, I probably just misunderstood what you're trying to do.

You said you're trying to modify a vb3 plugin for vb4, so you were right, if it involved using variables in a template, you might have to register them. Is your vb3 plugin code calling fetch_template() then eval()?

Edit: OK, I just noticed that the code you posted above from vbtrade.php is rendering the vbtrade_main template and already registers $stocktable and $preview, so I'm lost. What does the plugin do?

acast 01-09-2013 11:28 AM

Quote:

Originally Posted by kh99 (Post 2393612)
OK, that's already written for vb4, so it doesn't need to be changed. Sorry, I probably just misunderstood what you're trying to do.

You said you're trying to modify a vb3 plugin for vb4, so you were right, if it involved using variables in a template, you might have to register them. Is your vb3 plugin code calling fetch_template() then eval()?

Edit: OK, I just noticed that the code you posted above from vbtrade.php is rendering the vbtrade_main template and already registers $stocktable and $preview, so I'm lost. What does the plugin do?

Sorry for asking again, friend, but i'm still working on this, and there is no way. I still don't understand if i have to register in plugins, the variables that appear in the "if" in the templates, or if it will work because there are registered in the php.

TheSupportForum 05-04-2013 02:14 PM

is there anyway to get this to work in an Iframe

i try
HTML Code:

<iframe src="{vb:raw perm}" width="530" height="600" frameBorder="0" class="leftColumn"></iframe>
and the page ends up blank and not including it

this is the plugin i use

PHP Code:

ob_start();
  require_once(
'url/perm/perm.php');
  
$perm ob_get_contents();
ob_end_clean();
vB_Template::preRegister('citizens',array('perm' => $perm)); 


BirdOPrey5 05-05-2013 11:19 PM

If what you want is the output of $perm in the iframe simply make the iframe src="url/perm/perm.php"

TheSupportForum 05-06-2013 06:42 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2420129)
If what you want is the output of $perm in the iframe simply make the iframe src="url/perm/perm.php"

thats what i am having to do right now, its easy to include perm.php as a {vb:raw perm} once i setup a plugin to include it in 1 template but i have no idea why i can't just use

HTML Code:

<iframe src="{vb:raw perm}" width="530" height="600" frameBorder="0" class="leftColumn"></iframe>
<iframe src="{vb:raw temp}" width="530" height="600" frameBorder="0" class="leftColumn"></iframe>

which is the ideal scenario i want as both these files connect to tables in phpmysql

BirdOPrey5 05-06-2013 08:30 AM

From the code you posted above, $perm = ob_get_contents();

That means $perm is the contents of the output buffer or the output (presumably) of the perm.php page. NOT a URL.

But the iframe SRC is looking for a URL ONLY. You can't put iframe content in the src= attribute.

Actually, it appears HTML5 does allow you to specify the code in the iframe but it uses the srcdoc attribute - http://www.w3schools.com/tags/tag_iframe.asp

Impromptu 12-18-2013 02:37 AM

Hi there,

For some reason I can include the PHP file, but my header and navbar goes funny.

I know it's the plugin in as when I turn the plugin off, the header and navbar works fine. The header and navbar works fine, but it changes to:

My navbar/headers are #vbtab_form# $tab_mdu1_245 and #vbflink_pms# #vbmenu_community# and I'm missing some of my footer menu links.

Very odd that it works but my css stuffs up.

Thank you for your help.

Cheers


All times are GMT. The time now is 10:57 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.01952 seconds
  • Memory Usage 1,750KB
  • 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
  • (2)bbcode_html_printable
  • (1)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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