Le Blog

Le blog laboratoire de F.L.D. Studio
0

Technical Details

If you are a web developer, you may want to know where the files responsible for this output live. Below is a summary of files and directories used by this profile:

/site/templates/
Blog profile site templates

/site/templates/blog.inc
Shared blog-specific functions included by most site templates.  

/site/templates/main.inc
The main HTML markup file through which everything is output.

/site/templates/markup/
Contains PHP files that generate markup for specific things like posts, comments, etc. This is separated from the site templates to make it simpler for you to modify the markup if you want to. This is primarily used by the blog.inc functions, but also included by a couple templates as well.

/site/templates/skeleton/
This is the Skeleton CSS framework. It is identical to the one they distribute except we added a wider viewport to it. You probably wouldn't have much need to edit anything in here.

/site/templates/styles/
Stylesheets used by the blog profile. The most useful one in here would probably be theme.css, which contains all the color definitions for the profile.  

/site/templates/scripts/
Javascript files used by the blog profile. Not much is happening in here at present.  

How the template files work

In ProcessWire there are any number of ways you can use your template files. In this case, we are using our template files (in /site/templates/) to populate 3 variables ($content, $headline and $subnav) and then including an HTML file (main.inc) to output them in the right places.

The $content variable represents the center (body) column, the $headline variable represents the text headline of the page, and the $subnav variable represents the navigation that appears in the left sidebar.

Once one or more of these variables is populated, the template file includes the /site/templates/main.inc file. That main.inc file is just a big HTML file that outputs the $content, $headline and $subnav variables in the right places.

We've made an attempt here to separate most of the logic used in the template files from the output. Most of the markup is generated from files in /site/templates/markup/. These files are included from the template files to output specific things like a blog post, comment, etc.  

Because a lot of output needs are similar among the various template files, we've created a file called /site/templates/blog.inc that has a few shared functions in it. If you look in any of the template files, you'll see that most of them include blog.inc as the first thing. This blog.inc file also initializes our $content, $headline and $subnav variables, mentioned earlier. 

For a different approach to site templates, take a look at the default site profile included with ProcessWire.  

Tags: Templates, CSS, Customization

Commentaires: Pas de commentaires

Envoyer un commentaire