1
lionhell
Using variable in block title
  • 2014/8/26 0:18

  • lionhell

  • Just popping in

  • Posts: 20

  • Since: 2006/8/13


It would be nice to have the possibility of using variables in block titles, like dates or indexes, etc ..., to have dynamic titles in blocks.

I really would appreciate to use smarty in block title !

Does someone know a hack to do that ?

2
Bleekk
Re: Using variable in block title
  • 2014/8/26 8:47

  • Bleekk

  • Theme Designer

  • Posts: 940

  • Since: 2002/12/14


Every module has a template for each block. You can use smarties in the block templates.
Can you give me a example what you are trying to do (which module)

3
lionhell
Re: Using variable in block title
  • 2014/8/26 10:39

  • lionhell

  • Just popping in

  • Posts: 20

  • Since: 2006/8/13


Block templates manage block content, not block title !? Right ?

I'd like to insert smarty in the block title (not content), mainly a smarty, but any variable would be nice ...

For example:

With Birthday module, I'd like to set block title like that: "It happened on [the date]" , "the date" would be a smarty for current month and day.

I tried to enter a smarty in the xoops admin block page, but of course it didn't work


4
Bleekk
Re: Using variable in block title
  • 2014/8/26 10:53

  • Bleekk

  • Theme Designer

  • Posts: 940

  • Since: 2002/12/14


Ok i understand your problem.
Your theme is displaying the block for the columns in a foreach loop.
Take a look at your theme and you will find the part <{block.title}>
to see which id your block has, add <{block.id}> behind it.

To display the date only in this block after the title you can write a if statement. Something like
<{if block.id == 3}>your date smarty<{/if}>

5
lionhell
Re: Using variable in block title
  • 2014/8/26 11:10

  • lionhell

  • Just popping in

  • Posts: 20

  • Since: 2006/8/13


So simple !? thanks trying that immediately !

But if it was possible to hack so that smarties would be granted directly in block management, it would be great, and making that change independant of theme !

6
lionhell
Re: Using variable in block title
  • 2014/8/26 11:23

  • lionhell

  • Just popping in

  • Posts: 20

  • Since: 2006/8/13


Working nicely ! Thanks ...
If you had an idea to hack xoops , well ...

7
Bleekk
Re: Using variable in block title
  • 2014/8/26 11:31

  • Bleekk

  • Theme Designer

  • Posts: 940

  • Since: 2002/12/14


you are welcome :)

8
lionhell
Re: Using variable in block title
  • 2014/8/26 11:42

  • lionhell

  • Just popping in

  • Posts: 20

  • Since: 2006/8/13


Hum hum ... a tiny problem ...
I've inserted in theme.html:
<{php}>
$m['01']='janvier';
$m['02']='février';
$m['03']='mars';
$m['04']='avril';
$m['05']='mai';
$m['06']='juin';
$m['07']='juillet';
$m['08']='août';
$m['09']='septembre';
$m['10']='octobre';
$m['11']='novembre';
$m['12']='décembre';
$jour=new DateTime();
$ce_jour $jour->format('d').' '.$m[$jour->format('m')];
$xoopsTpl->assign('aujourdhui'$ce_jour);
<{/
php}>


But " $xoopsTpl->assign('aujourdhui', $ce_jour); " generates a blank page !


9
Bleekk
Re: Using variable in block title
  • 2014/8/26 11:51

  • Bleekk

  • Theme Designer

  • Posts: 940

  • Since: 2002/12/14


I would advise you to use smarty inside the theme.
Use smarty to create your new date variable

what you have done in php you can also do almost the same way in smarty


10
lionhell
Re: Using variable in block title
  • 2014/8/26 11:58

  • lionhell

  • Just popping in

  • Posts: 20

  • Since: 2006/8/13


The code itself is working, it's only the $xoopsTpl that is generating blank page.

Login

Who's Online

196 user(s) are online (105 user(s) are browsing Support Forums)


Members: 0


Guests: 196


more...

Donat-O-Meter

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

Latest GitHub Commits