Hey Thomas. Try calling theme_route_display_blog($theme) {
$theme->display('blog');
}
Also you might want to call the rewrite rule filter to add your custom rule,
instead of adding it via action_init.
Sent from my iPhone
On Apr 28, 2013, at 7:21 AM, Nathan Thomas <[email protected]>
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.