1
JMorris
Smarty if show l,cl,c,cr,r block statements
  • 2005/7/20 4:34

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


I'm working on a new theme that I would like to have dynamically expanding blocks with. Currently, the only blocks that I can control (that I know of) using Smarty are the center and right blocks, using:

<{if $xoops_showcblock == 1}>

<{if $xoops_showrblock == 1}>


I tried using similar statements for left, center-left, and center-right block using the following but it did not work:

<{if $xoops_showlblock == 1}>

<{if $xoops_showclblock == 1}>

<{if $xoops_showcrblock == 1}>


After looking at header.php, I see where this could be hacked in (not really sure on the proper syntax though); however, I'd really hate to have to hack a core file for a theme. Somehow I don't think many people would want to use the theme.

Is there an equivalent statement that I can use in theme.html to produce the desired results? Maybe something wraped in a php statement?

<{php}>equivalent php if statement here<{php}>


Thanks in advance,

James
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

2
rowdie
Re: Smarty if show l,cl,c,cr,r block statements
  • 2005/7/20 5:49

  • rowdie

  • Just can't stay away

  • Posts: 846

  • Since: 2004/7/21


<{if $xoops_lblocks}>
has always worked for me. It should work with $xoops_crblocks and $xoops_clblocks too.

3
pod
Re: Smarty if show l,cl,c,cr,r block statements
  • 2005/7/20 6:18

  • pod

  • Quite a regular

  • Posts: 301

  • Since: 2003/4/19


<{if !empty($xoops_lblocks)}><{/if}>
<{if !empty(
$xoops_crblocks)}><{/if}>
<{if !empty(
$xoops_clblocks)}><{/if}>


Hope this helps ;)
www.myxoops.com - MyXoops Is Your XOOPS!

4
WarDick
Re: Smarty if show l,cl,c,cr,r block statements
  • 2005/7/20 9:30

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


@ JMorris Yes, I agree this a needed feature.

@ Pod Thanks for the tip.
Urging XOOPS to be the Best It Can Be.
Richard......

5
JMorris
Re: Smarty if show l,cl,c,cr,r block statements
  • 2005/7/20 11:45

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


@ Pod

BINGO! That did the trick. Thank you!

Now I have a theme that dynamically expands the block widths depending on whether or not the other blocks are enabled. In this theme, left and right columns/blocks become topleft and topright blocks and are displayed before the content.

<tr>
        <{if !empty(
$xoops_lblocks)}>
            <
td class="topleft" <{if !empty($xoops_rblocks)}>colspan="1"<{else}>colspan="2"<{/if}>>
                    <!-- 
Start left blocks loop -->
                    <{foreach 
item=block from=$xoops_lblocks}>
                        <
div class="blockTitle"><{$block.title}></div>
                        <
div class="blockContent"><{$block.content}></div>
                    <{/foreach}>
                     <!-- 
End left blocks loop -->
          </
td>
          <{/if}>
        <{if !empty(
$xoops_rblocks)}>
          <
td class="topright" <{if !empty($xoops_lblocks)}>colspan="1"<{else}>colspan="2"<{/if}>>
          <!-- 
Start right blocks loop -->
<{foreach 
item=block from=$xoops_rblocks}>
            <
div class="blockTitle"><{$block.title}></div>
            <
div class="blockContent"><{$block.content}></div>
<{/foreach}>
            <!-- 
End right blocks loop -->
          </
td>
          <{/if}>
        </
tr>


The center column blocks are retained, but exist below the content and are renamed to bottomleft, bottomcenter, and bottomright.
<tr>
<{if !empty(
$xoops_clblocks)}>
    <
td class="bottomleft"><!-- Start center-left blocks loop -->
<{foreach 
item=block from=$xoops_clblocks}>
      <
div class="blockTitle"><{$block.title}></div>
      <
div class="blockContent"><{$block.content}></div>
<{/foreach}>
      <!-- 
End center-left blocks loop -->
    </
td>
    <{/if}>
<{if !empty(
$xoops_ccblocks)}>
    <
td class="bottomcenter"><!-- Start center-center blocks loop -->
<{foreach 
item=block from=$xoops_ccblocks}>
      <
div class="blockTitle"><{$block.title}></div>
      <
div class="blockContent"><{$block.content}></div>
<{/foreach}>
      <!-- 
End center-center blocks loop -->
    </
td>
    <{/if}>
<{if !empty(
$xoops_crblocks)}>
    <
td class="bottomright">
    <!-- 
Start center-right blocks loop -->
<{foreach 
item=block from=$xoops_crblocks}>
      <
div class="blockTitle"><{$block.title}></div>
      <
div class="blockContent"><{$block.content}></div>
<{/foreach}>
      <!-- 
End center-right blocks loop -->
    </
td>
    <{/if}>
  </
tr>


You just made my day!
Insanity can be defined as "doing the same thing over and over and expecting different results."

Stupidity is not a crime. Therefore, you are free to go.

Login

Who's Online

242 user(s) are online (160 user(s) are browsing Support Forums)


Members: 0


Guests: 242


more...

Donat-O-Meter

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

Latest GitHub Commits