I'm the frontend developer (strictly frontend) for a Yii2 project, and I've never worked with Yii2 before. I was sent the repo of the whole Yii2 site - front & backend, but my colleagues forgot to send me a database dump to work with.
But going through the views folder, I see what looks like everything required for a PHP site. Can I just set up a webserver and view / modify these locally without requiring the entire rest of the system including database?
Not really my area of expertise here, any advice is appreciated.
Related
I needed to know which folder is more suitable to host my Rest API in Yii2 template advanced, backend or frontend.
I also saw some examples where developers created a new directory, called it "api" and programmed the API from there, but I don't find much information by developing from this method.
If you know the most correct way to do it, I would apreciate if you could explain me.
That totally depends on your requirements if it is going to be a complete full app or just a single controller with a few actions or a single ActiveController.
But a good way is to keep things separate just like you are using the advance-app and you have the backend and frontend folders so that you can differentiate the code base, and keep the code in their concerned folders, those folders are actually 2 separate applications running separately with their own separate configurations i.e backend/config/* and frontend/config/*, and can share some common configurations like database and others from the common/config/*. Same like that you can create a separate application/folder where you can have all the code base and configurations related to api you are going to build.
You can find a very good reference for adding more apps into your existing application by Yii here on GITHUB which will clear your concept about how to add more apps.
Then you can go to this article by Budi Irawan's Tech Blog which uses the advance-app to add a new application for the API. You will find the directory structure with example models and controllers along with testing them with POSTMAN.
Backend and frontend are also just a folder in the Yii2 advance app with just namespace different, they are different for our understanding, it is not necessary that you use backend for backend purpose only.
So for the API, you can use any of these folders, but it is always recommended to put thing separately like we put backend thing in backend folder and frontend things in frontend folder.
It's totally up to you and your coding style.
i prefer putting Rest API into a separate module, for instance into "common\modules\api". that way i can "mount" the api in backend or frontend via configuration. Also, nice urls are automatically provided, like /api/<controller>/<action> (where api is the name of your module).
One more thing to consider is how to update your api. in case of modules everything is well organized. you could start with "v1" and put your controllers in here, and move up to "v2" with a different set of controllers. so your first api endpoint would read /v1/users, later on you can additionally provide /v2/users.
more about modules here
read "URL Rules" here
I need to port a CMS (to be sold and needing a certain look and feel) originally written in PHP and using a mysql database on Django. While researching this framework, I found that the default admin has all the base qualities I need. Now comes the difficult question; is it wise to use the default admin (styling it for the project's needs (i.e Django-jet)), or should I create all the pages needed individually (using metronics, for example) and leave the admin as is?
Do you guys have any other suggestions?
Thanks!!
This depends strictly upon project needs. If you do not want to spend too much time in building it from scratch thats fine you can control user access in admin panel using permissions and groups. In the past I have used Django Admin panel as is for my clients and they never cared.
But If its a big project with 10s of models and lots of users using admin panel, then its worth creating it from scratch.
With upgrade in Django 2.0 admin panel is responsive as well, and using packages like DJango-jet completely removes the need for creating admin view from scratch.
I'm working on a project on localhost. Its kind of a company management application based on some php framework. Basically I'm a front-end developer and I've to fix some pages, their alignments and color scheme. I'm using firefox. Every single time when I've to change the settings of any page I've to go the php dev who built the app and they located file for me in the project, obviously they knew the file structure of the whole project. So is there any possible way, tool, addon or plugin that can identify the specific file (which is currently open in my browser) for me? so that I can reach the file on localhost directly and edit it right away rather than bothering the php developers all the time. Firefox inspect element can identify the css files though. Any help would be appreciated. Thanks
Whilst I am familiar with HTML, CSS, SQL and some Javascript, I know nothing about PHP and my hours of searching on the Internet just takes me to tutorials which show me how to build PHP scripts from scratch, which is not helping me. I am not sure I entirely understand the concepts I am dealing with but I will try and explain as best I can.
I have been given a local copy of a database (developed by somebody else who for logistical reasons I cannot contact at the moment) in MySQL, on an Apache Tomcat server and utilising PHP which was developed in CakePHP and so has several templates from CakePHP. These are all running through Wampserver. The database 'BuddyMe' contains 3 tables - User, Roles and Business Units - and there are corresponding Views using the templates from CakePHP for displaying, editing, and adding entries in these 3 tables.
What I have - a series of files in the WWW directory of Wampserver for these views. These views are in CakePHP 'templates' (CTP files).
What I am trying to do - I have a series of HTML files which at the moment are totally separate from the CTP files. How can I incorporate the Views from the CakePHP templates into my HTML files? I've tried including the CTP files within an IFrame, but I get nothing. There are so many files in the Views that I cannot understand which bits of code I need to lift, or how I can otherwise access the Views from within my own HTML files.
I have gone round and round in circles trying to work this out, any help just to get me going in the right direction would be enormously helpful.
Our main website uses symfony 1, and by the time I started working on the code it seems impossible to upgrade (too much custom code from previous developer). Now we are adding a large addition to what the company offers. Instead of using a really old framework I wanted to use CodeIgniter, also since I'm very familiar with it. My real question:
What is a proper way of setting up a website to use multiple frameworks. The new features will be separate from the original website, but it will still need a few tables of the database.
I was going to have apache handle where the root directory was depending on the url and just do everything normally. The main website is example.com and the new feature will be abc.example.com
I'm really looking for people who have done this and some tips and warning they had.
PHP will run the framework based on which directory is loaded on the server. For instance, on most apache servers the root directory for example.com would be /www. Which means all of the code for Symphony would be in /www/*.
When you setup the path of your subdomain, just put it outside of the /www folder. Then, when you go to abc.example.com apache won't try to load the original site along with the Symphony framework.
I think it will be fine for both frameworks to share the same database tables. I'm not entirely sure how you plan for these two applications to work, but as long as you don't change the column names and types you should be okay.
If you don't want the applications to share the data in the original table, then look into using mysqldump or something of the like to copy the data over to a new table.