On Friday 28 Jan 2011 00:30:05 Hector Virgen wrote: > Jurien, back to your original post, generally what I do is I set the > "default" meta tags early in the application (usually during bootstrap) and > actions/views can replace them if necessary by providing new values using > the normal view helper methods. This means my layout just has a simple echo > and no logic: > > <?php echo $this->headMeta(); ?>
Actually I work also with the headMeta view helper to echo all the meta data at once. For some tags, I use the bootstrap (see below). The problem was the detection of an existing value in a certain meta tag. A use case: I have multiple content blocks (eg a two/three/four column page). All these blocks have opportunities to set a description. I'd like to have the block at the top (the first column this case) to set the description. If I just set the description, the description of the page would be the last column/lowest content block, because it overwrite any previous set description. That's not reasonable, so therefore I required the not-empty detection :) > As for handling this in the bootstrap, I've written a nifty "meta" > bootstrap resource plugin that allows me to configure each environment > with different defaults. Feel free to check it out here: > http://pastie.org/1504249 > > My configuration for this resource looks like this: > > ; Meta data > resources.meta.names.title = "Virgen Technologies" > resources.meta.names.description = "Web technologies and stuff!" > resources.meta.names.keywords = "php mysql apache zend framework" > resources.meta.httpEquivs.expires = "Wed, 26 Feb 1997 08:21:57 GMT" > resources.meta.httpEquivs.pragma = "no-cache" > resources.meta.httpEquivs.Cache-Control = "no-cache" > resources.meta.httpEquivs.Content-Type = "text/html;charset=utf-8" > resources.meta.httpEquivs.Content-Language = "en-US" > > I hope this helps! Thanks for sharing. I extended the view resource plugin for this purpose actually. Besides meta data, I also took care of helpers and scripts to be set: resources.view.doctype = "HTML5" resources.view.encoding = "UTF-8" resources.view.title.separator = " - " resources.view.helper.Soflomo_View_Helper = "Soflomo/View/Helper" resources.view.helper.View_Helper = APPLICATION_PATH "/layouts/helpers" resources.view.script[] = APPLICATION_PATH "/layouts/partials/" resources.view.meta.httpEquiv.Content-Type = "text/html; charset=utf-8" resources.view.meta.name.copyright = "Copyright (c) Jurian Sluiman 2009-2011" resources.view.meta.name.generator = "Soflomo Framework" For the meta-section, I created something similar as your meta resource plugin. Regards, Jurian -- Jurian Sluiman Soflomo - http://soflomo.com
