1
LazyBadger
What is difference between?

Can anybody explain, what is better? And why second construction alive?!

1.
<{if !empty($xoops_contents)}>
...
<{/if}>

2.
<{if $block.title|regex_replace:"/.*none/":"none" ne "none"}>
...
<{/if}>

When both snippets do (AFAIS) the same task - check if not (something) empty...
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

2
Mithrandir
Re: What is difference between?

I use 1. since I am both a novice in regex - and don't like to over-use it due to its heaviness.
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

3
LazyBadger
Re: What is difference between?

I use also 1, but just curious - why 2-nd can appear... because it will add a lot of overhead for the same result
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

4
DonXoop
Re: What is difference between?

Are these the same thing? I use #2 to strip a block title and make a neat appearence when desired. I don't see how #1 will do the same for a block title.
no max no bling. goes double for mik. triple for the insane aliases of said lunatics
===========================
Not around here anymore. Way too many idiots, so sad.

5
LazyBadger
Re: What is difference between?

<{if !empty($block.title)}>
...
<{/if}>
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

6
DonXoop
Re: What is difference between?

^^that makes more sense.

However it means that to bypass the block title you have to leave it blank. That makes admin a pain. Easier for me to use regex and have a block title such as "My Special Block none" which will get trapped by the code as desired but is still easy to find in the blocks admin. After seeing the 2.2x block admin I'd go crazy with blank titles. But for minimal blocks this might be more efficient but my site doesn't seem to suffer doing it the #2 way.

To clarify, we're talking about a theme.html method for bypassing the block title right? Hint, my fav is to put a random image block on top of a mini calendar block making it look like a real calendar. I use it elsewhere for a slicker appearence.
no max no bling. goes double for mik. triple for the insane aliases of said lunatics
===========================
Not around here anymore. Way too many idiots, so sad.

7
LazyBadger
Re: What is difference between?

Quote:

DonXoop wrote:
^^that makes more sense.
To clarify, we're talking about a theme.html method for bypassing the block title right?
Partially, I asked for common sense of second logic... and see now - my vision was wrong (I must re-RTFM)... First code is "if not empty", second - "if substring..."
Quote:

Hint, my fav is to put a random image block on top of a mini calendar block making it look like a real calendar. I use it elsewhere for a slicker appearence.

How do you do it? Can't imagine... well, hardly can...
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

8
DonXoop
Re: What is difference between?

Maybe I wasn't clear, "on top of the calendar" is just placing a block above the calendar while the calendar has no block title. I do the same for the center block on the front page. and a few other places. Some of the calendar modules have a random image to do the same thing but I'd rather leverage the thousands of pics from the gallery.

<{if $block.title|regex_replace:"/.*none/":"none" ne "none"}>
   <{
$block.title}>
<{/if}>


Resized Image
no max no bling. goes double for mik. triple for the insane aliases of said lunatics
===========================
Not around here anymore. Way too many idiots, so sad.

9
WarDick
Re: What is difference between?
  • 2005/8/19 11:40

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


The problem with 1 is that when you have a lot of blocks and they have no label they are too hard to locate.

Using the regex expression you have distict labels.
Urging XOOPS to be the Best It Can Be.
Richard......

10
davidl2
Re: What is difference between?
  • 2005/8/19 12:19

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


So... in theory you could use a special "word" to trip no block...

How could you code in these block names (so they have different labels in admin):

eric1
eric2
... eric99

(where "eric" is the "hi - i'm a block without a title tag" - and nothing gets displayed in the title block)

Does that make sense?

Login

Who's Online

309 user(s) are online (205 user(s) are browsing Support Forums)


Members: 0


Guests: 309


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