is_page

4 views
Skip to first unread message

Adam

unread,
May 10, 2008, 9:12:36 PM5/10/08
to habari-users
In Wordpress, (spits in corner), you can call a function based on the
page slug:

<?php if ( (is_home())?>
<p>this is the homepage!</p>
<?php } } ?>

Now, I would have assumed that should this be possible in Habari, the
code would be:

<?php if ( is_page( 'about' ) ) :?>
<p>Yes, it's an extender! Fantastic. That is the icing on the cake.</
p>
<?php endif; ?>

However, all this does is kill my sidebar, (which is where I am
calling it from).

All correct answers are in the running for the grand prize of empty
promises in a variety of colours.

Andrew da Silva

unread,
May 10, 2008, 11:15:32 PM5/10/08
to habari-users
I'll take a blog design for 500 Bob!

$request->display_home

display_home being the RewriteRule name, for a specific page, you'ld
do $request->display_page (or display_entry) with a check against the
$post->slug == 'about'

Did that make sense?

Adam

unread,
May 11, 2008, 5:19:15 AM5/11/08
to habari-users
Erm... no, sorry that didn't make sense.
I'm going to need more help, where am I putting the $request->, on the
page I want the information displayed, or in the theme.php.

Also, how are I structuring the code, is it all in one long php line,
or top and tailing my content?

Once I know, I'll stick it in the wiki if only so I know myself next
time!

rick c

unread,
May 11, 2008, 8:58:24 AM5/11/08
to habari-users
$request is a member variable of the theme class you are using, so it
is more commonly used in one of the theme's templates. If you do use
it in your theme.php, it would need to be refer to in the form $this-
>request->*type of page requested*. http://wiki.habariproject.org/en/User:mikelietz
lists the built-in page types that can be attributes of the $request
object.

For the 'about' example you gave, code similar to

<?php if ( $request->display_home && $post->slug == 'about' ) { ?>
<p>We're on the home page, Bob!</p>
<?php } else { ?>
<p>Help! I'm being held captive!</p>
<?php } ?>

should work.

Rick

Adam

unread,
May 11, 2008, 3:16:27 PM5/11/08
to habari-users
That's great, thank-you.


On May 11, 1:58 pm, rick c <rickcock...@gmail.com> wrote:
> $request is a member variable of the theme class you are using, so it
> is more commonly used in one of the theme's templates. If you do use
> it in your theme.php, it would need to be refer to in the form $this->request->*type of page requested*.http://wiki.habariproject.org/en/User:mikelietz

mikelietz

unread,
May 14, 2008, 10:05:06 PM5/14/08
to habari-users
Hm, since this is actually useful information perhaps it belongs in
the regular wiki hierarchy. Where do objects go?

On May 11, 8:58 am, rick c <rickcock...@gmail.com> wrote:
> $request is a member variable of the theme class you are using, so it
> is more commonly used in one of the theme's templates. If you do use
> it in your theme.php, it would need to be refer to in the form $this->request->*type of page requested*.http://wiki.habariproject.org/en/User:mikelietz

Adam

unread,
May 15, 2008, 9:51:04 AM5/15/08
to habari-users
I've wikified the responce from Rick C:

http://wiki.habariproject.org/en/Request_Display_Content

There are some points I want to test regarding certain page types,
I'll finish it when I get home tonight.
> > > > > promises in a variety of colours.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages