Standardization of the site
Tell me, how to implement the standardization of the site??? In the database there is a row id : link : page : template so it is necessary that in a template record record template.
id=1 : link=localhost : page=main : template=mytheme
id=2 : link=localhost/about/ : page=About : template=mythem2
That's what I use:
That is just for templates using the file with the correct markup and inserts short tags PHP. It may not be perfect, but it's still easier to any fancy template engines and I do not have any cons. When the controller worked through the model needs data, it calls the function
Here is an example of a simple controller:
And in the template there will be usathese in the right places the data passed to it. This is a very simple example.
Answered: Олег Архипов 04-07-2012 в 14:16:43
And how then to make a selection template for a particular page. For example, the home page template No. 5 contacts page-template number 6 ??? And not much is not clear where it's all stick ! - webkostya 04-07-2012 в 20:23:30
Well, it's a function, and it passes the parameter
Maybe I misunderstood or not explained. But if it is short it is necessary that: In the DB there is a line id:link:page:template so that the template record record template. For example: id=1:link=localhost:page=main:template=mytheme id=2:link=localhost/about/:page=About:template=mythem2 - webkostya 04-07-2012 в 20:59:24
Explained in Skype. - Олег Архипов 04-07-2012 в 22:06:51
Look for starters on shirokolistvennye Smarty as template engine.
Answered: PashaPash 03-07-2012 в 12:34:03
Standardization is a very useful technology that allows you to separate development of parts of the site. For example, designers only have access to CSS/HTML code, less JS, and they have no idea about how to work with what they moderate and modify at all. With the so-called "technologists" that's the same: I have access only to the implementation of functional - PHP code, for example. All this you of course know, but this is how the entry of something =) And now to business.
To implement the standardization as you like! The simplest looks like this:
As you can see, you can implement standardization in a simple way: write some code that implements basic functionality, styles, other stuff, etc, then split the file "in half", so to speak, what the split should happen in the place where you plan to display some information to implement a functionality to write new styles, etc. and finally "sculpt" each new page, as shown above.
A more complex form takes the templating engine, implemented in the classroom. These template engines are much more flexible, in some ways even more reliable, but often you can do without it( though not always, but often! ) - enough flexibility first, easier.
Answered: AseN 03-07-2012 в 20:02:50