PEAK XOOPS - Controling block order in englishin japanese

Controling block order

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2005/5/16 17:00
kenchan17  ÆóÅùʼ   Posts: 8
I have read your book of Customizing XOOPS, and try to set 'controling block order' written in it.
It is below

line 166 in XOOPS/header.php
switch ($block_arr[$i]->getVar('side')) {
case XOOPS_SIDEBLOCK_LEFT:
$xoopsTpl->append('xoops_lblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight') ) );
break;
case XOOPS_CENTERBLOCK_LEFT:
if (!isset($show_cblock)) {
$xoopsTpl->assign('xoops_showcblock', 1);
$show_cblock = 1;
}
$xoopsTpl->append('xoops_clblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight') ) );
break;
case XOOPS_CENTERBLOCK_RIGHT:
if (!isset($show_cblock)) {
$xoopsTpl->assign('xoops_showcblock', 1);
$show_cblock = 1;
}
$xoopsTpl->append('xoops_crblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight') ) );
break;
case XOOPS_CENTERBLOCK_CENTER:
if (!isset($show_cblock)) {
$xoopsTpl->assign('xoops_showcblock', 1);
$show_cblock = 1;
}
$xoopsTpl->append('xoops_ccblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight') ) );
break;
case XOOPS_SIDEBLOCK_RIGHT:
if (!isset($show_rblock)) {
$xoopsTpl->assign('xoops_showrblock', 1);
$show_rblock = 1;
}
$xoopsTpl->append('xoops_rblocks', array('title' => $block_arr[$i]->getVar('title'), 'content' => $bcontent, 'weight' => $block_arr[$i]->getVar('weight') ) );
break;
}
-------------------------------------------------------------
(changing part is ", 'weight' => $block_arr[$i]->getVar('weight')")

By the way how you change THEME.html with this 'header.php'.
I try to think many time, but my skill is not enough to understand it.
Votes:1 Average:0.00
Previous post - Next post | Parent - Children.1 .2 | Posted on 2005/5/18 18:57
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi kenchan.
Quote:
By the way how you change THEME.html with this 'header.php'.
I try to think many time, but my skill is not enough to understand it.

This is the sample of a part of theme.html
        <!-- Display center blocks if any -->
        <{if $xoops_showcblock == 1}>

        <table cellspacing="0" cellpadding="1">
          <tr>
            <td id="centerCcolumn" colspan="3" valign="top">

            <!-- Start center-center blocks loop -->
            <{foreach key=key item=block from=$xoops_ccblocks}>
              <{if $block.weight < 100 }>
                <{include file="shusei/theme_blockcenter_c.html"}>
              <{/if}>
            <{/foreach}>
            <!-- End center-center blocks loop -->

            </td>
          </tr>
          <tr>
            <td id="centerLcolumn" valign="top" width="50%">

            <!-- Start center-left blocks loop -->
              <{foreach item=block from=$xoops_clblocks}>
                <{include file="shusei/theme_blockcenter_l.html"}>
              <{/foreach}>
            <!-- End center-left blocks loop -->
              <br /><img src="<{$xoops_imageurl}>spacer.gif" width="150" height="4">
            </td>
            <td><img src="<{$xoops_imageurl}>spacer.gif" width="4" height="4"></td>
            <td id="centerRcolumn" valign="top" width="50%">

            <!-- Start center-right blocks loop -->
              <{foreach item=block from=$xoops_crblocks}>
                <{include file="shusei/theme_blockcenter_r.html"}>
              <{/foreach}>
            <!-- End center-right blocks loop -->
              <br /><img src="<{$xoops_imageurl}>spacer.gif" width="150" height="4">

            </td>
          </tr>

          <tr>
            <td id="centerCcolumn" colspan="3" valign="top">

            <!-- Start center-center blocks loop -->
            <{foreach key=key item=block from=$xoops_ccblocks}>
              <{if $block.weight >= 100 }>
                <{include file="shusei/theme_blockcenter_c.html"}>
              <{/if}>
            <{/foreach}>
            <!-- End center-center blocks loop -->

            </td>
          </tr>
        </table>

        <{/if}>
        <!-- End display center blocks -->

You can controll the position of center block with its weight is under 100 or not.

p.s. You can write it by Japanese.
Votes:1 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/5/18 20:49
kenchan17  ÆóÅùʼ   Posts: 8
ありがとうございます。
多少の疑問ですが、何故5つのコラム(右、左、中央、中央左、中央右)の全てにweightを定義しているのですか?中央だけならば1箇所だけで良いと思うのですが、、。また定義した変数は1種類なのでthemeで各コラム全てにweightで条件分岐できないと思うので、、、。それとも、任意に選んだ一つのコラムだけにweightで分岐できるという意味なのでしょうか?小生PHP初心者なので意味不明すみません。

----------------------------------
Thanks for reply.
I have a little question. Why you define 5 variable 'weight' for each column(left, right, center-center, center-left,center-right). I guess you need one variable'weight' if you use it only at 'Center-Center column. Can you use 5 'IF' for each column at one theme.html. Or, you can use one 'weight' and one 'IF' at one theme.html.
Votes:1 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/5/19 9:13
kenchan17  ÆóÅùʼ   Posts: 8
I found what I was wrong about thinking.
I wrote 'IF' sentense for each column in theme.html.
And it work well.

Thank you very much.
Votes:1 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2005/5/19 18:30
GIJOE  ÀèǤ·³Áâ   Posts: 4110
Yes.

Controlling by weights makes lay-outing blocks free with Smarty-block <{if $block.weight ... }><{/if}> .
Votes:1 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/5/19 22:36
karedokx  ¸àĹ   Posts: 65
hey, it's a very good tips (and tricks)! this is exactly what i'm looking for so far....

i do hope there will be an english version of your book...
Votes:1 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2005/5/20 7:02
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi karedokx.

I've already requested that "weight" should be assingned as block's array a half year ago.
Since Mithrandir said yes, I believe he implement it in 2.1/2.2

Votes:1 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!