Jump to content

Access theme parameters from a theme hook in PHP mode


Recommended Posts



I wrote a theme hook to add info in topic theme and then I edited the corresponding hook file as follows to add $my_content in the theme:


class covers_hook_topics_header extends _HOOK_CLASS_

/* !Hook Data - DO NOT REMOVE */
public static function hookData() {
// CODE TO produce $my_content HERE
return array_merge_recursive( array (
  'topic' => 
  array (
    0 => 
    array (
      'selector' => '#elClubContainer > div.ipsColumns > div.ipsColumn.ipsColumn_fluid > div.ipsPageHeader.ipsClearfix',
      'type' => 'add_inside_start',
'content' => $my_content
), parent::hookData() );

 Although this works, I would like to use the $topic (parameter from the topic theme) in my code above to produce $my_content.

Is there any way to access this variable in hookData? 

Link to comment
Share on other sites

Thanks Martin! You were right and it worked like a charm, first by editing the template and then also by using the block in the theme hook! 

I was not so experienced with the template/PHP syntax, so after many unsuccessful tries I thought this was almost impossible, but after I read the template guide better and checked a few examples it was finally easy to do what I wanted-much simpler than IPB3 (although escaping and syntax may be tricky some times)!

I should check more often the template guide, not only the developer guides.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...