1
alain01
Customize blocs with no title in the managment page
  • 2020/1/12 21:12

  • alain01

  • Just can't stay away

  • Posts: 536

  • Since: 2003/6/20


Hello,
1 problem but may be 2 solutions.

All my customize blocks dont used title.
it's easy to not put title in the field title in the /modules/system/admin.php?fct=blocksadmin&op=add page.
But when you used lot of customize block,
it's hard to manage these blocks in the /modules/system/admin.php?fct=blocksadmin page cause blocks get blank title...
I should edit the bloc to know the block.

I think about 2 solutions :

1) I put title in the title field and in theme.tpl i should add condition for customize blocks.

i have seen these exemples :
//  Examples:
//  <{block id=1 display="title"}>   displays just the block title
//  <{block id=1}>                   displays just the block content
//  <{block id=7 display="none"}>    does not display nothing but executes the block, this can go for online block or to trigger some cron block
//  <{block id=600 groups="0|1" cache=20}>  display block just for this 2 groups and sets a cache of 20 seconds
//  <{block id=600 options="100|100|s_poweredby.gif|0"}> displays block with diferent options


In database, i see 1 field named block_type where (i suppose) :
S for System
M for Module
C for Customize

So how can add code to test that it's a customize bloc ?

<{if $block.block_type!="C"}><h4><{$block.title}>h4><{/if}>
 <{
$block.content}>


I have not yet tested this code

2 - Solution 2
Hummm,
we need to add a new fied for blocks named label for example
and we can see the label field + the title field in the blocks managment (/modules/system/admin.php?fct=blocksadmin)
So the label field is just here to manage blocks without title

Please, let me go in the good way !

2
alain01
Re: Customize blocs with no title in the managment page
  • 2020/1/12 23:36

  • alain01

  • Just can't stay away

  • Posts: 536

  • Since: 2003/6/20


ok,
$block.block_type is unknown by the system.

Ok i tried to find another solution.

All my customize title blocs start with "@ - "

Then in tpl file, I modified the code

<{if $block.title}><h4><{$block.title}>h4><{/if}>

by

<{if ($block.title|truncate:4:"":true)!="@ - "}><h4><{$block.title}>h4><{/if}>
And it works !!!

Title customize bloc examples :
- "My personnal title bloc" => The title is displayed
- "@ - My personnal title bloc" => The title is not displayed

It's a fine code, no ?

3
geekwright
Re: Customize blocs with no title in the managment page

This is a common problem, I know I have this issue. Perhaps, it would be best if it is handled outside of the theme in core?

I would suggest we treat a block title starting with "// " (slash, slash, space) as a comment, and suppress the title when the block is rendered.

This would allow switching themes without resulting in a bunch of "@ - " block titles

The "//" is a comment indicator in many languages (such as PHP, C, JAVA, JavaScript to name a few) so it could be semantically familiar for some.

What do you think?

4
alain01
Re: Customize blocs with no title in the managment page
  • 2020/1/13 23:50

  • alain01

  • Just can't stay away

  • Posts: 536

  • Since: 2003/6/20


Quote:
This would allow switching themes without resulting in a bunch of "@ - " block titles

For sure,
if we can centralize the need rather than directing it towards the theme, it is more effective.

The best answer for me (but i know the response) it's to add a label field, independant from the title, just here to manage block in the management page, but we need to add a field in the database.

In fact, these 2 proposals are good for me.

5
alain01
Re: Customize blocs with no title in the managment page
  • 2020/1/14 0:21

  • alain01

  • Just can't stay away

  • Posts: 536

  • Since: 2003/6/20


Another solution
but close to the "label" solution.

Add a "yes/no" new field named "Title enabled"...

6
geekwright
Re: Customize blocs with no title in the managment page

Went with the minimal change approach with comment style slash-slash-space starting the title. Simple, but effective.

https://github.com/XOOPS/XoopsCore25/pull/762

Login

Who's Online

162 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 162


more...

Donat-O-Meter

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

Latest GitHub Commits