mattyvx Posted January 11, 2010 Share Posted January 11, 2010 Hi, Take this example; I sell one service on my website. On many pages the cost of this service is displayed: Say the repeated statement "12month membership for £20". The cost may vary from time to time and I do not wish to change every statement. Taking this to another level, my site has many repeated statements, what is the best way to display these 'would be' variables on my website. Do i create a "master" php script and include it on every page? Is there a better way like configuring all pages to reference this master via htacess (for example)? Your thoughts, Quote Link to comment https://forums.phpfreaks.com/topic/188104-global-variables/ Share on other sites More sharing options...
mikesta707 Posted January 11, 2010 Share Posted January 11, 2010 The easiest thing to do would probably be to just create a config file with your variables that appear alot of places, and include it where ever its needed Quote Link to comment https://forums.phpfreaks.com/topic/188104-global-variables/#findComment-993083 Share on other sites More sharing options...
mattyvx Posted January 11, 2010 Author Share Posted January 11, 2010 I have a menu included on 99% of my pages so maybe to reduce requests i can attatch some variables to that... I was just wondering how others would go about it... and to find the most efficient way. Quote Link to comment https://forums.phpfreaks.com/topic/188104-global-variables/#findComment-993087 Share on other sites More sharing options...
mikesta707 Posted January 11, 2010 Share Posted January 11, 2010 if you need to include a page, than you include a page. A programmers gotta do what a programmers gotta do. Efficiency will only come into play if your start including gigantic files. But if you include files with a few lines its basically the same (well a little different) as just copy pasting the lines to wherever the include command is. Quote Link to comment https://forums.phpfreaks.com/topic/188104-global-variables/#findComment-993089 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.