Including other modules functionality into mine

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
ortegaj

Including other modules functionality into mine

Post by ortegaj »

There is no need to reinvent the wheel so how can I include some functionality of other modules into mine?

My module needs to browse the server for images (sometimes to upload them) and I first try the fckeditor and try to remove all toolbar buttons except for IMG.  Then I realized that there are 2 file managers with no wysiwyg stuff so that is perfect.

How can I insert a button in my module to get a file, upload it if necessary and return  the abs path or relative path  of the selected file?

I could do my own functions for that but since both file managers are great and have a nice GUI I wish to use them.

J
cyberman

Re: Including other modules functionality into mine

Post by cyberman »

If you need help to create a module skeleton module or module maker are good starting points.
ortegaj wrote: How can I insert a button in my module to get a file, upload it if necessary and return  the abs path or relative path  of the selected file?
Hmm, sound like Uploads module ...

If you wanna use functions from another module you can "include" it with a function like

Code: Select all

	function GetDependencies()
	{
		return array();
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Including other modules functionality into mine

Post by calguy1000 »

you can do a:

Code: Select all

$module = $this->GetModuleInstance('ModuleName');
then call any method in that module.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
ortegaj

Re: Including other modules functionality into mine

Post by ortegaj »

On the CMSMS site I found this:

Code: Select all

global $gCms;

  if( !isset( $gCms->modules['FileManager'] ) || !isset( $gCms->modules['FileManager']['object'] ) )
    {
       return;
    }
  $themoduleiwant = $gCms->modules['FileManager']['object'];
  //$themoduleiwant->DoThis($somedata);
  //$themoduleiwant->DoThat($somemoredata);
but it says  for modules with frontend.



I also tried  this as  posted in this topic

Code: Select all

$module = $this->GetModuleInstance('FileManager');
then call any method in that module.
but I cant figure out how to make the module show its  admin panel. 

FileManager  (not the buli-in)  does not appear to have any methods



All I want is to be able to place aa button (done) in my EDIT XXXXX  page so one of the fields  is populated with the filename (of theimage) of the selected image (or thumbnail) that was displayed on a popup windows with all images of one dir.  This functionality i habve made in other apps but there is no use into converting that into cmsms if that's already done.



Once I can use other modules I can manage all those things but right now I can't use any module.

If you could be more specific with a short example...
Post Reply

Return to “Developers Discussion”