How to Change Header and Footer Content from the Server Script?

I am trying to create a footer with icons to be shown at the botton just like the mobile apps
as the icon is dynamic as per the userlevel so i put the code in the
Server Event → Global → All Page → Page_Loading

$footerIcons = '
		<div class="footer-icons">
            <a href="Menuhome" class="footer-icon active"><i class="fas fa-home"></i></a>
            <a href="recharge" class="footer-icon"><i class="fas fa-bolt"></i></a>
            <a href="recharge" class="footer-icon"><i class="fas fa-bolt"></i></a>
            <a href="recharge" class="footer-icon"><i class="fas fa-bolt"></i></a>
            <a href="wallet" class="footer-icon"><i class="fas fa-wallet"></i></a>
            <a href="Tmp" class="footer-icon"><i class="fas fa-user"></i></a>
        </div>
    ';
    Language()->setProjectPhrase("FooterText", $footerIcons);

when there is any error on the page the Header stay but the footer change to default text

Is there any alternate way to chang the default footer text dynamically from the server event so that the footer never change when there is an error also.

In so many case we want to change or add contents to the header and footer.
Now we can do using the javascript but it load and change the data.

Instead how to change the data in the header and footer using the Server Event → Global → header contents or footer contents and just echo or html code allow to display in header and footer?

If you want to customize by changing the language phrase, you should use Language_Load server event, not Page_Loading.

Thanks it work perfect for the footer.
any option for Header also using the server script and no java
just to dispaly name or balance in the header.

Which “header” are you referring to? If you meant the page header (e.g. “Cars Edit”), note that each page has Heading and Subheading property.

the navbar where the menu and user icon is showing

You may try Page_Foot server event.