Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Globals that do not need to be globals

Quote Reply
Globals that do not need to be globals
Hi:

In the course of trying to find if some info was in a global I could access, I did a global dump. As I was looking at all the globals, I noticed a couple that really do not need to be recalculated for every page...

for instance, I have a global to spit out the newest user, and this only shows up on the main page... does not need to be re-figured-out for all the sub-pages and threads.

Is there a way to restrict a global so it is ONLY calculated for one page, or a specific series of pages... or am I just being stupid? Does it really not have any effect on things...

(To be honest, I am sure that the global for newest user has very little effect. But there are a couple others, globals that call the five newest threads, chop them to 100 characters, and then output them as XML that I am more concerned about- that would take a bit of time, especially if something like that was called for EVERY page view, and really only needed to be calculated when the XML was called)

Anyway, love to hear your thoughts!
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] Globals that do not need to be globals In reply to
If you are refering to 'sub { ... }' globals, the code in them only runs if you include the <%global_tag%> on your page. The only time any work is being done is when the global is actually displayed on the page, so as long as you don't include the XML global on non-XML pages, GForum isn't doing any work.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Globals that do not need to be globals In reply to
Jagerman:

OK, that releives me a whole lot! So somne thin in a global dump like:

newest_user $VAR = 'CODE(0x839a27c)';

is not actuallt processed unless <%newes_user%> is called. Great!
dave

Big Cartoon DataBase
Big Comic Book DataBase