Trust me, you will do yourself and everyone using your app a favor if you don't separate the frontend and backend into two apps. Most of us would just use plugins and/or admin prefixing to cleanly separate the two inside the app.
/ /frontend-controller/ /admin /admin/backend-controller Routing like this works just fine in all cases I have ever encountered. And it is what 99% of all people would expect. One should not overengeneer stuff - its like shooting yourself in the leg here. Am Mittwoch, 26. März 2014 09:57:46 UTC+1 schrieb bato: > > Hi Mark, > thanks for the answer :) > Do you intend using Plugin for backend or frontend? However the common use > case we have to handle is: > > > - frontends and backend live on the same server and are served by the > same web server > - one backend used to manage data for two or more frontends > - backend and each frontends have different url. Example: > - backend: http://admin.customer-name.com > - frontend 1: http://site1.com > - frontend 2: http://site2.org > - etc... > > Is it possible handle with plugins this situation? > > On other side we like having separate app for backend and frontends > because it give us the possibility to use different plugins for every app > and have frontend as app seems more polished. > But if there is a simple way to handle it with plugins I like to know so > we can think about it. > > > Alberto > > > > 2014-03-26 2:41 GMT+01:00 mark_story <[email protected] <javascript:>>: > >> Have you considered using plugins? If the 'backend' and 'frontend' >> application run in the same process/server you could probably use plugins >> quite nicely. If they run on separate servers it gets a bit more >> complicated. >> >> By using a plugin you can use basic composer features to install the >> backend code into the frontend one and avoid having to define the full >> classname everywhere as you can use Plugin.Foo style class names in most >> places (if there are className options that don't support Plugin.Class let >> us know) >> >> -Mark >> >> On Tuesday, 25 March 2014 19:19:20 UTC-4, bato wrote: >>> >>> Hi there, >>> >>> I played a bit with new ORM and now I'm starting to port BEdita to Cake >>> 3. >>> BEdita is a Semantic Content Management Framework developed with cake >>> 1.3. The backend is a cake app that can manage multiple frontends data. >>> Every frontend is a cake app too that uses a set of api that are exposed >>> from backend app. >>> >>> Backend and frontend apps share cakephp lib and backend models, >>> behaviors, helpers are reachable from frontends since they are added to >>> paths with App::build(). >>> >>> Now I try to figure out as reproduce the "same" situations with cake 3 >>> and I would ask some advice. >>> >>> I'm starting creating the backend app with composer, then I added >>> frontend app by hand beacuse I want to reuse cake core installed in backend >>> app. >>> So my directory structure is >>> >>> - bedita: containing app (Bedita\\ namespace) and vendor with cakephp >>> - frontend-app: clean cakephp app skeleton >>> >>> >>> ├── bedita >>> │ ├── Bedita >>> │ ├── Module >>> │ ├── Plugin >>> │ ├── Test >>> │ ├── tmp >>> │ ├── vendor >>> │ └── webroot >>> └── frontend-app >>> ├── App >>> ├── Plugin >>> ├── Test >>> ├── tmp >>> ├── vendor >>> └── webroot >>> >>> To use cake and bedita in frontend app I managed App/config/paths.phpand >>> App/config/bootstrap.php >>> >>> In App/config/paths.php I added the path to bedita folder and modified >>> CAKE_CORE_INCLUDE_PATH to use that. >>> In App/config/bootstrap.php I change composer autoload path to >>> bedita/vendor/autoload.php >>> and added to it App namespace >>> >>> // Use composer to load the autoloader. >>> if (file_exists(BEDITA_CORE_PATH . '/vendor/autoload.php')) { >>> $loader = require BEDITA_CORE_PATH . '/vendor/autoload.php'; >>> $loader->addPsr4('App\\', APP); >>> } >>> >>> After that in frontend app PagesController I am able to do: >>> >>> $images = TableRegistry::get('Images', [ >>> 'className' => 'Bedita\Model\Table\ImagesTable' >>> ]); >>> >>> The only thing I had to pay attention is how to add behavior in Bedita >>> Table objects. I had to specify the behavior className to avoid errors >>> using those Table objects in frontend app. >>> >>> $this->addBehavior('BeditaObject', [ >>> 'className' => 'Bedita\Model\Behavior\BeditaObjectBehavior' >>> ]); >>> >>> >>> So I ask you CakePHP core dev/guru if it is the right way to handle this >>> case or if you have some suggestion or advice. >>> >>> regards >>> Alberto >>> >>> >>> -- >> Like Us on FaceBook https://www.facebook.com/CakePHP >> Find us on Twitter http://twitter.com/CakePHP >> >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "CakePHP" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/cake-php/MHdseZKF4ts/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/cake-php. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > ------ bato ------- > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
