.tpl file and curly brackets
Moderator: General Moderators
.tpl file and curly brackets
This a two-part question that I am not sure if they are related.
1. Is .tpl file extension is a part of php syntax parsing like .php
2. What are other uses of curly brackets besides statement grouping?
1. Is .tpl file extension is a part of php syntax parsing like .php
2. What are other uses of curly brackets besides statement grouping?
Man! You are quick. Thanks.
I could not find any reference to it. Help!!!
So, in general, the curly brackets force the variable within them evaluated (in a string)? How about return of a function?Oren wrote:Put {$my_var} wherever you wish within the URL.Code: Select all
$file=file_get_contents("http://www.go{$my_var}ogle.com/search?&q=n93+amazon.com&btnI");
I could not find any reference to it. Help!!!
Well... no, not exactly.ngungo wrote:So, in general, the curly brackets force the variable within them evaluated (in a string)?
For instance, this is valid:
Code: Select all
$my_str = 'some other text.';
echo "some text, $my_str"; // prints: some text, some other text.Code: Select all
$my_str = 'some other text.';
$my_str2 = 'another string';
echo "some text, $my_str2"; // prints: some text, another stringFor that you will have to do:
Code: Select all
$my_str = 'some other text.';
$my_str2 = 'another string';
echo "some text, {$my_str}2"; // prints: some text, some other text.2Edit: For more information about this see: Variable parsing (read the whole page if you need to)
If you have a .tpl file and its got a bunch of {$var} stuff in it, then its probably a smarty template.
http://smarty.php.net
http://smarty.php.net
Or phpBB, or... who knowsBegby wrote:If you have a .tpl file and its got a bunch of {$var} stuff in it, then its probably a smarty template.
http://smarty.php.net
-
Adrianc333
- Forum Newbie
- Posts: 14
- Joined: Sat Feb 17, 2007 5:44 am
- Location: South Yorkshire, UK
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
it is very useful. you can create 15 different looking sites that all run on the same 'engine'. by using the {} you can have php inject variable values into the template so that when a user visits the site, they will see something dynamically loaded on the page regardless of which 'look and feel' they're accessing.ngungo wrote:Please correct me! I don't see practical use of this feature nor is clever.
