GeniXCMS

Pages Class

categoryAPI edit_calendar31 Mar 2026

Page Type & Localization Class


The Pages class is a specialized utility in GeniXCMS designed to identify the current content context within your theme's templates. It provides a semantic set of conditional methods that allow your design to adapt dynamically based on whether a visitor is viewing the homepage, a blog post, a static page, or a custom module.


⚡ Content Context Discovery

The following methods are the primary tool for theme logic, returning a bool based on the active route's detected type.

Method Returns true if current view is...
Pages::isHome() The site's primary landing page (Index).
Pages::isPost() An individual editorial blog post.
Pages::isPage() A foundational static page (e.g., About Us).
Pages::isCat() A category-based content archive.
Pages::isTag() A tag-based content archive.
Pages::isMod() A custom page provided by an active module.

🎨 Implementation Workflow

These context-aware methods are typically used in theme files (like sidebar.php, header.php, or footer.php) to toggle layouts or inject specialized meta-tags and assets.

// Example: Dynamic Sidebar Selection
if (Pages::isPost()) {
    // Inject blog-specific components (Author Bio, Related Posts)
    Theme::inc('sidebars/blog-meta'); 
} elseif (Pages::isPage()) {
    // Inject page-specific components (Table of contents, etc.)
    Theme::inc('sidebars/page-navigation');
}

🏗️ Technical Engine

The Pages class functions as a thin wrapper around the global $data array.

  • Initialization: The context is determined by the Control Class immediately after the Router resolves the URI.
  • Population: The framework populates the p_type key, which these methods monitor.

💡 Advanced Layout Switching

Combined with the Theme Class, you can create a completely polymorphic site architecture.

// In your theme's index.php
if (Pages::isHome()) {
    Theme::inc('layouts/home-hero');
} else {
    Theme::inc('layouts/subpage-header');
}

lightbulb
TipSEO Performance: Use Pages::isHome() in your header to decide whether to wrap your site name in an <h1> (on the home page) or an <a> (on sub-pages) for optimal semantic SEO hierarchy.

See Also