Spread VueJs views accross multiple Symfony bundles - php

as you can already read in the headline my question is all about symfony (6) and vuejs (3).
I want to create an application that has the ability to add certain features via bundles.
In theory, this will look like this:
foo/bar -> main application
foo/dashboard -> adds a new dashboard
foo/customers -> adds a UI for what ever :P
In this example foo/bar serves the backend (navbar, login etc) and foo/dashboard adds an additional dashboard and foo/customers is another ui element ...
Of course this is just an example to better describe what I mean.
I really want to use vuejs for the "frontend" part.
And there comes my question:
Is it possible to spread vuejs files accross multiple bundles?
Has anyone of you an idea how I could solve that problem?
Thanks in advance.

Related

Yii2 advanced, when to use the frontend folder and when the backend folder?

I recently started learning the yii2 framework for my internship in the advanced template. But I don't really get when you need to use the backend folder instead of the frontend folder. If someone could explain it, it would be appreciated.
Its verry easy.
Backend is your admin page, and frontend is your user page.
Let me explain.
You have models, what your backend use, and frontend use. If both have to use, you have to use common folder to share models with back and frontend.
When you make an app, in frontend you can create everything, what user need. Like registration, login, about us, etc.
In backend this will be your admin page. Like user search, modify rows, etc.
If any of your model need to user, and to admin, like user table, you have to use common folder. Then frontend, and backend will see this model. Be carefull with roules.
I hope i helped. :)
Frontend is typically what is presented to end user, the project itself. Backend is admin panel...
https://www.yiiframework.com/extension/yiisoft/yii2-app-advanced/doc/guide/2.0/en/structure-applications
Common - This directory used for common functionalities i.e. if we want to use same functionality in both backend and frontend in that case we can use this.
Frontend - This directory is used to create the website that is presented to end user.
Backend - This directory is used to implement the interface to manage that website (admin panel).

Joomla component application flow

I am new to Joomla component developement and currently fighting with certain basic design patterns!
Lets say, I am developing a component where users can enter simple notes into their personal notebooks.
On calling the view "index.php?option=com_notebook&view=notes" I simply show a list of all note entries of the user. No problem so far, this is working fine.
Now I want to extend my component with the following feature: on opening the view "index.php?option=com_notebook&view=notes", I want to check if the user has already created a notebook before. If yes, I show all note entries, if not, I want to load a different view which contains a form to create a new notebook with certain options.
But how can this be done in a clean way?
For sure, I just can implement the form within the view "notes", but this is not the clean way, isnt it?
I also tried to override the function "display()" of the main controller and set the view manually if no notebook exists. But if I do so, I have to handle all calls to other views of my component manually within the function "display()". To solve this, I created a copy the original implementation from the class "JControllerLegacy" and changed it to my needs - this is working - but is this really the best way to handle problems like this?
So I ask you, what is the best approach to solve this problem?
Thx a lot!
According to me the best solution of your problem is to provide "New" and "Edit" button to your notebook listing page and create edit view of notbook. Same as Joomla has articles and article views.
So, As you mentioned above if use dose not have any notebook then he/she can create a new notebook using that "New" button. when user clicked on "New" button he has blank form where he/she can create new notebook.
here is the example how to create listing and edit view in Joomla. Hope this will help you.
https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_backend_actions

Is it possible (and how to?) divide application to backend (admin part) and frontend (user part) parts?

I am developing web application, using zend framework 2. In my app, I want some modules. News, for example, users etc.
Is it possible, to divide whole application to two big parts: front-end (for users) and back-end (for admins).
In front-end there will be part of News module, which render news list, full news item etc.
In back-end there will be part of News module, which will render list of all news, tools for editing, deleting etc.
At the moment, I have simple structure:
I have MyZfcAdmin module, with routes configurated so, that when I am writing /admin/news/edit/5 it will call NewsController edit action with id 5 and render it. So now, I have all actions (for admins and for users) in one controller. Is it possible to create something like this:
module
frontend
News
SomeMoreModule
backend
News
SomeMoreModule
I found topic on google questions, in that suggested to use this CMS, but I want to try it by myself.
Different people have different idea in managing application, for me I will have news module that handle all news related calls both admin parts and user accessible parts. The idea you have described have some side effects like duplication of code between modules and crossing of borders between isolate modules like calling action in another modules(it's ok if there are related or fall in hierarchy), which may have issues in long term maintenance of the applications.
IMHO I might suggest you could create modules like News, users, etc where it can have combined functionality of both admin and user access. You can later include user authorization plug ins using bootstrap events and restrict action accessible by admin and other users
There is not concept of submodules inside any module. But you can give them proper naming conversations. If code is not formed in oops properly, then there can be code duplication into your project. As per #raj's answer, it's good to give restrictions based on user role. If any action is not intersecting admin and user role then you can separate those actions, but actions like add or edit news content are same for both role then you should point to same action by router.

share models, libraries and helpers across both the front and backend

I created one application in codeigniter. But Now I want to move that to admin side. I have read 3 methods from http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter. Here I decided to use second one.
I that I created an admin folder in controller, admin folder in views,admin folder in css, and an admin folder in js to store the files like admin side controller, admin side views , admin css and admin js. I have set $route['admin']='application/admin';
And my question is:
When I access the file http:example.com/admin I am getting the page without js and css. How to solve that.
And one more question:
$this->load->views('add_user'). This statement changed to $this->load->views('admin/add_user')
Its difficult to change each and every page.
You can share models and libraries between applications by using CI 2 "Packages". Have a look in the Loader documentation to see how that works.

Using Symfony, sfDoctrineGuardPlugin plugin, How can i customise sf_content? Using partials?

I am using symfony 1.4.8 with sfDoctrineGuardPlugin for my backend.
My question is how can i customise sfDoctrineGuardPlugin's default content? For example, how can i do something on the page between filter and table (on the left hand site)? Or, how can i customize table (http://goo.gl/ZmRey)?
I cannot find any solution for using partials on backend. Is there any way to use partials/components/slots on backend?
I hope you understand my question and tell me a way.
Thanks for your answer(s),
Erman
Partials, components and slots are no different on the back-end to the front-end - your "backend" is just another Symfony application. From the screenshot you gave, it looks like you're looking to customise the admin generator theme.
The quickest way to get started with this is to look in your cache/appname/ folder and see the automatically-generated modules here, with all the template files, partial files and so on. You can then create an empty module in your application, and override select parts of the theme with whatever you want to change. See this part of the Symfony docs for a full list of partials etc, and how to go about overriding them in more detail.
In the specific case of sfDoctrineGuardPlugin-module pages, these can be overrided in the same way as normal modules - simply create eg an sfGuardAuth module and override the selected parts of the module you want to.
If you want to go further and create your own admin generator theme, this is a bit more advanced. Here I will shamelessly promote a blog post I wrote last year ;-) John Cleveley's presentation also provides some great tips.

Categories