What's The Function? How to check if page is index

alt=
@speedbunny
3 years ago
9 posts
I want to display something on all pages except the home page.

{if !jrCore_is_index()}
do something
{/if}

thanks!!

what's the function I'm looking for?

updated by @speedbunny: 05/09/21 01:12:29PM
alt=
@speedbunny
3 years ago
9 posts
Figure I can use

{if $page_template ne "index"}
do something
{/if}

but if there is a dedicated function, I've forgotten it!
michael
@michael
3 years ago
7,692 posts
There isn't.

add {debug} into the template you're wanting to use it in and see what variables you have available. MAYBE there is something like template name 'index' or something like that that only shows up on the index page.

There could be something useful in the $_post array because that contains all the info coming from the address bar, so maybe something from there. I think it usually has a $_post['url'] or $_post['uri'] variable in it which could work.

Last idea is to define a variable on the index page:
{$my_variable = 'index'}
then check against that variable lower down in the more internal pages.
paul
@paul
3 years ago
4,325 posts
I'd probably use the $_post array variable for this -

{if !isset($_post.module)}
Do Something
{/if}

hth


--
Paul Asher - JR Developer and System Import Specialist

Tags