vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Include php (https://vborg.vbsupport.ru/showthread.php?t=218435)

vbronald 07-12-2009 02:49 PM

Include php
 
- Plugin
I have made and activated a Plugin with the flowing information:
Hook Location: global_start
Title: btnSolvedPHP
Execution Order: 5
Plugin PHP Code:
ob_start();
include('customcode/btnSolved.php');
$includedphp = ob_get_contents();
ob_end_clean();

- Template
Then in the default template I've set the $includedphp at the right place:
So in 'postbit' right under '$template_hook[postbit_userinfo_right]' I add the line '$includedphp'

- File
In the file 'customcode/btnSolved.php' I put the folowing testing-code:
PHP Code:

<?php
echo 'qqq';
?>

- Result must be that in a post header right under the postcount there has to be a line 'qqq'.
But that is not the case fortunately.:confused:

When I change the plugin-code to:
$includedphp = 'qqq';
there is olso no line shown.

Plugin-system is enabled and the plugin is also enabled. File and folder rights are 666.
What can be the problem here?

Lynne 07-12-2009 03:01 PM

Maybe a stupid question, but, are you sure you are using the postbit template on your site and not the postbit_legacy template? And, are you changing the correct style templates?

vbronald 07-12-2009 03:25 PM

Hi Lynne

If I put some text direct into the 'postbit' right under '$template_hook[postbit_userinfo_right]' then the text is shown at the right place.

I think that awsers your'e reaction :)

Andy 07-12-2009 03:28 PM

Quote:

Originally Posted by vbronald (Post 1847488)

When I change the plugin-code to:
$includedphp = 'qqq';
there is also no line shown.

Try putting $includedphp on the last line of the ad_header_logo templete.

You should see 'qqq' under the header.

vbronald 07-12-2009 03:47 PM

That's correct Andy.

ad_header_logo is empty in my case.
But yes when I put $includedphp into ad_header_logo then I see 'qqq' in the right of the header.
Do you know why 'qqq' is not being shown in the postbit and is being shown in the ad_header_logo?

I think it is remarkable that direct text is shown in postbit and a include not.

EDIT: I think it is remarkable that direct text is shown in postbit and a include not or only the content of a variable.

Andy 07-12-2009 06:37 PM

Quote:

Originally Posted by vbronald (Post 1847514)
Do you know why 'qqq' is not being shown in the postbit and is being shown in the ad_header_logo?

The problem might be the placement of the variable. Try placing the variable directly below this part of the template.

Code:

<if condition="$post['joindate']"><div>$vbphrase[join_date]: $post[joindate]</div></if>
Does 'qqq' show?

Lynne 07-12-2009 08:06 PM

echo will spit out the text as soon as the code it run - which is in the global_start plugin. If you want to put the code somewhere specific, you need to save the result to a variable and then spit the variable out where you want it (no echo statements in this method).

vbronald 07-13-2009 06:53 PM

Andy:
I did what you asked and unfortunately there is no text shown anywhere on the page.
Man this is my fist time editing vbulletin and that makes thinking to a solution difficult. :)

Lynne:
Indeed. The global_start plugin runs the plugin.
The plugin runs the php-file and set the result in the variable $includedphp.

I put the variable in the right place with the Style Manager.
Now..
When I put the variable in the style-template ad_header_logo then the value of the variable is shown correctly>
But when I put the same variable in the style-template postbit then the value of the variable is not shown.
Remarkable is that when I put direct text in the style-template then it is shown correctly.


All times are GMT. The time now is 07:14 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.01195 seconds
  • Memory Usage 1,732KB
  • 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)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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