Check if current page is frontpage?

Re: Check if current page is frontpage?

by Darko Miletić -
Number of replies: 0

For example, as you may or may not know the standard page type for course frontpage is course-view-[configured course format name], unfortunately [moodle]/course/view.php is not the only page with that type.

In core Moodle there are 2 places where this type is configured:

[moodle]/user/index.php (click to see the code) and [moodle]/user/view.php (click to see code)

So if I write some navigation extension which relies on fact that /course/view.php will be equal to pagetype 'course-view-[format]' I will be sadly bitten by the truth. Moodle is loaded with these inconsistencies and when you develop something you can seldom wait for something to be fixed in core. The only certain thing that has 1-1 relationship with a page is page url.