Page 1 of 1

Dynamically hide PageHeading from server side

Posted: Mon Sep 09, 2024 8:50 pm
by sangnandar

Is there a way to dynamically hide PageHeading WHILE keeping BodyTitle (for browser's tab) ?
My goal is to dynamically hide .content-header from server-side.

Layout.php said that it's controlled by CurrentPageHeading()

// phpfn.php
function CurrentPageHeading()
{
    global $Language, $Page;
    if (Config("PAGE_TITLE_STYLE") != "Title" && isset($Page) && method_exists($Page, "pageHeading")) {
        $heading = $Page->pageHeading();
        if ($heading != "") {
            return $heading;
        }
    }
    return $Language->projectPhrase("BodyTitle");
}

PageHeading get it's value by tableCaption

// models\<page>.php
public function pageHeading()
{
    global $Language;
    if ($this->Heading != "") {
        return $this->Heading;
    }
    if (method_exists($this, "tableCaption")) {
        return $this->tableCaption();
    }
    return "";
}

If I do this, it's successfully hide .content-header BUT browser's title is also gone.
Emptying only TblCaption doesn't work because CurrentPageHeading() return EITHER pageHeading or BodyTitle.

// models\<page>.php
public function pageRender()
{
  global $Language, $Breadcrumb;
  $Language->setTablePhrase($this->TableName, "TblCaption", "");
  $Language->setProjectPhrase("BodyTitle", "");
  $Breadcrumb->Visible = false;

Re: Dynamically hide PageHeading from server side

Posted: Mon Sep 09, 2024 11:57 pm
by sangnandar

Nevermind, turns out it can easily done with

// models\<page>.php
public function pageRender()
{
  Config("PAGE_TITLE_STYLE", "None");
}