mdjl Posted May 6, 2010 Share Posted May 6, 2010 Good day all, Being new to both Smarty and WHMCS, i wondered if someone could point me in the right direction as to implimenting a php script into Smarty? I have added new tables to my WHMCS DB, I did this as the amount of info stored within the tblproducts table is not enough for the info I want to show. Lots of things on the back of this, like updating via admin, but I'm sure this will come as I learn more, anyway. I have this php script working fine, by generating a new root file package_info.php, then created a new template file package_info.tpl. <?php global $pid; if (isset($pid) && ($pid > 0)) { ?> <table class="tbl_compare" border="0" cellspacing="0" width="100%"> <?php $email_query = mysql_query("SELECT tblpackage_extra_fields.package_extra_fields_name AS name, tblpackages_to_package_extra_fields.package_extra_fields_value AS value, tblpackage_extra_fields.package_extra_fields_group AS `group` FROM tblpackage_extra_fields INNER JOIN tblpackages_to_package_extra_fields ON tblpackage_extra_fields.package_extra_fields_id = tblpackages_to_package_extra_fields.package_extra_fields_id WHERE tblpackage_extra_fields.package_extra_fields_group = 'Email' AND tblpackage_extra_fields.languages_id = 1 AND tblpackages_to_package_extra_fields.package_id = '" . (int)$pid . "' ORDER BY tblpackage_extra_fields.package_extra_fields_id, 'group'"); ?> <tr> <td colspan="4" align="left" bgcolor="#2FCBFF" height="33" style="border: 1px solid #E9E9E9; padding: 1px"> <strong><font face="Arial" color="#FFFFFF" size="4">Email</font></strong></td> </tr> <?php while ($email_fields = mysql_fetch_array($email_query)) { $rows++; if (($rows/2) == floor($rows/2)) { $class_type = '#f0f0f0'; } else { $class_type = '#ffffff'; } if ($email_fields['value'] == 'TRUE') { $email_fields['value'] = '<img border="0" src="templates/portal/images/tick_sml_green.gif" alt="" />'; }elseif ($email_fields['value'] == 'FALSE'){ $email_fields['value'] = '<img border="0" src="templates/portal/images/cross_sml_rd.gif" alt="" />'; } echo ' <tr> <th class="infoListingEven" height="27" align="left" bgcolor="' . $class_type . '"> <span style="font-weight: 400"> <font size="2" face="Arial" color="#595959">' . $email_fields['name'] . '</font></span> </th> <td align="center" style="border: 1px solid #E9E9E9; padding: 1px"> <font size="2" color="#595959">' . $email_fields['value'] . '</font></td> </tr>'; } ?> </table> the $pid is passed via the url from the homepage, example is http://www.mdjl.co.uk/client_zone/index.php if you click on the "more Info" link on the Linux Starter or Business packages it will take you to the Package Info page. So you can see it works fine, what I would like to do is make it more Smarty/WHMCS friendly. Also, how would I get the Current Currency Variable and Language Variable. Any Input, comments, Help would be much appreciated. 0 Quote Link to comment 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.