The history of templates, modèles and pages
The history of templates and pages
The great difficulty of understanding "How it works" is quite normal and, although thousands of pages have been written on the subject, we remain days and days without knowing. Yet there are some who explain well. ;-)
However, the principle is simple, but what is less simple are the tons of parameterizations of various tools that we cannot guess, especially as we meet them for the first time.
There are stories of "rights" and obligations on pages that cannot be registered if the model is not settled for this.
But with a little patience and motivation, we end up understanding and it's a matter of time. Personally, it took me almost a fortnight to be able to tell you that.
In fact, it's all stupid and damn well done. This multiplies the editing power and still I have not assimilated everything. When I talk to you about API... ;-)
There's a page that's much more than a page and if I reveal to you that the ProcessWire set is just pages you're going to be amazed. We will come back to this.
So these fields (and their results), as much as you use them
So a page, but also a "model."
The great mistake we make, we beginners, is that we confuse "Model" with "Template" which, as everyone knows, is used to make our site look nice.
Whatever we can decorate it as we want, the model is not used to embellish the site but to offer information that will be displayed on our pages.
Like a good old dad site, it will host a structure that will tell him where to put the top of the site, the bottom, the sidebar, the title of the , the content and many more things as you want and the area is incredibly simple.
But it can also host a program in PHP or other programming language so that depending on your talent, you will give your pages an interactivity.
Precisely, the pages, we have not yet discussed them.
For the time being, we will not say more about the models, because what we are looking for is to understand the principle of the relationship between the model and the pages.
As you can therefore understand, the model is used to prepare the ground for the display of pages by positioning in advance the fields that will receive the information thus preparing them for the display.
What is a field?
A field is a space where you can write a date, an enamel, a text, a mathematical formula, a novel and, depending on how they are arranged, we will have a perfectly functional and pleasant page to look at.
It's like when a site offers you to sign up for a Newsletter. One field asks for your first name and another your email address, and when you fill out a form on the Internet, you fill in mostly fields that will be processed by the system either to manage your order for peas, send you spam later or will be able to fill in statistics that will help our politicians to take you by boat better. Lol.
So, these fields, there are all kinds of them, as much as you use them or to write poems (they have the size you want) or to make a Newsletter, collect the bank information of poor people or promise the moon to visitors to your site but you're not there yet. ;)
To return to our sheep, you will build your model by providing two, three or fifty fields that include you in your code. They will correspond to those of the page you are going to document.
When you've prepared your model, it takes five minutes for the simplest, you're going to integrate it into the administration of the system and you're going to learn something. For now, just look.
So you're going to click on "Installation" or "Setup" if it's still in English and that's where you're going to understand everything. The system will ask you which fields you want to integrate into your model.
You know you need a title, the headline if you want, the summary, the body of course, the sidebar and an image field to integrate my photo for example. You remember that they have to answer the information you said in the model, don't you?
When you understand the system and made two or three pages, you'll also realize the power of the thing. :-)
To put the water in your mouth, I'm going to tell you about...
You're learning the history of pages and templates, and what you're not told is that at this point you're going to start to suffer.
Because when you go to integrate your final pages, you're going to discover a system of permissions, permissions that's kind even in the right houses.
All CMSs are equipped with a user management system and, in short, we will say that there are visitors who taste the pages, members who often see others in addition to their status, sometimes an "Editor" who has the right to correct your faults and the administrator for whom everything is allowed.
Everyone knows the principle of "rights" and the developers of ProcessWire have taken their exploitation much further think not like you may be at the CMS but rather at the CMF.
We're working on a CMF, that is, a framework designed not just to build sites, but above all the tools that build the sites. Are you following me?
They hack the rights so that they serve not only to manage visitors and the whole team but also the actions, modules, images, categories etc.
For example, a template will be reserved for a specific category and as you know that with a single instance (or installation) we can manage 1000 sites with very different themes, it may be useful to prohibit the use of a model to another section especially if it contains confidential information that would not go with another composition.
So, a template will agree to be used to create some pages and not others and the management of these rights is so sharp that we beginners find it a little bit difficult to manage it right away.
Although I've been working on this site for a fortnight, I found myself this morning with the impossibility of integrating a model e because another model or page didn't give permission because in reality I couldn't fix it.
All day, I asked myself the question: But where is it being settled?
And yet I went there 10 times on it. :-//
Well, it's the job that comes in, and with this tool, it's all about patience. You have to have time. :-)
I understood almost everything this morning about why I have so much difficulty in tying the chosen templates to my pages.
When you build a page, you've already chosen the model that will go with it.
Suppose I edited a template with twelve fields because it's a car presentation page and the information, in addition to the price, gives the color, the cylindness, its acceptable pollution level etc.
I made a template or template for the custom French coders that I named luxury-autosavailable.php and I tried to save my page in the Automobiles category so that those looking for a car wouldn't have to search the site.
You have of course noticed that we have in our menu in the frontend first of all the home page that works with the home.php template, then different pages that also have subpages. We return to the concept of parents and children's pages.
Guess.
The Automobile page is necessarily a child on the Home page who is a parent of several other pages that also have (or not) children what in the small world of ProcessWire makes her a grandparent.
We can go on like this for a long time, which allows us to make a site with several broad categories that some of which will reserve templates for us because it would be bad like publishing hard Punk music within a section that preaches e-enism, yoga and dehydrated dry peas in Nepal.
It is not out of jealousy that a parent category refuses the use of such a model (which happened to me yesterday) to one of her children and probably in line with some of them who are parents too.
Children, too, can veto the use of their models, and that is why I have titled the previous chapter Permissions, Melm's permissions.
In practice, once the concept is understood, it suits us all because this system has been designed precisely to multiply the possibilities of "rights" opening up the opportunity for fearless directors to broaden their horizons.
You're going to ask me how I ended up understanding this aspect that seemed twisted at first, but ultimately turns out to be a smart function with which we'll enjoy playing.
I have no merit because I knew this from the start. ;-)
A sharp thing like this CMS-CMF is not mastered in five minutes like most content managers, and if you feel it's worth it, you dive into the documentation, read what users say on the forums and you don't refrain from swallowing one after the other all the tutorials that you usually don't understand. Even if it's done well.
For a few days, it appeared in my texts that I was on the track and I had really understood but did not find the lead while still hitting me at the same problem which, if it manifested itself in a random way, was nevertheless authentic.
For the second, third time, I came across a screen that displays a list of available models but I didn't see mine and sometimes I did. That's where I remembered this story of permissions and decided to follow the trail.
I was in a category (like your Automobile) and the culprit was either the mother or one of his daughters that we might call my sisters. I started with my parent page.
Bingo. The idiot who set or forgets permissions didn't allow my new template in the list. I quickly addressed the situation and I will show you the pictures tomorrow at the end of which all that read me understand at the same time as me.
The rest tomorrow or later. :-)