I'm having a couple issues with the Widget Framework, and am hoping you can help. First issue: This is my situation (pasted from the FAQ) : I've used the category_view position to successfully add a sidebar block on a specific category page. However, I also need to add two template widgets -- one to the hook:ad_above_content and the other to the hook:ad_above_content spot on that category page. I'd like the template widgets to appear on category's forums as well, and it's showing up correctly in the forums -- just not on the category page itself. The expression I'm using is: Code: $forum['parent_node_id'] == 4 OR $category['node_id'] == 4 Could you please tell me if there's any way to do this? Second issue: As described above, I'm using the Threads widget in the sidebar of all forum lists within a category, and on the category page itself. Every time someone accesses the category page, the widget renders -- bit I get an error in my logs (pasted below). The widget works fine (and without error) on the actual forum pages -- it's only the category page that throws the error(s). Here are my settings: Renderer: Threads Widget Type: New Replies Forums: (selected all child forums by name) Expression: $forum['parent_node_id'] == 4 OR $category['node_id'] == 4 Position: category_view, forum_view Code: Server Error Log Error Info ErrorException: Undefined variable: forum - library/WidgetFramework/WidgetRenderer.php(482) : runtime-created function:1 Generated By: Pixels, A moment ago Stack Trace #0 /home/domain/public_html/mydomain.com/xen/library/WidgetFramework/WidgetRenderer.php(482) : runtime-created function(1): XenForo_Application::handlePhpError(8, 'Undefined varia...', '/home/domain/...', 1, Array) #1 [internal function]: __lambda_func(Array) #2 /home/domain/public_html/mydomain.com/xen/library/WidgetFramework/WidgetRenderer.php(486): call_user_func('?lambda_168', Array) #3 /home/domain/public_html/mydomain.com/xen/library/WidgetFramework/WidgetRenderer.php(572): WidgetFramework_WidgetRenderer->_executeExpression('$forum['parent_...', Array) #4 /home/domain/public_html/mydomain.com/xen/library/WidgetFramework/Core.php(396): WidgetFramework_WidgetRenderer->render(Array, 'category_view', Array, Object(XenForo_Template_Public), '') #5 /home/domain/public_html/mydomain.com/xen/library/WidgetFramework/Core.php(313): WidgetFramework_Core->_renderWidgetsFor('category_view', Array, Object(XenForo_Template_Public), '') #6 /home/domain/public_html/mydomain.com/xen/library/WidgetFramework/Listener.php(126): WidgetFramework_Core->renderWidgetsFor('category_view', Array, Object(XenForo_Template_Public), Array) #7 [internal function]: WidgetFramework_Listener::template_post_render('category_view', '??????????????<...', Array, Object(XenForo_Template_Public)) #8 /home/domain/public_html/mydomain.com/xen/library/XenForo/CodeEvent.php(58): call_user_func_array(Array, Array) #9 /home/domain/public_html/mydomain.com/xen/library/XenForo/Template/Abstract.php(195): XenForo_CodeEvent::fire('template_post_r...', Array, 'category_view') #10 /home/domain/public_html/mydomain.com/xen/library/XenForo/Template/Public.php(110): XenForo_Template_Abstract->render() #11 /home/domain/public_html/mydomain.com/xen/library/XenForo/ViewRenderer/HtmlPublic.php(123): XenForo_Template_Public->render() #12 /home/domain/public_html/mydomain.com/xen/library/XenForo/FrontController.php(618): XenForo_ViewRenderer_HtmlPublic->renderContainer(Object(XenForo_Template_Public), Array) #13 /home/domain/public_html/mydomain.com/xen/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_HtmlPublic), Array) #14 /home/domain/public_html/mydomain.com/xen/index.php(13): XenForo_FrontController->run() #15 {main} Request State array(3) { ["url"] => string(35) "http://mydomain.com/xen/roleplaying/" ["_GET"] => array(0) { } ["_POST"] => array(0) { } } Any help you can provide is greatly appreciated!
Can you please create separate threads next time for issues? Doing that makes it easier to track our answers to your questions and also help other to find answers Regarding your first issue, you cannot use template variable in page container hook position. This is a limitation with the system and cannot overcome easily for now. However, you can do something like this: PHP: in_array('node4', explode(' ', bodyClasses), true) !== false For your second issue, you get the error because the variable $forum is not available in the category_view (and $category is not available in forum_view). You can change the expression to this: PHP: (isset($forum) AND $forum['parent_node_id'] == 4) OR(isset($category) AND $category['node_id'] == 4)