[themes] D7 adding a themed item to a region

Jeff Greenberg listmail.ayendesigns at gmail.com
Mon May 28 21:36:48 UTC 2012


I have two isdues doing that. If I print from the preprocess or process function, the image appears but its html appears before the section tag for that region instead of inside it. 

Also, if I add the themed image variable to $vars, it isn't available in the page template. 

Sent from my iPhone

On May 28, 2012, at 1:04 PM, Carl Wiedemann <carl.wiedemann at gmail.com> wrote:

> Render arrays are very specific, so you'd likely have to add it via $page['some_key']['#markup'] => $output;
> 
> I'd recommend doing these things in the preprocess function, not the process function. Preprocess is generally better understood and has more historic precedence.
> 
> Unless you have an explicit reason to use render(), I don't see any harm in creating your own variables in the preprocessor and printing them directly.
> 
> Carl Wiedemann
> Website design & development consulting | c4rl.ws
> carl.wiedemann at gmail.com | skype: c4rlww
> 
> 
> 
> On Mon, May 28, 2012 at 10:46 AM, Jeff Greenberg <listmail.ayendesigns at gmail.com> wrote:
> I am displaying a large image in a front-page region. Currently I hook process_region in template.php, set a variable = theme('image'), and print it. 
> 
> I'm thinking that rather than printing it from the hook, I'd rather add it to $page[my_region_name] and let it get printed when the template prints render[my_region_name]. 
> 
> Where do I add it, or what do I call to add it?  I tried doing things in the hook like $vars[page][my_region_name][content][] = $my_themed_image, but that doesn't work.
> 
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
> 
> 
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20120528/7db83f19/attachment.html 


More information about the themes mailing list