Forgive my ignorance as a (relative) newbie to Drupal. I have wanted to ask this question some time ago and delayed in case I came across an answer.
I am converting an existing PHP based site to Drupal.
Where the stock elements are currently in .CSV tables, I am creating Drupal nodes classified according to an appropriate taxonomy.
There are many custom PHP functions such as calculators, estimating modules and diverse php functions such as the one below.
On the existing site these functions are grouped in a genfunc.php file and are globally accessible across the old program.
At present I can use <?php include "xyz.inc"; ?> statements to include the PHP function codes where required.
However, this is messy since for 138 stock listings, the .inc file gets opened and closed 138 times etc.
My question: If I wanted to include these custom .php functions so that they are available globally, where would be the best place to 'patch' into the Drupal .php files. Is there something like a global function file in Drupal where I could patch the single line <?php include 'functions.php'; ?> so that the functions become globally available in all modes? I would prefer the solution that would have the absolute least impact and hassle when upgrading to future versions of Drupal.
Are there alternate solutions?
An example function is included below. Obviously the advantages of maintaining a single function is obvious vs. patching a complex html argument into 138 nodes.