mmckimson Posted September 11, 2009 Share Posted September 11, 2009 I am a PHP novice and have downloaded and installed a rather nifty free PHP application for handling affiliates on my ecommerce site for which the developer offers zero support. Every piece of the code works as I would expect it to, except for the commission-details.php file which is displaying a blank screen instead of the data (that somehow seems to work on the developer's demo website). I have looked at the code and see no obvious errors, but don't really know how to fix this. If someone would be willing to look at the attached zip file and help me unravel the mystery in the commission-details.php code which is located in the root directory, it would be much appreciated. ike [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/173900-solved-need-help-with-code/ Share on other sites More sharing options...
kratsg Posted September 11, 2009 Share Posted September 11, 2009 Let's show obvious errors. At the top of this page, add the following line: error_reporting(E_ALL); And see what errors come up. Usually, undefined functions can cause a page to be blank and not throw an error that gets displayed normally. Quote Link to comment https://forums.phpfreaks.com/topic/173900-solved-need-help-with-code/#findComment-916686 Share on other sites More sharing options...
PFMaBiSmAd Posted September 11, 2009 Share Posted September 11, 2009 If you were to post the commission-details.php file, more people would probably be willing to look into the problem. Quote Link to comment https://forums.phpfreaks.com/topic/173900-solved-need-help-with-code/#findComment-916687 Share on other sites More sharing options...
mmckimson Posted September 11, 2009 Author Share Posted September 11, 2009 OK, I added this suggestion to the top of the code, and the page is still displaying a blank page. Here is the code from the commission-details.php page that is displaying as a blank: error_reporting(E_ALL); $gProtected = TRUE; require_once('header.php'); $com_id = (INT)$_GET['id']; // id commission if(!$com_id) { $items = (int)$_GET['items']; $items = $items ? $items : 5 ; define(ITEMS_PER_PAGE, $items); $page = (int)$_GET['page']; $page = ($page < 1) ? 1 : $page; $start = ($page - 1) * ITEMS_PER_PAGE; $ctype = $_GET['type']; if(!$ctype) $ctype = 'pending'; switch($ctype) { case 'pending': $commissions = $gXpDb->getCommissionsByStatus($aff['id'], 1, $start, ITEMS_PER_PAGE); $total = $gXpDb->getCommissionsByStatus(0); $url = "commission-details.php?type=pending"; break; case 'approved': $commissions = $gXpDb->getCommissionsByStatus($aff['id'], 2, $start, ITEMS_PER_PAGE); $total = $gXpDb->getCommissionsByStatus(2); $url = "commission-details.php?type=approved"; break; //case 'paid': $commissions = $gXpDb->getPaidCommissions(); } $title = $gXpLang['site_title'].' - '.$gXpLang['commission_details']; $navigation = navigation(count($total), $start, count($commissions), $url, ITEMS_PER_PAGE); $gXpSmarty->assign_by_ref('commissions', $commissions); $gXpSmarty->assign_by_ref('navigation', $navigation); $gXpSmarty->assign_by_ref('ctype', $ctype); } elseif($com_id > 0 && is_array($aff) and $aff['id']>0) { $percent = $gXpConfig['payout_percent']/100; $commission = $gXpDb->getCommissionsById($aff['id'], $com_id); $gXpSmarty->assign_by_ref('percent', $percent); $gXpSmarty->assign_by_ref('commission', $commission); } $description = $gXpLang['desc_commission_details']; $keywords = $gXpLang['keyword_commission_details']; $gXpSmarty->assign_by_ref('description', $description); $gXpSmarty->assign_by_ref('keywords', $keywords); $gXpSmarty->assign_by_ref('title', $title); $gXpSmarty->display("commission-details.tpl"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/173900-solved-need-help-with-code/#findComment-916693 Share on other sites More sharing options...
mmckimson Posted September 11, 2009 Author Share Posted September 11, 2009 Here is the related commission-details.tpl file: {include file="header.tpl"} <h2>{$lang.commission_details}</h2> {if $commission.id eq '' && $smarty.get.id eq ''} {if $aff.approved eq 2} <div style="font-size: 13px;"> <ul class="options"> <li>{$lang.commissions}: </li> <li> {if ($ctype!="pending")} <a href="commission-details.php?type=pending" style="font-size: 13px;">{$lang.pending_approval}</a> {else} <b>{$lang.pending_approval}</b> {/if} </li> <li> {if ($ctype!="approved")} <a href="commission-details.php?type=approved" style="font-size: 13px;">{$lang.approved}</a> {else} <b>{$lang.approved}</b> {/if} </li> <!-- <li> {if ($ctype!="paid")} <a href="commission-details.php?type=paid" style="font-size: 13px;">Paid</a> {else} <b>Paid</b> {/if} </li> --> </ul> <div style="clear: both;"></div> <table cellpadding="0" cellspacing="0" style="margin-top: 10px; width: 100%;"> <tr style="font-weight: bold;"> <td>{$lang.sale_date}</td> <td>{$lang.status}</td> <td>{$lang.sale_amount}</td> <td>{$lang.action}</td> </tr> {foreach from=$commissions item=commission} <tr> <td>{$commission.date}</td> <td>{if $commission.approved}{$lang.approved}{else}{$lang.pending}{/if}</td> <td>{$commission.payment}</td> <td><a href="commission-details.php?{if $smarty.get.type}type={$smarty.get.type}&{/if}{if $smarty.get.page}page={$smarty.get.page}&{/if}{if $smarty.get.items}items={$smarty.get.items}&{/if}id={$commission.id}" >{$lang.small_view_details}</a></td> </tr> {/foreach} </table> <br /> {$navigation} </div> {else} <strong>{$lang.msg_account_pending_approval}</strong> {/if} {elseif $commission.id > 0} <a href="commission-details.php?{if $smarty.get.type}type={$smarty.get.type}&{/if}{if $smarty.get.page}page={$smarty.get.page}&{/if}{if $smarty.get.items}items={$smarty.get.items}{/if}">{$lang.return_go_back}</a><br /> <br /> <table border="0" cellspacing="1" cellpadding="0" bgcolor="#CCCCCC" width="100%"> <tr> <td width="150" bgcolor="#FFFFFF" style="padding: 2px 10px;" align="right"><strong>{$lang.sale_date}</strong></td> <td bgcolor="#FFFFFF" style="padding: 2px 10px;">{$commission.date} {$commission.time}</td> </tr> <tr> <td bgcolor="#FFFFFF" style="padding: 2px 10px;" align="right"><strong>{$lang.sale_amount}</strong></td> <td bgcolor="#FFFFFF" style="padding: 2px 10px;">{$commission.payment}</td> </tr> <tr> <td bgcolor="#FFFFFF" style="padding: 2px 10px;" align="right"><strong>{$lang.commissions}</strong></td> <td bgcolor="#FFFFFF" style="padding: 2px 10px;">{$commission.payment*$percent}</td> </tr> <tr> <td bgcolor="#FFFFFF" style="padding: 2px 10px;" align="right"><strong>{$lang.order_number}</strong></td> <td bgcolor="#FFFFFF" style="padding: 2px 10px;">{$commission.order_number}</td> </tr> </table> {elseif $smarty.get.id > 0} <strong style="color: #FF0000">{$lang.msh_incorrect_param}</strong> {/if} {include file="footer.tpl"} With respect to error reporting, is there anything else I need to do? Mike Quote Link to comment https://forums.phpfreaks.com/topic/173900-solved-need-help-with-code/#findComment-916695 Share on other sites More sharing options...
PFMaBiSmAd Posted September 11, 2009 Share Posted September 11, 2009 You actually need to put in both of these lines to make sure that all php errors are reported and displayed - ini_set("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/173900-solved-need-help-with-code/#findComment-916707 Share on other sites More sharing options...
mmckimson Posted September 11, 2009 Author Share Posted September 11, 2009 Yipee. You folks are geniuses... When I inserted the error checking, while there were some immaterial errors shown, the smarty module was unable to read the resource commission-details.tpl. Why? Because the developer had misspelled it comission-details.tpl. As soon as I renamed the file, it worked fine! Thanks so much. Mike Quote Link to comment https://forums.phpfreaks.com/topic/173900-solved-need-help-with-code/#findComment-916723 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.