October 18, 2002

I’ve given the matter of Blog variables quite a bit of thought and also looked at the various suggestions offered by people. While Tyran’s comment about putting the sidebar stuff inside it’s own Blog tag to identify them as static variables is good, I don’t want to use external variables just for sidebars, I want to allow people the freedom to use it for almost anything they can think of. Of course, you can still do it with the new Blog tag but then I’ll have to look out for multiple sections of the same tag if people want to use static variables externally in different places on their template. So, I’ve decided to go a slightly different route …

You can define an unlimited number of internal Blog variables but they’ll all probably begin something like $BlogVar with an identifying name after that bit. They have to be defined internally as either dynamic or static and they can be assigned a default value. Only the static variable values get replaced so that a new value will overwrite the old and this will happen only on Server mode if you receive an entry via e-mail with a new value defined for the static variable. The entry will be parsed at the time it is received and if it contains a static variable value, it will be stripped out of the e-mail but the static variable value will get updated. Why only via e-mail? Because if you are using Blog from your desktop, you can modify the static variable value yourself by hand by going into the edit variable dialog :p

With the above solution, there are no timing issues – a static variable is always updated when you receive a new entry via e-mail with a variable value and anything newer than that always overwrites the older one – unless of course due to some vagary in e-mail delays but even that can be accounted for if you keep track of the last date and time it was updated … unless of course, I run into some problem with time zone calculations <g> Since dynamic variables go inside an entry and are entry specific, they shouldn’t be affected at all by timing issues. This seems to provide a solution which will work fine for both static and dynamic variables and both internally and externally. At least, that’s how it looks to me … but you may see otherwise :p Comments?

Be Sociable, Share!
Tags: General
Posted by Fahim at 6:10 am   Comments (2)