3

I am working on a program with a Smarty template, where do the $variables come from as I see no file they are pulling from in the html. Where do I find these variables so I can edit them. Similarly in Drupal, there are different variables available in different TPL files, because I see no includes, where is this information coming from/being pulled from, I know this is a noob question.

1
  • I think you should consult the smarty documentation first, how smarty works is explained very well there. Commented May 31, 2011 at 17:27

3 Answers 3

1

Smarty variables are set in the business logic via $smarty->assign('firstName', 'Mike');

http://www.smarty.net/docsv2/en/api.assign

You can check out the Smarty.class.php source to find out where they are actually stored (they're in a member variable named $tpl_vars).

Sign up to request clarification or add additional context in comments.

Comments

0

The variables are defined in the PHP script files that use the templates. Look for lines like

$smarty->assign( "var_name", $value );

Comments

0

The variables are set in the PHP files that instantiate the Smarty object. You can find them by searching for the assign() calls. Since Smarty template do not (should not) contain PHP code in them, you won't see include calls.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.