How to get a value of variable which is defined in config.php

pankajr

Joined: 2006-05-23
Posts: 3
Posted: Mon, 2006-05-29 15:53

Hello All,

I had defined a variable in config.php file, how can i get the value of that variable in theme/demor/templates/album.php file.

Regards,
Pankaj Kumar

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-05-31 17:27

album.php? sounds like g1 and not like g2.

 
pankajr

Joined: 2006-05-23
Posts: 3
Posted: Wed, 2006-05-31 18:06

Sorry it is album.tpl file not album.php file.
Here i am asking about g2.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7985
Posted: Thu, 2006-06-08 08:32

Supposing you put this in your config.php:

  $foo = "bar";

In themes/<yourtheme>/theme.inc edit the showAlbumPage() function and add this:

  $theme =& $template->getVariableByReference('theme');
  global $foo;
  $theme['foo'] = $foo;

That passes the value to the template. Then in the template you can do this:

  {$theme.foo}

to get your value.