It's theme related, so depending on exactly what it does, I'd probably be inclined to stick it in the theme too. It should work in either place, but tossing it in a plugin might be worth a try, just to make sure.
On Sun, Apr 28, 2013 at 4:00 PM, Christopher Davis <[email protected]>wrote: > Hm, I would call tho from a plugin. > > Sent from my iPhone > > On Apr 28, 2013, at 11:23 AM, Nathan Thomas <[email protected]> > wrote: > > Thanks Owen and Chris, I've tried your suggestions but I still get the > 404. Just to check: this code should go in the custom theme class in > theme.php, right? Is there any way to check what is returned by the > add_rule? > > On Sunday, April 28, 2013 1:21:38 PM UTC+1, Nathan Thomas wrote: >> >> Hi all, >> >> I've really enjoyed using Habari over the past couple of years, and the >> transparency of the code has encouraged me to try to get to grips with it a >> little more. >> >> At the moment I'm trying to figure out how to display a custom template >> when I click on a link. I managed to create the new template using >> add_template, and it shows up when I call $theme->display('<new >> template>'). However, when I tried to create a rewrite rule to display the >> template whenever a specific URL is requested, I couldn't get it to work. >> >> Here's the code: >> >> <code> >> public function action_init() { >> $this->add_template('blog', dirname(__FILE__).'/blog.php',**false); >> $this->add_rule('"blog"','**display_blog'); >> } >> >> public function action_handler_display_blog( $handler ) >> { >> $handler->$theme->display('**blog'); >> } >> </code> >> >> From what I understand, this should add a new rule that uses the >> display_blog handler to display the blog.php template for the URL >> '<siteurl>/blog', but I just get a 404. >> >> Where am I going wrong? >> >> Thanks, >> Nathan >> >> P.S. The new Habari site design looks great BTW! >> > -- > -- > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/habari-dev > --- > You received this message because you are subscribed to the Google Groups > "habari-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > -- > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/habari-dev > --- > You received this message because you are subscribed to the Google Groups > "habari-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/habari-dev --- You received this message because you are subscribed to the Google Groups "habari-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
