How can I insert variable parts in a custom block title? I would like the title of a custom block to depend on menu options selected in a left block. How can I do that ? Is it possible to hide the title of a custom block?

Requested by Paolig and Answered by Ladon on 2006/3/19 13:01:47

How can I insert variable parts in a custom block title? I would like the title of a custom block to depend on menu options selected in a left block. How can I do that ? Is it possible to hide the title of a custom block?

This can be done by using only smarty (no hacking): This example shows how to make links of the blocktitle depending on the contents of the <{$block.title}> variable.

<div class="blockTitle">
  <{if 
$block.title =="Recent logs"}> 
      <
a href="<{$xoops_url}>/modules/log/"><{$block.title}>a>
  <{elseif 
$block.title =="Recent posts"}>
      <
a href="<{$xoops_url}>/modules/newbb/"><{$block.title}>a>
  <{elseif 
$block.title =="Recent comments" && $xoops_isadmin}>
      <
a href="<{$xoops_url}>/modules/system/admin.php?module=0&status=0&limit=100&fct=comments&selsubmit=Go%21"><{$block.title}>a>
  <{else}>
        <{
$block.title}>
  <{/if}>
div>
<
div class="blockContent">
  <{
$block.content}>
div>
If you want the blocktitles to depend on the selected menu option use a smarty variable that only applies to the specific page the user navigated to. Example:
<{if $varibalename == "1" && $block.title =="Recent logs"}> put some html here  <{else}> <{$block.title}> <{/if}>
If needed, create the variable yourself. This will require some hacking. Example: insert this in index.php of a module where you want to change te blocktitle when te user navigates to this page.
$xoopsTpl->assign('varibalename''1');

This Q&A was found on XOOPS Web Application System : https://xoops.org/modules/smartfaq/faq.php?faqid=523