is_page

瀏覽次數:2 次
跳到第一則未讀訊息

Adam

未讀,
2008年5月10日 晚上9:12:362008/5/10
收件者: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

未讀,
2008年5月10日 晚上11:15:322008/5/10
收件者: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

未讀,
2008年5月11日 清晨5:19:152008/5/11
收件者: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

未讀,
2008年5月11日 上午8:58:242008/5/11
收件者: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

未讀,
2008年5月11日 下午3:16:272008/5/11
收件者: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

未讀,
2008年5月14日 晚上10:05:062008/5/14
收件者: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

未讀,
2008年5月15日 上午9:51:042008/5/15
收件者: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 -
回覆所有人
回覆作者
轉寄
0 則新訊息