1
nachenko
Preparing an article for XOOPS
  • 2007/5/31 10:08

  • nachenko

  • Quite a regular

  • Posts: 356

  • Since: 2005/1/18


Hi!

I'm writing an article for XOOPS. This is the first draft. Corrections and suggestions welcome:

------------------------
How XOOPS rendered the page you're viewing

by Ignacio Segura, “nachenko”
http://www.pensamientosdivergentes.net

In this article we'll explain how the URL you wrote in the address bar became the nice page you're viewing at this moment.

XOOPS is a content management system (CMS for short). Such those systems make two things:
1 - Provides visitors the look and content of the website, and
2 – Gives the webmaster the tools to manage this content.

There are many different systems out there, free and paid, but all them work the same way. They get the contents from their database, put it together in a design template and send the whole burrito to the visitor. The differences among CMS is not what they do, but how they do it.
So how it works? How XOOPS provided you this article you're reading?

The “what”: Collecting the content

First thing to get is the content. An article, a list of products, photos... once we get it, we'll manage the problem of showing it to the user.
The URL you can read in your browser's address bar points to a PHP file. First two things this file does are:

1 – Loads XOOPS config file: “mainfile.php”. Now the script “knows” what is needed to locate a file or an entry in the database.
2 – Loads “header.php”. This file then runs XOOPS engine.

At this point we still have to collect the content, but this is done in two separated processes. One process states what blocks are visible for this visitor (that is, you) at this address, and goes block after block to get their contents.
The other process gets the “main” content (that is, this article). In XOOPS, there's always a “main” content, a content that is not inside blocks. There's an exception to this rule, but that's all, just one: the starting page.
We won't talk about this “main” content, or the blocks, as every module does it it's own way. The only thing you have to know at this moment it's that both the “blocks process” and the “main content process” do the same thing when they end: deliver all the info collected to the template engine.

[pic:code flux]

The “how”: assembling the content in a template

In XOOPS, templates are simply HTML files that include special “markers” (we call them Smarty tags) to tell the system where to put the content. A “piece of template” for an article could be something like this:

<{$article.title}>


<{$article.abstract}>




<{$article.text}>



Embedded in the HTML code, these red items are the tags that will be replaced by the appropiated content. The title of the article, the abstract, the text... Something named "Template engine" makes the replacing. There are many template engines out there. XOOPS uses Smarty (smarty.php.net). This engine can do a lot of things, but this is not the scope of this article. The only thing we want you to know at this moment is the difference between a Smarty tag and a HTML tag.

· This is a HTML tag:
· This is a Smarty tag: <{tag}>
· This is a variable into a Smarty tag: <{$variable}>

Notice the { } symbols. The <{ and }> is used to identify a Smarty tag.

Enough about markers. Let's talk about the templates. In XOOPS, blocks can have 8 different locations around the main content. In the default theme, they are organized this way:

[pic:block locations]
[pic:block templates]

You see, blocks surround the main content. It's a cascade structure: theme file calls:
1 – A CSS file that controls everything.
2 – Main content template.
3 – A template for every block location, and these load every block's template.

[pic:template flux]

The appropiate Smarty tags are then replaced. The page is finished and ready to be shown to the visitor.

That's all!

2
riosoft
Re: Preparing an article for XOOPS
  • 2007/6/1 8:49

  • riosoft

  • Not too shy to talk

  • Posts: 191

  • Since: 2003/11/8


Very clear and understandable. Thnak you.

** Por cierto, no hace mucho estuve por Granada. Lindísima.

Greetings
...

Login

Who's Online

408 user(s) are online (298 user(s) are browsing Support Forums)


Members: 0


Guests: 408


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits