xoops forums

frankblack

Just can't stay away
Posted on: 2008/7/29 12:37
frankblack
frankblack (Show more)
Just can't stay away
Posts: 830
Since: 2005/6/13
#1

Does a block or block-template know where it is positioned?

Strange question, I know! I would like to use a css-only based tooltip, but therefore I need to know whether the block is placed on the left or right side. If I know this, then I can use different classes for the tooltip. A smarty-solution would be nice.

Any hints for me?

Burning

Theme Designer
Posted on: 2008/7/29 13:50
Burning
Burning (Show more)
Theme Designer
Posts: 1163
Since: 2006/8/22
#2

Re: Does a block or block-template know where it is positioned?

hi,

You might take a look to "Morphogenesis gabarit" and his stylesheet blocks.css.

Many combinations :
#xo-page-topleftblocks .xo-block {}
#xo-page-bottomleftblocks .xo-block {}
#xo-page-toprightblocks .xo-block {}
#xo-page-bottomrightblocks .xo-block {}
... etc.

Hope it helps

@+
Still learning CSS and... english

demian

Quite a regular
Posted on: 2008/7/29 13:58
demian
demian (Show more)
Quite a regular
Posts: 225
Since: 2008/4/29
#3

Re: Does a block or block-template know where it is positioned?

in the default theme there arte $xoops_showcblock,$xoops_showlblock,$xoops_showrblock,

maybe
<{if $xoops_showcblock }>

style1.css


<{elseif $xoops_showrblock}>

style2.css

<{else}>

style3.css


didn't try it

scrapple

Just popping in
Posted on: 2008/7/29 17:13
scrapple
scrapple (Show more)
Just popping in
Posts: 1
Since: 2008/7/29
#4

Re: Does a block or block-template know where it is positioned?

doesn't seem to be any theme guys left here at XOOPS to help you... maybe ask somewhere else?

abrizan

Just popping in
Posted on: 2009/12/16 8:40
abrizan
abrizan (Show more)
Just popping in
Posts: 82
Since: 2005/11/14
#5

Re: Does a block or block-template know where it is positioned?

Bump.
I have this same issue. I need my main menu block to output different html if it is left or right.

I even tried putting
<{assign var="Block_Position" value="canvas_left"}>
before the
<{foreach item=block from=$xoBlocks.canvas_left}>....
and
<{assign var="Block_Position" value="canvas_right"}>
befpre the
<{foreach item=block from=$xoBlocks.canvas_right}>.....
but no luck.

The main template "sees" <{$Block_Position}> but the block doesn't.

Is there any way to do this without a core hack?

ghia

Community Support Member
Posted on: 2009/12/16 8:59
ghia
ghia (Show more)
Community Support Member
Posts: 4946
Since: 2008/7/3 1
#6

Re: Does a block or block-template know where it is positioned?

You make the left and right html in your block inside a div with class eg leftpart and rightpart.
Your columns have also a class, name or id in their div eg class leftcolumn.
In your CSS you suppress the inappropriate parts:
.leftcolumn .rightpart {displaynone};
.
rightcolumn .leftpart {displaynone};

trabis

Core Developer
Posted on: 2009/12/16 9:18
trabis
trabis (Show more)
Core Developer
Posts: 2253
Since: 2006/9/1 1
#7

Re: Does a block or block-template know where it is positioned?

I think you need to hack core or wait for a better version.

abrizan

Just popping in
Posted on: 2009/12/16 12:08
abrizan
abrizan (Show more)
Just popping in
Posts: 82
Since: 2005/11/14
#8

Re: Does a block or block-template know where it is positioned?

I was hoping to find a more elegant Smarty solution and not a CSS or Javascript hack.
Is there really no way that this can achieved through Smarty?

trabis

Core Developer
Posted on: 2009/12/16 14:10
trabis
trabis (Show more)
Core Developer
Posts: 2253
Since: 2006/9/1 1
#9

Re: Does a block or block-template know where it is positioned?

No smarty solution because blocks are rendered first and then they are assigned to positions so, at block execution time, smarty is not aware of the block location. This requires only line of code in class theme_blocks.php, maybe in next release.

abrizan

Just popping in
Posted on: 2009/12/16 14:44
abrizan
abrizan (Show more)
Just popping in
Posts: 82
Since: 2005/11/14
#10

Re: Does a block or block-template know where it is positioned?

I would greatly appreciate it if this could be included in the next release. It would be very useful in my theme development.