1
milanov
News module help part2
  • 2003/12/7 22:16

  • milanov

  • Just popping in

  • Posts: 10

  • Since: 2003/11/24


Hi there!

I have a small problem with XOOPS and i have posted it in a lot of forums, but nobody answered to me :(

So, the problem:

I have 2 blocks in the central (middle) column, but they are always appear over the news. How to change this? I need the news on the top!

Thanks a lot :)

2
hsalazar
General structure of theme.html [VERY LONG POST]
  • 2003/12/8 0:54

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


milanov:

Here's a VERY LONG answer to your question. I'll do it the long way because I want this to be a general explanation of the themes main file: theme.html. Ok? Let's begin.

The file is a structure made out of tables so that you have three different areas:

(1) A header, where you can see the XOOPS logo, the banner and, in some themes, several shortcuts to different areas of the site.

(2) A content area, which we'll leave aside for the moment.

(3) A footer area, where you can see the "Powered by" message.

Ok so far? Good. Now let's proceed to the content area. Its actual structure depends on the theme, but for this example, let's use the default theme. In this theme, the content area is built with a separate table (lines 36-106 in the file). This table has a single row, and in that row it has three columns, with obvious IDs as leftcolumn, centercolumn and rightcolumn.

Now, the first thing you'll notice is that the column called "rightcolumn" is enclosed by an IF declaration:

<{if $xoops_showrblock == 1}>

      <
td id="rightcolumn">
        
        <{foreach 
item=block from=$xoops_rblocks}>
          <{include 
file="default/theme_blockright.html"}>
        <{/foreach}>
        
      td>

      <{/if}>


What this means is: if the variable $xoops_showrblock equals one, then there's a TD called "rightcolumn". Of course, if $xoops_showrblock equals 0, there's no TD called "rightcolumn" and our row is left with only two columns: "leftcolumn" and "centercolumn". Let's not enter in this subject for the moment; it's enough to know that somehow the right column is optional.

For the moment, we need to focus on the column called "centercolumn". I'll reproduce here the whole TD so we can dissect it:

<td id="centercolumn">

        
        <{if 
$xoops_showcblock == 1}>

        <
table cellspacing="0">
          <
tr>
            <
td id="centerCcolumn" colspan="2">

            
            <{foreach 
item=block from=$xoops_ccblocks}>
              <{include 
file="default/theme_blockcenter_c.html"}>
            <{/foreach}>
            

            td>
          tr>
          <
tr>
            <
td id="centerLcolumn">

            
              <{foreach 
item=block from=$xoops_clblocks}>
                <{include 
file="default/theme_blockcenter_l.html"}>
              <{/foreach}>
            

            td><td id="centerRcolumn">

            
              <{foreach 
item=block from=$xoops_crblocks}>
                <{include 
file="default/theme_blockcenter_r.html"}>
              <{/foreach}>
            

            td>
          tr>
        table>

        <{/if}>
        

        <
div id="content">
          <{
$xoops_contents}>
        div>
      td>


Now. If you take a good look at this, you'll see two structures within the TD:

(1) A large table enclosed by an IF declaration.

(2) A DIV tag enclosing the <{$xoops_contents}> variable.

Ok so far? Let's begin with number (2). What's contained in <{$xoops_contents}>? The main content of the module presented in the page. If you have the News module as your start module, this variable contains the latest news.

This is important. If you have the MyDownloads module as your start module, this variable contains the download categories and the latest downloads. To be more clear: What you see now when you click on Downloads will appear in your top page, start page or homepage, whatever you call it. Ok?

What happens if you don't define a start module, that is, if in your admin preferences you set Module for your start page to "None"? The value of <{$xoops_contents}> is zero: you have no content assigned to the start page, and all you'll see there are the blocks you define to appear in the top page.

We're almost there, be patient. Let's go now to number (1) and examine the large table. It's enclosed in an IF, and the IF has as its parameter the variable $xoops_showcblock. If it's equal to one, the table is shown; if it has a different value, the table is NOT shown.

Who decides the value of $xoops_showcblock? It's automatically defined as soon as you select some block to appear in your top page.

Now, assume the variable equals one. What specifically is in the table shown? If you go a little back and see the code, you'll realize the table has two rows:

(1) The first row has a full-width TD called "centerCcolumn". There you'll see whatever blocks are defined as center-center.

(2) The second row has two half-width TDs. The left one is called "centerLcolumn" and the right one is called "centerRcolumn".

All these TDs are dynamically filled by XOOPS by reading arrays and supplying the content you have.

Now let's review the implications of all we've just seen.

First, whatever weight you assign to a block, has relevance within blocks of the same kind. This means if you apply a weight to a center-center block, this weight is important if you have more center-center blocks. But it won't matter with respect to center-left or center-right blocks, which will always be displayed below the center-center blocks because that's the way they're set in the template, in theme.html. So if you want your center-center blocks to appear below your center-left and center-right blocks, you need to move the center-center TR below the center-left/center-right TR. Ok?

Second, since the whole table is set BEFORE the main content DIV, it won't matter what weight you assign to your blocks: you'll NEVER get the main content appear before the center-center, center-left or center-right blocks. To make your content appear first, you have to move the DIV and put it BEFORE the table.

I call the setting of the default theme Blocks on top. If you need to have it the other way, for the configuration I call Content on top, change the code so the TD called "centercolumn" reads:

<td id="centercolumn">

        <
div id="content">
          <{
$xoops_contents}>
        div>

                
        <{if 
$xoops_showcblock == 1}>

        <
table cellspacing="0">
          <
tr>
            <
td id="centerCcolumn" colspan="2">

            
            <{foreach 
item=block from=$xoops_ccblocks}>
              <{include 
file="default/theme_blockcenter_c.html"}>
            <{/foreach}>
            

            td>
          tr>
          <
tr>
            <
td id="centerLcolumn">

            
              <{foreach 
item=block from=$xoops_clblocks}>
                <{include 
file="default/theme_blockcenter_l.html"}>
              <{/foreach}>
            

            td><td id="centerRcolumn">

            
              <{foreach 
item=block from=$xoops_crblocks}>
                <{include 
file="default/theme_blockcenter_r.html"}>
              <{/foreach}>
            

            td>
          tr>
        table>

        <{/if}>
        

      td>

All this may sound complex, but if you read carefully, with your theme.html open in front of you, you'll realize it's actually quite easy and quite flexible. This is the way to control what you see in your homepage.

Well, this has been long, but I do hope it's been useful.

Cheers.

3
milanov
Re: General structure of theme.html [VERY LONG POST]
  • 2003/12/8 1:03

  • milanov

  • Just popping in

  • Posts: 10

  • Since: 2003/11/24


10x a lot for the hard work! I made my page :)

Login

Who's Online

353 user(s) are online (229 user(s) are browsing Support Forums)


Members: 0


Guests: 353


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