Data at Your Fingertips: Explore Our New Reporting and Statistical Capabilities By Ryan Ashbrook 2 hours ago
Valtasar Posted October 7, 2017 Share Posted October 7, 2017 Hi, 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 More sharing options...
Martin A. Posted October 7, 2017 Share Posted October 7, 2017 Why would you need to generate the content on the "outside"? You can use raw PHP in the content box, where you'll then have access to $topic, and all other variables that may exist in a template. Link to comment Share on other sites More sharing options...
Valtasar Posted October 7, 2017 Author Share Posted October 7, 2017 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.