I like to avoid using globals if possible. If you're just using vanilla functions - the DB object should be available without the need to use global. If you're using classes, it may be more complicated. You mention using Smarty - I haven't used it for a couple of years, so I can't quite remember the pitfalls, but I can't imagine that it would present an obstacle as you sort out your variables in php before assigning them/setting the block to the html template.