Log in

View Full Version : Include php


vbronald
07-12-2009, 02:49 PM
- 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
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
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
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.


<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.