Remove Header and Footer from Admin

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
vinman57
Posts: 65
Joined: Thu Jan 17, 2008 4:13 am

Remove Header and Footer from Admin

Post by vinman57 »

Script URL: www.pianowizardacademy.com/helpdesk
Version of script: 2.65
What terms did you try when SEARCHING for a solution: header,footer

Write your message below:

I have header and footer txts on main support site. It would be great to have the header and footer not appear in admin to reduce clutter.

Is that possible?

thanks
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Remove Header and Footer from Admin

Post by Klemen »

You just need a way of detecting if a page is located in the "admin" folder.

For example, at the top of inc/header.inc.php (just below the if (!defined ....) line) add something like

Code: Select all

$admin_panel = strpos($_SERVER['SCRIPT_FILENAME'], '/' . $hesk_settings['admin_dir'] . '/') !== false ? true : false;
Then check if $admin_panel variable is true to perform action, for example change

Code: Select all

include(HESK_PATH . 'header.txt');
to

Code: Select all

if (!$admin_panel) {include(HESK_PATH . 'header.txt');}
This second part needs to be done in the footer.inc.php file too.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
vinman57
Posts: 65
Joined: Thu Jan 17, 2008 4:13 am

Re: Remove Header and Footer from Admin

Post by vinman57 »

Works like a charm with the header, not so with the footer.

Can't find footer.txt code to replace in the footer inc file... perhaps because it's encrypted?

Not a big deal anyway, it was the header that was in the way.

Thank you
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Remove Header and Footer from Admin

Post by Klemen »

Right, but you can try adding this inside the footer.txt file:

Code: Select all

<?php global $admin_panel; if (!$admin_panel) { ?>

YOUR EXISTING FOOTER CODE HERE

<?php } ?>
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
vinman57
Posts: 65
Joined: Thu Jan 17, 2008 4:13 am

Re: Remove Header and Footer from Admin

Post by vinman57 »

Didn't work Klemen. Footer is still loading in Admin
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Remove Header and Footer from Admin

Post by Klemen »

The code was missing global $admin_panel; I changed that so try it again, works for me now.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
vinman57
Posts: 65
Joined: Thu Jan 17, 2008 4:13 am

Re: Remove Header and Footer from Admin

Post by vinman57 »

Nice job.

We'll be upgrading soon.

Will just have to remember that first piece of code in the core inc file when there are upgrades.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Remove Header and Footer from Admin

Post by Klemen »

Well you could just modify header and footer directly and ignore everything else. This way it will persist during updates, just make sure you don't overwrite the header.txt/footer.txt files.

header.txt

Code: Select all

<?php if (strpos($_SERVER['SCRIPT_FILENAME'], '/' . $hesk_settings['admin_dir'] . '/') === false) { ?>

HEADER CODE HERE

<?php } ?>
footer.txt

Code: Select all

<?php if (strpos($_SERVER['SCRIPT_FILENAME'], '/' . $hesk_settings['admin_dir'] . '/') === false) { ?>

FOOTER CODE HERE

<?php } ?>
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
vinman57
Posts: 65
Joined: Thu Jan 17, 2008 4:13 am

Re: Remove Header and Footer from Admin

Post by vinman57 »

Nice Klemen. Hope this helps other too.
vinman57
Posts: 65
Joined: Thu Jan 17, 2008 4:13 am

Re: Remove Header and Footer from Admin

Post by vinman57 »

By the way, in debug mode, I get this error in the admin:

Notice: Undefined variable: admin_panel in /inc/header.inc.php on line 121

only in admin. Is this related to the code we invoked?

This has no affect on performance.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Remove Header and Footer from Admin

Post by Klemen »

Use the original header.inc.php file and modify the header.txt file as suggests in my last post, that should fix it.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
vinman57
Posts: 65
Joined: Thu Jan 17, 2008 4:13 am

Re: Remove Header and Footer from Admin

Post by vinman57 »

I am using the original header inc file.

Line 21 is : if (!$admin_panel) {include(HESK_PATH . 'header.txt');}

And only the header and footer txt files contain the code

As I said, everything works, just the error line in debug mode.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Remove Header and Footer from Admin

Post by Klemen »

That's the modified, not original header.inc.php file. The original HESK file doesn't use $admin_panel variable.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
vinman57
Posts: 65
Joined: Thu Jan 17, 2008 4:13 am

Re: Remove Header and Footer from Admin

Post by vinman57 »

Oops.

Thank you
Post Reply