teaches you how to completely detach the front and back (non-API, Ajax)

Source: Internet
Author: User
Tags yii

My back and forth, not the API, not the Ajax, I'm just here to discuss the HTML and backend combination

Previous words

Once rage Dedecms believe that do the site of ten eight or nine know, there are some not technology-born people, by looking at documents, can also visit the website out, some people say dedecms too rubbish, do not know from what aspects, but have to admit its advantages, and which frame is free for you, and so convenient?

After all, one of the great benefits of DEDECMS is that it will be a template tag, almost will slowly make a set of pages, really is so simple

Phper technology in the end how

I interviewed some people before, of course, I will not take online some of the existing test questions, or feel that the work has no practical meaning to test the interviewer

Claiming to be one or two years of work experience, of course, there are 3 or so people (specifically unable to verify), ask them some simple questions they can not answer up, really immutable yards (I mean only know code a lot of code, regardless of code efficiency) is also difficult

My interview question is very simple (of course I only for the Web page), the user has so many frameworks (Yii, TP, larval, ecshop, Dedecms, WP), regardless of which, if directly on the page to pull the database data?

There are not a few people to the original PHP research and then framework development, they do not know "directly in the page to connect to the database, query display", but that I have never done so, has always been from the controller read the data assignment, in the module to take

This is really the only way, it has to be said that MVC is really deep-rooted ah, some people say that can achieve the function can be, what does it, so that you also

Elicit problems

Template assignment, rendering, display, is that a really good way?

One day I changed the template, deleted some data, the controller you want to move, do not move is there garbage data?

Now the template data is not completely subject to the controller, coupling is too high, who can not leave who?


Too many questions, of course, you did not think, we do yard farming, not just your working life than others, and the technology has not improved, of course, you said I only for the mixed mouth food, that is.

How to achieve (personal view)

People who have used Dedecms know that directly in the HTML template tag to fetch data, yes, but in TP, YII, larval these frameworks you will do? Label?

The first thought is the label, yes, this is the most direct approach, is also the method used by Dedecms, is a way, this you will either design a large number of labels, or design more complex and flexible labels

I certainly do not say that the above method, or I do not have to write so much, the following question leads

Now a lot of projects are basically required to have the app, mobile, PC development together, if you can use a PC tag, then the app, and then get a separate interface to achieve???? It says you'll find that a lot of data repeats in writing, and more and more junk code

What is the most important thing in this area? Yes, logic, each end will write a lot of logic code, if a few end can achieve logical common, but also to achieve the above template directly extracted data how good AH

Of course, it is from the template (HTML) directly to the logic (model) pull the data can be done, Tpframe is doing, it is flexible to achieve this function, the following convenience can be

1. Normal assignment value

2, the label to take

3, directly to the logical harvesting

At last

If a project in the development process, each side of the main things are shared, rather than go to each end write a set, this can give you the project to save a lot of time cost?

If you want to change, maintenance, if it is a set of each end, then you have to change each side, if the common logic, only need to change the logic part can

After the project upgrade, you also need to write a small amount of code, each end of the function will be implemented

At the same time back-end only need to write the document, the front end can take the data pull, both sides do not delay, this is what I said the front and back end of the separation

Welcome to leave a message to discuss, small read two years of book, Hope Master Enlighten ~

teaches you how to completely detach the front and back (non-API, Ajax)

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.