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

include js file according to there controller and action name

I am using phalcon php framework for my application.

This application is verry interactive using javascript verry often.

Is there an class / service that also wil include the js controller according to there name, else if it's not found include the 'main' javascript file?

For example I am requesting the url:
https://www.mysite.com/search/keyword

So phalcon will execute the searchController with the indexAction including the parameter.

The data returned from the indexAction function will be passed to the views.

The view will also include js/search/index.js

(maybe additionally including a css file css/search/index.css!?)

Is there a function for this type of hierarchy functionality for js?

edited Apr '14

there is no such funtionality built in as far as I know .. but you can maybe do something like this when setting up your assets service in services.php -> https://fixee.org/paste/oqh42gc/

this is untested, but should work

@digitronac It's not an official forum policy, but it's probably best to stay away from Internet speak (ie: afaik), simply because not everyone on these boards has English as a first language, and might not understand what terms like that mean.

@quasipickle okay, i usually hang out on phalcon's irc channel so i suppose i got used to it :)