My intention is to create a working island of richness in a PHP based web application built with Yii 2.
That means I have a route, say /cars/index
, that is currently being rendered server-side by Yii. Now I want to move the Yii template code to an Ember template.
The Ember code is assembled using Ember-CLI's ember build
. I have created softlinks from inside the Yii public web
directory to the two Ember files dist/vendor.js
and dist/app.js
so that the code can be accessed from a web browser. For this storeConfigInMeta: false
had to be set as depicted here: ember-cli meta config/environment file.
While I have successfully got Ember to run my code by using the ember-islands addon the goal is to keep the MVC structure, making use of the Ember application's models and controllers. This is to allow for a potential full shift to client-side rendering in the future, and it cannot be achieved with components only.
Unfortunately all I found when researching this topic was that I had to disable the creation of an Ember.Application
and then create such an object by hand. This approach does not fit my use-case because that way I cannot make use of Model and Controller code in the server-side templates. Or can I?
Plus, how can we then route to /cars/index
without letting the framework throw an error about Yii's route not matching this format (currently something like /index.php?r=cars/index
)? (Uncaught UnrecognizedURLError)
Aucun commentaire:
Enregistrer un commentaire