Pass variables to the header text key of a block

I was looking for a way to pass a variable to the language key for the block header.  When I set the block up in the install.sql for the module in the sys_page_compose there is a Caption field for the block where you insert the language key for the block title.  When the block is added to the page, the language key is translated into the text.  Is there a way in the code that generates the block for the page to include a variable that gets passed and added to the language key similar to:

 

_t('_language_key', $variable1, $variable2, $variable3)

 

say for adding particular member info into the Block title like user's name.

 

Geeks, making the world a better place
Quote · 26 Mar 2014

It may depend on what exactly you are trying to display and on what page you are trying to display it on. Using your example of the members nickname in a block heading. In theory, this may be possible if the block is on the Profile page. Most pages already have variables that may be passable. So, on the profiles page, trying something like:

 

_t('_language_key', $p_arr['UserName'])

 

 

 

 I am not 100% sure if this will work, but hope it helps you get to where you are going.

caredesign.net
Quote · 26 Mar 2014

 

_t('_language_key', $variable1, $variable2, $variable3)

 
Actually yes you can do exactly that.

The language key text can contain replacement keys such as {0}, {1} and {2}

Then pass them using the _t function as you did in your example. NOTE: Only 3 replacements are supported, so plan for that.

You can look at the free pages module for an example.

'_bx_pages_wall_added_new_items' => 'added {0} new pages',

The key and it's content.

https://www.deanbassett.com
Quote · 26 Mar 2014

Thanks for the pointers, I will see if I can figure this out or not :-).

Geeks, making the world a better place
Quote · 27 Mar 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.