webERP Forum

Full Version: Theme images in PcAnalysis.php and PcTabExpensesList.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

I have spotted that the company.png, user.png and magnifier.png images do not load in the above Petty Cash scripts.

When viewing HTML source, it appears that the 'theme' is not being pulled into the image URLs.

However, the 'theme' is being pulled into the default.css stylesheet URL.

Could this be related to the use of the PHPExcel class in these two scripts?

Thanks,

Andy.
This happens because the variable $Theme is being assigned in the main script, and then used within a function where is has no scope. A quick and dirty solution is to define that variable as global within the function, so if you insert the line

global $Theme;

at line 192 of PcAnalysis.php the problem goes away (and the same with other functions).

A better overall solution is to do away with the $Theme variable altogether. All that happens is every time a script is run the current theme is first assigned to the $_SESSION['Theme'] variable and then this is assigned to the $Theme variable, wasting a few clock cycles. Then $Theme is used throughout the code for the theme. Surely it is better to just use the $_SESSION variable throughout, and not re-assign it every time? This has the benefit of $_SESSION['Theme'] already having global scope so solves Andy's problem as well.

Thanks
Tim
Hi Tim,

I have gone with your suggestion of using $_SESSION['Theme'].

I replaced $Theme with $_SESSION['Theme'] in the 2 scripts above, and also in includes/header.php, which has solved the problem.

There was already partial use of $_SESSION['Theme'] in header.php, which is why default.css stylesheet was called correctly.

I will submit this along with some other work on Petty Cash within the next few days.

Thanks,

Andy.
Reference URL's