Hi All
I have just received the source code for our site from our previous developer who we are no longer in contact with. How do you know that the site is using Smarty? My background is in Coldfusion so I am new to PHP.
The previous developer told us that the site was created using the SMARTY framework but now works as plain PHP.
I would appreciate it if a PHP/Smarty expert can explain the code below on what is is actually doing. For example it mentions a index.tpl.htm what is a tpl.htm file?
Thanks very much in advance
-------------this is the index.php page ---------
<?php
include_once "local.cfg.php";
include_once INCLUDE_DIR."common.inc.php";
$userid = user_getCurrentUserID();
$f_search = g_getVar("f_search",false,"g");
$region = false;
if($userid > 0)
{
$user = user_get($userid);
$region = $user["Region"];
}
if($f_search["region"] && $f_search["region"] > 0 && (($f_search["region"] == 10)||($f_search["region"] == 20)||($f_search["region"] == 30)||($f_search["region"] == 40)||($f_search["region"] == 50)||($f_search["region"] == 60)||($f_search["region"] == 70)||($f_search["region"] == 80)||($f_search["region"] == 90)||($f_search["region"] == 100)||($f_search["region"] == 110)||($f_search["region"] == 120)))
{
$region = $f_search["region"];
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('region', $region, $inTwoMonths);
}
elseif($f_search["region"] == "all")
{
$region = false;
}
$smarty->assign("userregion",$region);
$cuisine = restaurant_cuisine();
$ambience = restaurant_ambience_list();
$regionOption = restaurant_htmlRegionOptions($region);
$city = restaurant_getCity();
$most = restaurant_mostPopular($region);
$latestReviews = restaurant_review_getLatest_region($region);
$latestReviewsCount = restaurant_reviewCountAll($region,true);
$reviewsCount = restaurant_reviewCountAll($region,false);
$latest = restaurant_latest($region,10);
$featured = restaurant_featured($region,5);
// if(!$latest)
// {
// $latest = restaurant_latest(false,10);
// }
$closing = auction_closingAndNewly(true,$region);
$newly = auction_closingAndNewly(false,$region);
$smarty->assign("page","home");
$smarty->assign("newly",$newly);
$smarty->assign("closing",$closing);
$smarty->assign("latest",$latest);
$smarty->assign("featured",$featured);
$smarty->assign("latestReviews",$latestReviews);
$smarty->assign("latestReviewsCount",$latestReviewsCount);
$smarty->assign("reviewsCount",$reviewsCount);
$smarty->assign("most",$most);
$smarty->assign("cuisine",$cuisine);
$smarty->assign("ambience",$ambience);
$smarty->assign("region",$regionOption);
$smarty->assign("city",$city);
$smarty->assign("userid",$userid);
$smarty->display("index.tpl.htm");
?>
---------------------end snippet-------------------