Build the project multi-module project, the Volt engine does not work, JS,CSS load does not respond, partials is not good, the view can not output, it seems that the Volt engine is not registered success or other reasons?
PS: But it comes with the engine. Files with the suffix. phtml format can be introduced in the manual js,css,partials file. On the basis of the above, after the suffix into the. volt format, what else needs to be changed to make it so?
Directory structure
The following is some of the code in config/services.php, which is automatically generated when the project is built.
$di->setShared('view', function () use ($config) { $view = new View(); $view->setViewsDir($config->application->viewsDir); $view->registerEngines(array( '.volt' => function ($view, $di) use ($config) { $volt = new VoltEngine($view, $di); $volt->setOptions(array( 'compiledPath' => $config->application->cacheDir, 'compiledSeparator' => '_' )); return $volt; }, '.phtml' => 'Phalcon\Mvc\View\Engine\Php' // '.volt' => 'Phalcon\Mvc\View\Engine\Php' )); return $view;});
The module.php under the module is still generated when the project is produced, no change!
In the Views/index.volt
Load partials
{{ partial("partials/header") }}{{ partial("partials/main") }}{{ partial("partials/footer") }}
Load JS
{{ javascript_include("/js/1.11.3.jquery.min.js") }}
Reply content:
Build the project multi-module project, the Volt engine does not work, JS,CSS load does not respond, partials is not good, the view can not output, it seems that the Volt engine is not registered success or other reasons?
PS: But it comes with the engine. Files with the suffix. phtml format can be introduced in the manual js,css,partials file. On the basis of the above, after the suffix into the. volt format, what else needs to be changed to make it so?
Directory structure
The following is some of the code in config/services.php, which is automatically generated when the project is built.
$di->setShared('view', function () use ($config) { $view = new View(); $view->setViewsDir($config->application->viewsDir); $view->registerEngines(array( '.volt' => function ($view, $di) use ($config) { $volt = new VoltEngine($view, $di); $volt->setOptions(array( 'compiledPath' => $config->application->cacheDir, 'compiledSeparator' => '_' )); return $volt; }, '.phtml' => 'Phalcon\Mvc\View\Engine\Php' // '.volt' => 'Phalcon\Mvc\View\Engine\Php' )); return $view;});
The module.php under the module is still generated when the project is produced, no change!
In the Views/index.volt
Load partials
{{ partial("partials/header") }}{{ partial("partials/main") }}{{ partial("partials/footer") }}
Load JS
{{ javascript_include("/js/1.11.3.jquery.min.js") }}
Paste the code portion of your volt template registered in Di
Paste your loading JS, CSS part of the code
Paste the part of your code that uses partial
Sticker Code! Sticker Code! Sticker Code! Re-say three! No code to mention code-related issues, are bullying
$di->set (' View ', function () use ($config) {$view = new view (); $view->setviewsdir (app_path. $config->application->layouts_dir); $view->registerengines (Array ('. Volt ' = function ($view, $di) use ($config) {$v Olt = new Voltextension ($view, $di); $volt->setoptions (Array (' compiledpath ' = App_path. $config->ap Plication->cache_dir, ' compilealways ' = $config->application->debug, ' Compiledseparator ' = ' _ ', ' Layoutdir ' and $config->application->layo Uts_dir,)); if (!empty ($config->volt->extensions)) {foreach ($config->volt->extensions as $extension _c Lass_name) {$di->get (' volt.extension ')->register ($volt, New $extension _class_name ($di)); } } return $volt; }, '. phtml ' = ' phalcon\mvc\view\engine\php ' ...); return $view;}, True);
Directory structure
The following is a partial code in config/services.php, which is generated automatically in the build project
$di->setShared('view', function () use ($config) { $view = new View(); $view->setViewsDir($config->application->viewsDir); $view->registerEngines(array( '.volt' => function ($view, $di) use ($config) { $volt = new VoltEngine($view, $di); $volt->setOptions(array( 'compiledPath' => $config->application->cacheDir, 'compiledSeparator' => '_' )); return $volt; }, '.phtml' => 'Phalcon\Mvc\View\Engine\Php' // '.volt' => 'Phalcon\Mvc\View\Engine\Php' )); return $view;});
The module.php under the module is still generated when the project is produced, no change!
In the Views/index.volt
Load partials
{{ partial("partials/header") }}{{ partial("partials/main") }}{{ partial("partials/footer") }}
Load JS
{{ javascript_include("/js/1.11.3.jquery.min.js") }}