[development] active language in template.php

Pooya pooya.source at gmail.com
Thu Aug 25 12:00:51 UTC 2011


I used global $language;
$user is the one which user select for default language in profile I guess

On Thu, Aug 25, 2011 at 3:50 PM, Todd <todd at savagevenus.net> wrote:

> I believe you can use the $user variable in template.php.
>
> global $user;
> debug($user);
> -or, if using Drupal 6-
> dsm($user);
>
> http://api.drupal.org/api/drupal/developer--globals.php/global/user/7
>
> Regards,
> Todd
>
> On 25 Aug 2011, at 06:34, Pooya wrote:
>
> Quick and simple:
> is there a way to get the active language user is viewing site in
> template.php, sth like $language->language in page.tpl.php?
>
> I want to use it in a condition like this:
> function rouzdarou_breadcrumb($breadcrumb) {
>
> if(arg(0) == 'news'){
>   global $base_url;
>   if($language->language=='en'):
>     $breadcrumb[0] = l('Home', $base_url);
>     $breadcrumb[1] = l('News', 'news');
>   endif;
> }
>  return theme_breadcrumb($breadcrumb);
> }
>
>
> but dsm($language->language); returns nothing in template.php. If any1
> knows another way to achieve this share :)
> Thanks in advanced.
>
> --
> Pooya Sanooei
> Twitter <http://twitter.com/sourcesoft> - Facebook<http://facebook.com/pooya.sanooei>-
> Website <http://www.sanooei.com/>
>
>
>


-- 
Pooya Sanooei
Twitter <http://twitter.com/sourcesoft> -
Facebook<http://facebook.com/pooya.sanooei>-
Website <http://www.sanooei.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110825/4379f1c0/attachment.html 


More information about the development mailing list