Page 1 of 1
Different CSS for Admin?
Posted: Tue Apr 23, 2013 10:53 am
by JamesN
I've setup the hesk software on my site customizing the frontend user side. The problem with this is that by doing this, its made a mess of the admin side.
I was hoping to get around this by using the default css file and a blank header/footer file for the admin area.
How could I do this?
Re: Different CSS for Admin?
Posted: Tue Apr 23, 2013 6:09 pm
by Klemen
You could try changing this in inc/header.inc.php:
Code: Select all
<?php echo HESK_PATH; ?>hesk_style_v24.css
To say:
Code: Select all
<?php
if (basename(__DIR__) == 'admin') {define('IS_ADMIN', true);}
else {define('IS_ADMIN', false);}
echo HESK_PATH . (IS_ADMIN ? 'hesk_style_v24_ADMIN.css' : 'hesk_style_v24.css');
?>
(where "hesk_style_ADMIN_v24.css" is the CSS file to use for admin panel).
And for header/footer you could paste something like this inside each text file:
Code: Select all
<?php
if (empty(IS_ADMIN))
{
?>
YOUR HEADER/FOOTER CODE HERE
<?php
}
?>
Re: Different CSS for Admin?
Posted: Tue Apr 23, 2013 8:24 pm
by JamesN
Thanks for coming back to me. It isnt working though, and just displays blank pages everywhere when I make the changes. It seems to be to do with the footer and header because once I revert those files everything returns to normal.
Does this look correct?
This is how my header.inc file
Code: Select all
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><?php echo (isset($hesk_settings['tmp_title']) ? $hesk_settings['tmp_title'] : $hesk_settings['hesk_title']); ?></title>
<meta http-equiv="Content-Type" content="text/html;charset=<?php echo $hesklang['ENCODING']; ?>" />
<link href="<?php
if (basename(__DIR__) == 'admin') {define('IS_ADMIN', true);}
else {define('IS_ADMIN', false);}
echo HESK_PATH . (IS_ADMIN ? 'hesk_style_v24_ADMIN.css' : 'hesk_style_v24.css');
?>" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="../css/portal.css">
<script language="Javascript" type="text/javascript" src="<?php echo HESK_PATH; ?>hesk_javascript_v24.js"></script>
My header txt file
Code: Select all
<?php
if (empty(IS_ADMIN))
{
?>
<div class="main_content">
<?php include ("../top.php"); ?>
<div class="portal_content">
<!-- VERTICAL AD -->
<div class="ad_160_600">
<?php include ("../160x600.php"); ?>
</div>
<div class="wide_column">
<div class="wide_column_content">
<?php
}
?>
and my footer
Code: Select all
<?php
if (empty(IS_ADMIN))
{
?>
<?php include ("468x90.php"); ?>
</div>
</div>
</div>
<div style="clear:both"></div>
</div>
<?php include ("../bottom.php"); ?>
</body>
</html>
<?php
}
?>
Thanks for your help, appreciate it

Re: Different CSS for Admin?
Posted: Tue Apr 23, 2013 8:46 pm
by Klemen
Never mind, my error.
Try this instead:
header.inc.php
Code: Select all
<?php
if (strpos($_SERVER['PHP_SELF'], '/admin') !== false) {define('IS_ADMIN', true);}
echo HESK_PATH . (defined('IS_ADMIN') ? 'hesk_style_v24_ADMIN.css' : 'hesk_style_v24.css');
?>
header/footer.txt
Code: Select all
<?php
if (defined('IS_ADMIN'))
{
?>
YOUR CODE HERE
<?php
}
?>
Re: Different CSS for Admin?
Posted: Wed Apr 24, 2013 7:53 am
by JamesN
Thanks for that. The CSS part is working fine now, but the header/footer is broken.
This is my header file as an example. I take out the condition if and it displays fine, so I know its that.
Code: Select all
<?php
if (defined('IS_ADMIN'))
{
?>
<div class="main_content">
<?php include ("../top.php"); ?>
<div class="portal_content">
<!-- VERTICAL AD -->
<div class="ad_160_600">
<?php include ("../160x600.php"); ?>
</div>
<div class="wide_column">
<div class="wide_column_content">
<?php
}
?>
Re: Different CSS for Admin?
Posted: Wed Apr 24, 2013 7:55 am
by JamesN
It seems I don't have to worry though, the header/footer files aren't showing in the admin panel anyway
Thanks again for your help!

Re: Different CSS for Admin?
Posted: Wed Apr 24, 2013 1:23 pm
by Klemen
This will show your code in admin pages only:
Changing it to this will show for customers only:
This will let you use a custom header for both:
Code: Select all
<?php
if (defined('IS_ADMIN'))
{
?>
CODE FOR ADMIN PANEL HERE
<?php
}
else
{
?>
CODE FOR CUSTOMER SIDE HERE
<?php
}
?>
Re: Different CSS for Admin?
Posted: Thu Apr 25, 2013 12:34 am
by JamesN
Thanks so much

Re: Different CSS for Admin?
Posted: Thu Apr 25, 2013 12:41 am
by JamesN
It seems I spoke too soon
See these two screenshots. It's fine on the main menu of the admin area, but as soon as I go into a ticket there, it doesn't pick it up properly with the header/footer. The interesting thing is though, the rest of the admin section is fine, its just the ticketing section.
Screenshots of Pages:
http://s20.postimg.org/jwf0a47ft/mainmenu.jpg
http://s20.postimg.org/apwpmu27d/ticket.jpg
Sourcecode of Pages:
http://s20.postimg.org/9owgxpl7x/mainmenu_source.jpg
http://s20.postimg.org/vpctec3vx/ticket_source.jpg
Any ideas?
header
Code: Select all
<?php
if (!defined('IS_ADMIN'))
{
?>
<div class="main_content">
<?php include ("../top.php"); ?>
<div class="portal_content">
<!-- VERTICAL AD -->
<div class="ad_160_600">
<?php include ("../160x600.php"); ?>
</div>
<div class="wide_column">
<div class="wide_column_content">
<?php
}
?>
footer
Code: Select all
<?php
if (!defined('IS_ADMIN'))
{
?>
<?php include ("../468x90.php"); ?>
</div>
</div>
</div>
<div style="clear:both"></div>
</div>
<?php include ("../bottom.php"); ?>
</body>
</html>
<?php
}
?>
Re: Different CSS for Admin?
Posted: Thu Apr 25, 2013 3:23 pm
by Klemen
How about if you change
Code: Select all
strpos($_SERVER['PHP_SELF'], '/admin')
to
Code: Select all
strpos($_SERVER['PHP_SELF'], 'admin')
?
Re: Different CSS for Admin?
Posted: Thu Apr 25, 2013 8:16 pm
by JamesN
Perfect now, thanks again
