Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Theme images in PcAnalysis.php and PcTabExpensesList.php
07-19-2017, 10:38 PM
Post: #1
Theme images in PcAnalysis.php and PcTabExpensesList.php
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.
Find all posts by this user
Quote this message in a reply
07-19-2017, 11:38 PM
Post: #2
RE: Theme images in PcAnalysis.php and PcTabExpensesList.php
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
Visit this user's website Find all posts by this user
Quote this message in a reply
07-20-2017, 12:25 AM
Post: #3
RE: Theme images in PcAnalysis.php and PcTabExpensesList.php
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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)