We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

I try to call a plugin controller HTML view inside a floatbox | Forum

Topic location: Forum home » Support » General Questions
Stephan Van der Vaar
Hi everyones!


I need your help.


I try to call a plugin controller HTML view inside a floatbox but that shows an error.


Can you helpme please? I have attached an image of the error


This is the code that I am using:   $fileUp = file_get_contents(OW::getPluginManager()->getPlugin('GROUPFILES')->getCtrlViewDir() . 'action_add.html');

            $this->setTemplate($fileUp);

        

            $script = " $(document).ready(function(){

                        $('ul.ow_box_toolbar li a').attr('id', 'groupfiles_floatbox');

                        $('a#groupfiles_floatbox').click(function(){

                            window.groupfilesFloatBox = new OW_FloatBox({\$title:'Some Floatbox Title here', \$contents: '{$fileUp}', width: '550px'});

                        });

                    });";

                    OW::getDocument()->addOnloadScript($script);

Attachments:
  error.png (299Kb)
dave Leader
dave Dec 13 '16
It looks like your displaying your html instead of executing it.  Can you show your html file please, just attach it as a txt file. 
The Forum post is edited by dave Dec 13 '16
Stephan Van der Vaar
Hi, of course.


I want to display a form to upload files for groups, acttualy this form opens on a diffent page, and I want this form to open in the floatbox.


I have attached the txt file.

Attachments:
  action_add.txt (2Kb)
dave Leader
dave Dec 13 '16
Your file looks fine to me,  no obvious syntax issues, however i dont know how to do a floatbox so sorry about that. 


I do feel you need to have the page code in your init file which calls the php file and then have an associated html file.  I dont know if assigning the page file to a var will work like you have it, never seen it done that way.


like this, inside init.php file 


OW::getRouter()->addRoute(new OW_Route('pluginname.index', 'pagename', 'PLUGINNAME_CTRL_Pagename', 'index'));


replace pluginname with your plugin name (lowercase)

replace pagename with your pagename  (just the name no extension)

replace PLUGINNAME  with your plugin name  (all caps)


replace Pagename with pagename (first letter is uppercase) unless you have name separator like test_one  then you have to do it like this TestOne


Also this is a duplicate of  your other support request, please stick with one support request if you have the same issue, thanks. 


Use any of my free plugins as an example if you want to. 


 

The Forum post is edited by dave Dec 13 '16