We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

InnovaEditor - or how to install other people's js stuff

I'm trying to migrate over to phalcon from Codeigniter, and we use InnovaEditor to allow in-browser text editing that saves as html code.

In CI, it's in /editor, right under the html/application folder. I tried to put it in phalcon under /html/myApp, right alongside /app and /public.

I can't seem to reference it right. I tried some funkiness in the .htaccess, then I tried

$this->assets->addJs('/editor/scripts/innovaeditor.js'); //in the controller

and

<?php $this->assets->outputJs(); ?> //In the view

I think my ignorance strikes again. How can I load this on a view so it can do it's thing?

J



5.1k

Hi

In the controller


class IndexController extends ControllerBase
{

    public function initialize()
    {
        parent::initialize();

        $this->tag->setTitle('Index');
        $this->assets->addCss("css/index.css");
        $this->assets->addJs("js/index.js");
   }

    public function indexAction()
    {
    }

}

In the index.volt view


<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
       <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
        {{ get_title() }}
        <link rel="icon" type="image/png" href="{{ url('/images/favicon.png') }}">
        <!-- CSS - 
        ================================================== -->       
        <!-- Bootstrap css file-->
       {{ stylesheet_link('css/bootstrap.min.css') }}
        <!-- Font awesome css file-->
       {{ stylesheet_link('css/font-awesome.min.css') }}
        <!-- main theme css file-->
       {{ stylesheet_link('css/theme.css') }}
        <!-- ccs dedined in controller -->
        {{ assets.outputCss() }}
    </head>
    <body>
        {{ content() }}
        {{ javascript_include('https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js') }}
        {{ javascript_include('js/bootstrap.min.js') }}
        <!-- js dedined in controller -->
        {{ assets.outputJs() }}
    </body>
</html>