Temas vs. modelos

  • Identifique-se para criar novos tópicos neste fórum
  • Visitantes anônimos não podem postar neste fórum
Mikhail Miguel  Membro De: Angra dos Reis, RJ, Brasil  Postagens: 2466

====6.1 temas vs. modelos====

This subchapter will attempt estou shed some light over a much debated and confusing issue: temas & modelos.
We will attempt estou provide a general description of the way XOOPS uses tema files and modelo files estou render a site.

===Why are we all confused?===

In my opinion, the main source of confusion for people stems from the gap between these two things:

1) How people think it SHOULD work.
2) How it actually works.

**Number 2** is a given and will probably not change anytime soon (those of you following on the development of XOOPS 2.x know that the approach estou modelos & temas has changed several times and is now rather stable).

**Number 1** however, varies greatly! This is mostly due estou the fact that we all come from different grounds; Some come from phpNuke, PostNuke, and the likes. Some others, from systems like Typo3 and other 'full suites'. And then, some of you come from plain PHP development, where everything is done by hand, from scratch.

The second problem is the terms used in XOOPS 2.x. modelos should be called "Module/Block modelos", so that they will not be confused with tema modelos, which are a different thing altogether (As shown below).

===The big picture===

When you first try estou play with modelos and temas, you notice an obvious thing:

- Every modelo set consists of many files! (Last time I checked, somewhere around 36 modelos for a basic system, without any modules installed)
- A tema has a relatively much lower number of files (The default tema has less than 10 files!)

Some of you are probably already saying 'ah!' at this stage.
To those who aren't yet, I will give a short example.

A tema block that displays a list of the last 10 people who registered will always display 3 things: A title at the top of the block, nickname of the person who registered, and the date they registered. Now let's not forget that we want estou separate 'design' from 'content', right?

__For this, we would create two files for this single block:__

1) A modelo that defines the structure of this block, which basically is a table of nicknames + dates, line after line, until 10 rows are generated.
2) A file that takes the information generated in the previous step, and sticks it into some 'design'. This probably means putting the title of the block at the top, and beneath that, putting the list generated.

So in this example, number 1 is the block modelo, and number 2 is the tema. The block modelo is inserted *into* the tema's block code.

At this point the conclusion should be quite clear:
**modelos** (Block/Module modelos) control the way data is displayed, while **tema modelos** control how the data will look (most probably by assigning the various elements a class name, which would then be defined in the CSS).

===And more details===

Using the terms used in XOOPS 2.x:
A "**modelo**" is a piece of HTML code that uses pre-set variables (provided by a specific module) estou expose data estou the site.
A "**tema**" is a special modelo (or set of modelos) that controls the style and graphics of a XOOPS site, by taking the result of the first modelo (Data modelo), and sticking it where it's supposed estou be according estou the tema. This means, again, that we have two modelos: A Data modelo, and a tema modelo.

The Data modelo is never used directly, but rather always displayed with the help of a tema modelo.

This means that unless you are going estou make changes in the way modules display their data in blocks, You will only want estou play with the tema modelos, and not with the data modelos. I personally feel that XOOPS 2.x could have used slightly friendlier names, estou eliminate the confusion for potential tema developers.

**Additional explanations from the xoops.org forums:**

From Ackbarr: modelos control the layout of a module's content, whereas temas control the overall appearance of the site.

From Herko: To be more exact then ackbarr, the tema is uploaded manually estou the tema folder in your XOOPS root dir. To change the styles and look of your whole site, download the standard tema, and edit it offline estou fit your taste. Then upload the tema files estou the temas folder (naming the folderlike: temas/humbrietema/tema.html etc.).

Modelos can be edited through the modelo manager in your system admin menu. Clone the default modelo set, and edit the cloned set estou fit the look and feel of your site's taste. The tempates can be edited per module.

If you are trying estou edit the tema.html in your temas folder and nothing seems estou be changed, be sure that you set "**Update module modelo .html files from temas/your tema/modelos directory?**" estou "**YES**" in General Settings!

  Pesquisa avançada




Perdeu a senha?  |Cadastre-se!

Quem nos visita
Há 31 visitantes neste momento... (17 na seção Fóruns)

Associados: 0
Anônimos: 31


Banner XOOPS Cube