The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
What is the proper syntax for calling a function in a plugin?
Here's my issue, I'm including a file that defines a function called newsfeed(). Here's my plugin code currently: (HOOK: global_complete) Code:
ob_start(); include('magpierss/rss_parse.inc'); newsfeed("http://rss.cnn.com/rss/cnn_topstories.rss",5,"CNN HEADLINES"); $cnn=ob_get_contents(); ob_end_clean(); However, what happens, is that the feed shows up at the very top of the page, not where I put the $cnn call. Is there something I'm not doing properly? Any help is appreciated. Thanks in advance. |
#2
|
||||
|
||||
![]()
It could likely not be accessing the variable $cnn correctly... when you have a variable inside a function, you have to make it global, which I think works like so:
Code:
global $cnn; // define it outside of the function function myfunction() { global $cnn; // call it from outside so it knows dostufff(); $cnn = something(); } echo "$cnn"; |
#3
|
||||
|
||||
![]() Quote:
So, really, all the plugin needs to do is: include("functionfile.php"); newsfeed() And that's it. I got it to work, it just doesn't show up in the right place. bump |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|