PDA

View Full Version : do notices support php or plugins? Its not working...


doob
10-15-2010, 07:28 AM
I'm trying to use a php includes function OR a vbulletin plugin within a "notice" in the notice manager so I can write once and reuse a short code in multiple notices.

Something like this is NOT working:

<?php include("http://www.website.com/file.php"); ?>

Also tried this
<?php readfile('http://www.website.com/file.php'); ?>

Plugin code is not working either. I created something like this in the plugin manager:

ob_start();
include('../notices/notice.php');
$include_notice = ob_get_contents();
ob_end_clean();

And then placed this into the notice manager field but it did not work either:
$include_notice

Instead, that code just printed.

Is there some reason that notices don't support php or plugins or am I missing somthing?

Lynne
10-15-2010, 01:48 PM
You may only put html in the notices.

doob
10-18-2010, 04:13 AM
Thanks Lynn. Can you or anyone else offer any explanation as to why?

It seems like every other template system in VB supports php... In fact the notice system itself is running based on php code, so who won't php code run within it?

Also you didn't answer about notices supporting plugins. I'm still learning the plugin system so is it my plugin code that's not working or does the notice system not support plugins either?

thanks all.

Lynne
10-18-2010, 04:20 AM
Why? Because they are just supposed to be easy notices to add to the top of the forum. If you want php, write a plugin and spit out the content of that in the navbar template (isn't there a template_hook right at the bottom?).

And you can't use php in other templates either, so I'm not sure what you mean that other templates support php.

You may put html in the notices not variables that are derived from plugins.

doob
10-18-2010, 05:33 AM
Lynn, the suggestion, then, is to not use the notice mechanism if I want to use php, but instead to code whatever php I want to use into the navbar template itself?

If that's the suggestion, yes I suppose I could do that, but I'd prefer to find a way to utilize the very handy management tool that the notices represent.

Does anyone else have any helpful suggestions as to how I might use an includes function within the notices to include an external page (php, html or otherwise) rather than having to paste complete html code into the notice manager??

I.e. If I want the same complex code in 12 different forums it would be much nicer to reference a single external page where any changes or updates could be made rather than editing 12 different notices for each change...

-Thanks.

BirdOPrey5
10-18-2010, 05:40 PM
Since you can use HTML in a notice you can use am <IFRAME> and then put all the php code you need on the page displayed in the IFRAME.

Also you can't put php in any template anywhere, including the navbar... php only goes in plugins and .php files.

doob
10-19-2010, 06:36 AM
Thanks for the IFRAME suggestion. I haven't tried using Iframe's for years and when I did had some problems with them, perhpas with older browsers. I guess its time to give them a try again!

Not sure what I was thinking w/ regards to php in templates. Just a mental lapse I guess.

Thanks again.

BirdOPrey5
10-19-2010, 11:51 AM
IFRAMES are very common these days and used all over in places you wouldn't expect (facebook like buttons for example)- IE6 and newer, maybe even older than that have no problems with IFRAMES.