Imad Posted May 8, 2008 Share Posted May 8, 2008 Hi guys, some scripts out their have something like this: $something = 'something'; Then call it in another file as {$something} How does this work, does anyone know? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/ Share on other sites More sharing options...
BlueSkyIS Posted May 8, 2008 Share Posted May 8, 2008 do you have an example? Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/#findComment-536260 Share on other sites More sharing options...
wildteen88 Posted May 8, 2008 Share Posted May 8, 2008 Unless the page you are wanting to use the variable is included in the file that the variable was defined in then you do this: $myvar = 'some value'; include 'some_file.php'; <?php echo $myvar; ?> If its not then either set a cookie or use sessions. Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/#findComment-536261 Share on other sites More sharing options...
benphp Posted May 8, 2008 Share Posted May 8, 2008 More information needed. Code? Better explanation? Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/#findComment-536264 Share on other sites More sharing options...
Imad Posted May 8, 2008 Author Share Posted May 8, 2008 Head over to mybboard.net, if you use the software you'll notice that their template system uses these {$something} to call variables and or arrays from php files. Here's a sample from the template system: {$lang->copyright} © 2002-{$copy_year} <strong><a href="http://www.mybboard.com" target="_blank">MyBB Group</a></strong> <!-- End copyright --> <br> {$lang->copyright} © 2006-{$copy_year} Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/#findComment-536267 Share on other sites More sharing options...
wildteen88 Posted May 8, 2008 Share Posted May 8, 2008 I am familiar with mybb. myBB uses eval() to parse the variables from the templates stored in the database. The variables are defined from the mybb core system and other places such as the mybb settings file/table. Thier template system is rather complex. Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/#findComment-536273 Share on other sites More sharing options...
DarkWater Posted May 8, 2008 Share Posted May 8, 2008 Check out Smarty if you like. It's a similar templating system that actually works quite well. I use it sometimes, and it's very quick and rich in features. Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/#findComment-536274 Share on other sites More sharing options...
Imad Posted May 8, 2008 Author Share Posted May 8, 2008 Thanks for your input guys. Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/#findComment-536284 Share on other sites More sharing options...
DarkWater Posted May 8, 2008 Share Posted May 8, 2008 No problem. Quote Link to comment https://forums.phpfreaks.com/topic/104758-vairables-help/#findComment-536287 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.