Recent Topics

1 Jul 14, 2008 10:20    

Hi,

I'm new to php but learning fast as it is very similar to Perl. :-) I have been playing around with a
rendering plugin. Looking at the source code from the following sources.
* Plugins that are included with b2evolution,The Sample Renderer Plugin, Test Plugin, The Skeleton.
* Code Highlight and Display Code Plugin by AstonishMe.
* Code Highlighter using GenSHi.
* CGeshi.
* Syntax Highlighter.

I have got the plugin working apart from a few extra bells and whistles. I would like to allow the admin of
a blog to add extra icons and to update the css file. When they do not have access to the actual b2evolution
install that is they are not the real 'root' user on the hostmachine. I therefore need to be able to
find out where the media directory is and also the url for the media directory. The user can then upload
their own icons and css files with the built in file manager and store them in the media directory for the
blog. Where my plugin can check they exist and use them in preferece to the files supplied by me :-)

I have found what looked like the answer with the two function calls:

get_media_dir()
get_media_url()

I am unable to access these from the renderer as they are not in the Plugin class but are part of the User class.
In php it seems that a derived class as in my renderer cannot inherit from two classes. I'm assuming I have
missed something here. It is something that I would have thought was possible

Thanks
Zaf.
:lol:

2 Jul 14, 2008 10:34

<?php
global $media_path, $media_url;
pre_dump( $media_path, $media_url );
?>

;)

¥

3 Jul 14, 2008 20:00

Thanks for the reply :) . I'm not exactly sure what I am going to do with the code though. When I paste the two lines into my plugin I get an error message.

[code]Parse error: syntax error, unexpected T_GLOBAL, expecting T_FUNCTION in /usr/share/b2evolution/blogs/plugins/code_sample_plugin/_code_sample.plugin.php on line 64[/code]

So I guess that is not the right place.

4 Jul 14, 2008 20:20

Assuming you want to use the code in your plugins function RenderItemAsHtml()

function RenderItemAsHtml( & $params )
{
  global $media_path, $media_url; 
  // $media path / url are now available in this function to your plugin ;)

¥

5 Jul 14, 2008 20:25

Thank you :)

sorted !


Form is loading...