By qinqiu on
Said that
<?php
function my_module_theme()
{
return array
(
'me_or_them' => array
(
'variables' => array('account' => NULL),
),
);
}
?>is hook_theme function for registering theme function to drupal. and then theme_me_or_them is registered.
Then could someone please tell me if $variables in
<?php
function theme_me_or_them($variables)
{
global $user;
$account = $variables['account'];
return ($user->uid == $account->uid) ? t('Me') : t('Them');
}
?>is taken from hook_theme or not?
as to
$account = $variables['account'];
in
<?php
function theme_me_or_them($variables)
{
global $user;
$account = $variables['account'];
return ($user->uid == $account->uid) ? t('Me') : t('Them');
}
?>could someone tell me where '$varibles' comes from and where 'account' come from ?
from time to time, we see hook and HOOK, could someone tell us the difference or meaning?
In system, we see $var and $variables. Could some one tell us the difference or inside meanings?
<?php
return array
(
'my page' => array
(
'#theme' => 'me_or_them',
'#account' => $account,
'#prefix' => '<p>' . t('This page was created by '),
'#suffix' => '</p>'
)
);
?>Could someone tell me the usage of my page as key to the array ?
Thanks