I want to pass a variable, or assets from my action to my main template:
my controller:
<?php
namespace Frontend\Controllers;
use Frontend\Controllers\KernelBase;
use Common\Constants\BtsConstants;
class GeneralController extends KernelBase implements BtsConstants {
public function initialize() {
parent::initialize();
$this->view->setMainView('common');
$this->assets
->collection('jsCommon')
->setTargetPath('js/unifymin/unify_frontend_kernel.min.js')
->setTargetUri('js/unifymin/unify_frontend_kernel.min.js')
->addJs('js/vendor/jquery/jquery-2.1.3.min.js')
->addJs('js/vendor/bootstrap/3.3.4/bootstrap.min.js')
->addFilter(new \Phalcon\Assets\Filters\Jsmin())
->join(true);
}
public function showCaptchaAction(){
$o_captcha = new \Recaptcha();
$this->view->captchaHtml = $o_captcha->getHtmlCode();
$this->assets->addJs('js/vendor/bootstrap/3.3.4/bootstrap.min.js');
}
public function verifyCaptchaAction(){
}
}
i have common.volt:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="{{ config.client.description }}">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="MCETS Team">
<title>{{ config.client.siteName }} - COMMON PAGE </title>
{{ assets.outputCss('cssCommon') }}
{{ assets.outputCss() }}
</head>
<body>
{{ this.getContent() }}
{{ assets.outputJs('jsCommon') }}
{{ assets.outputJs() }}
</body>
</html>
I want to put my js, css that i added on my controller's action to my main view, how i can do that?
becouse i have the problem if i put the asset on my action , and the
{{ assets.outputJs() }}
on the action view, this cause problem with jquery becouse jquery frameworks is not load yet, an for purpose of performance the js files must be on the bottom of the page.
Help!