help with php controller function - php

I'm new to php and I'm trying to understand the basics of how my site is interacting with the database. can someone take a quick look and tell me if they see something wrong with the following code?
Here's the function in the controller
class Spoonful extends C_Controller {
public function index() {
$collectives = $this - > get_mailchimp_collectives();
$this - > data['collectives'] = $collectives;
$this - > load - > view('spoonful');
}
private function get_mailchimp_collectives() {
$constraints['select'] = 'collective.*, member.username, image.path AS avatar';
$constraints['join'] = array(
array('table' = > 'member', 'on' = > 'member.member_id=collective.member_id'), array('table' = > 'collective_tag', 'on' = > 'collective_tag.collective_id=collective.collective_id'), array('table' = > 'tag', 'on' = > 'tag.tag_id=collective_tag.tag_id'), array('table' = > 'image', 'on' = > 'image.image_id=member.avatar_id'));
$constraints['where'] = array('tag.value' = > 'mailchimp');
$constraints['order_by'] = array('collective.added' = > 'DESC');
$constraints['limit'] = array('lower' = > 3);
$collectives = $this - > db - > get('collective', $constraints);
if (!empty($collectives['result_set'])) return $collectives['result_set'];
return NULL;
}
}
and here's the snippet of the view:
<!-- START COLLECTIVES -->
<?php if (!empty($collectives)){?>
<?php foreach ($collectives AS $collective){?>
<tr>
<td bgcolor="#FFFFFF">
<table cellpadding="0" cellspacing="0">
<tr>
<td colspan="9" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/qc_table_top.gif"); ?>" width="566" height="17"></td>
</tr>
<tr>
<td width="1" bgcolor="#D9D9D9" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="1" height="1"></td>
<td width="13" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif");?>" width="13" height="1"></td>
<td width="66" valign="top">
<table cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/avatar_top.gif"); ?>" width="66" height="5"></td>
</tr>
<tr>
<td style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/avatar_right.gif"); ?>" width="5" height="45"></td>
<td style="font-size:0;line-height:0;"><img src="<?php echo $collective['avatar']; ?>" width="46" height="45" border="0"></td>
<td style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/avatar_spike.gif"); ?>" width="15" height="45"></td>
</tr>
<tr>
<td colspan="3" style="font-size;0;line-height:0;"><img src="<?php echo site_url("images/spoonful/avatar_bottom.gif"); ?>" width="66" height="5"></td>
</tr>
</table> </td>
<td width="15" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="15" height="1"></td>
<td width="338" valign="top">
<font style="font-size:15px;line-height:18px;font-weight:bold;" color="#242424" face="Arial, Helvetica, sans-serif"><?php echo $collective['title']; ?></font><br>
<font style="font-size:11px;" color="#A5A5A5" face="Arial, Helvetica, sans-serif">by <a style="text-decoration:none;" href="<?php echo site_url("people/{$collective['username']}"); ?>"><font color="#2294B8"><?php echo $collective['username']; ?></font></a></font> </td>
<td width="30" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="30" height="1"></td>
<td width="81" valign="top">
<table cellpadding="0" cellspacing="0">
<tr>
<td style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/answer.gif"); ?>" width="81" height="27" border="0" alt="ANSWER"></td>
</tr>
<tr>
<td style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="1" height="8"></td>
</tr>
<tr>
<td width="81" align="center" style="text-align:center;"><a style="text-decoration:none;" href="<?php echo site_url("question/{$collective['collective_id']}/{$this->utilities->get_url_title($collective['title'])}");?>"><font style="font-size:11px;" color="#8E8E8E" face="Arial, Helvetica, sans-serif">View Answers</font></a></td>
</tr>
</table> </td>
<td width="21" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif");?>" width="21" height="1"></td>
<td width="1" bgcolor="#D9D9D9" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="1" height="1"></td>
</tr>
<tr>
<td colspan="9" style="font-size:0;line-height:0;"><img src="<?php echo site_url("images/spoonful/qc_table_bottom.gif"); ?>" width="566" height="21"></td>
</tr>
</table> </td>
</tr>
<tr>
<td style="font-size=0;line-height:0;"><img src="<?php echo site_url("images/spoonful/none.gif"); ?>" width="1" height="9"></td>
</tr>
<?php }?>
<?php }?>
but for some reason, i just can't get it to load. if i comment out the lines:
if (!empty($collectives['result_set']))
return $collectives['result_set'];
then the view loads with no data, but when i leave it in, i get a blank page. would love some advice.
thanks so much!

Your two problems that I can see are, first of all the Codeigniter Controller is called CI_Controller not C_Controller (in the version that you're using at least) so:
class Spoonful extends C_Controller {
should be
class Spoonful extends CI_Controller {
Additionally you're not actually passing any data to the view, you do so with the second parameter of the view load function so:
$this - > data['collectives'] = $collectives;
$this - > load - > view('spoonful');
should be
$this - > data['collectives'] = $collectives;
$this - > load - > view('spoonful', $this->data);

Related

Syntax Error on my php script

I am getting this error message when run the code below. Below is the code that is giving me error messages. This is the error message
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\jq\fines\admin\portal.php on line 218
My code:
<body class="easyui-layout">
<div region="north" class="title" border="false" style="height:40px;">
Client Services Admin Portal
</div>
<div region="center" border="false">
<div id="pp" style="position:relative">
<div style="width:30%;">
<div title="Time" style="text-align:center;background:#f3eeaf;height:170px;padding:5px;">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100" height="100">
<param name="movie" value="http://www.respectsoft.com/onlineclock/analog.swf">
<param name=quality value=high>
<param name="wmode" value="transparent">
<embed src="http://www.respectsoft.com/onlineclock/analog.swf" width="100" height="100" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
</object>
</div>
<div title="Current Users Logged On" collapsible="true" closable="false" style="height:250px;padding:3px;">
<center>
<?php require_once "fines/admin/usersloggedon.php"; ?>
</center>
</div>
</div>
<div style="width:70%;">
<div title="Search for receipt" closable="false" style="height:170px;padding:10px;">
<center>
<form action="" method="post" id="receiptnumSearch">
<input type="hidden" name="check" value="submitted">
<input class="easyui-searchbox" style="width:200px" name="receiptnum" data-options="prompt:'',searcher:doReceiptSearch">
</form>
<br/>
<div style="background-color:#3FF; height:1px"> </div><br/>
<?php
require_once"functions.php";
if($_POST['check']=='submitted')//open1
{
//checking for errors
$receiptnum=trim($_POST['receiptnum']);
if($receiptnum=='')//open
{
//System error
echo SysError('Search field empty', 'index.php?t='.urlencode(base64_encode("admin_fins")).'&o='.md5(date('Y-m-d : t')).'');
die();
}//closed
elseif(!empty($receiptnum))//open
{
?><table class='tablestyle2' width=95% cellpadding=2 cellspacing=0>
<tr valign=top>
<td ><table width="100%" border="0" cellspacing="0" cellpadding="0" class='tablestyle_inner'>
<tr>
<td width="40%" class='tableheader' height="25">Paid From Library</td>
<td width="30%" class='tableheader'>Patron Name</td><td width="30%" class='tableheader'>Receipt Number</td>
</tr>
<?php
$db1w = new PDO('mysql:host=10.40.254.229;dbname=koha_msulibrary;charset=utf8', 'root', 'philly');
$gt_r=$db1w->query("SELECT * FROM fine, borrowers,branch_libs where borrowers.cardnumber=fine.cardnumber AND branch_libs.brunchid=fine.brunchid AND fine.receiptNum='$receiptnum' LIMIT 0,1");
$gt_r_results=$gt_r->fetch(PDO::FETCH_ASSOC);
echo'
<tr>
<td class=\'label\' height="25" align="center">'.$gt_r_results['branch_name'].'</td>
<td class=\'label\' align="center">'.ucwords(strtolower($gt_r_results['firstname'].' '.$gt_r_results['surname'])).'</td>
<td class=\'label\' align="center"><a target="_blank" href="http://www.msu.ac.zw/libraries/jq/fines/receipt.php?invoice='.base64_encode('invoce_view').'&t='.base64_encode($gt_r_results['receiptNum']).'">'.$gt_r_results['receiptNum'].'</a></td>
</tr>';
?>
</table></td></tr></table>
<?
}//closed
}//closed
?>
</center>
</div>
<div title="Library Fines Statistics" closable="false" style="height:250px;text-align:center;">
<center>
<br/><form action="" id="date_range" method="post"><table width="70%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="39%"><input type="hidden" name="date_r" value="date_r"><input name="data1" class="easyui-datebox" value="Start Date" width="200px"></input></td>
<td width="37%"><input name="data2" class="easyui-datebox" value="End Date" width="200px"></input></td>
<td width="24%">View Fines</td>
</tr>
</table></form>
<br/>
<?php
$data1=$_POST['data1'];
$data2=$_POST['data2'];
$date_r=$_POST['date_r'];
$dat=date('Y-m-d');
$da_1=strtotime($data1);
$data_=date('Y-m-d',$da_1);
//$da_2=strtotime($data2_);
//$data2=date('Y-m-d',$da_2);
//checking if date is real date
if((!isRealDate($data1) or !isRealDate($data2) or $dat < $data_ ) and $date_r=='date_r')
{
echo SysError('Incorrect date range', 'index.php?t='.urlencode(base64_encode("admin_fins")).'&o='.md5(date('Y-m-d : t')).'');
die();
}
//end of check
else{
?>
<table width=95% height="125" cellpadding=2 cellspacing=0 class='tablestyle2'>
<tr valign=top><td ><table width="100%" height="122" border="0" cellpadding="0" cellspacing="0" class='tablestyle_inner'> <tr> <td width="50%" class='tableheader' height="19">Branch Library</td> <td width="50%" class='tableheader'>
<?php
if($date_r=='date_r')
{
echo 'Fine collected between '.$data1.' and '.$data2;
}
else
{
echo 'Fines Collected to Date';
}
?></td>
</tr>
<tr>
<td class='label' height="12" >Batanai Library</td>
<td class='label' style="padding-left:10px">
<?php //checking if the date is real
if($date_r!='date_r')
{
echo GETbranchlibs('2');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'2');
}
?></td>
</tr>
<tr>
<td class='label' height="6">GSBL</td>
<td class='label' style="padding-left:10px">
<?php
if($date_r!='date_r')
{
echo GETbranchlibs('3');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'3');
}
?></td>
</tr>
<tr>
<td class='label' height="3" >Law Library</td>
<td class='label' style="padding-left:10px"><?php
if($date_r!='date_r')
{
echo GETbranchlibs('4');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'4');
}
?></td>
</tr>
<tr>
<td class='label' height="3" >Main Library</td>
<td class='label' style="padding-left:10px"><?php
if($date_r!='date_r')
{
echo GETbranchlibs('1');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,1);
}
?></td>
</tr>
<tr>
<td class='label' height="2" >Total</td>
<td class='label' style="padding-left:10px; font-weight:bold;"><u><?php
if($date_r!='date_r')
{
echo GETbranchlibs('0');
}
elseif($date_r=='date_r')
{
echo GetBrunchLibsRange($data1,$data2,'0');
}
}
?></u></td>
</tr>
</table></td></tr></table></center>
</div>
</div>
</div>
</div>
You wrote somewhere in there
<? instead of <?php
So just change that and it will work. Tested on http://www.compileonline.com/execute_php_online.php

How to display simple images instead of configurable images when submitting a transactional emails

When I send a transactional email I get both the configurable image and the simple image I only need the simple image
This is the bit of code I am modifying item.phtml
getAllItems() as $_item): ?>getChildItem()) break; else $i++;
?>
<tbody>
<tr <?php echo $i%2?'bgcolor="#FFFFFF"':'' ?>>
<!--PRODUCT Name-->
<td align="left" valign="top" style="padding:3px 9px">- <?php echo $this->htmlEscape($_item->getName()) ?></td>
<!--PRODUCT SKU-->
<td align="left" valign="top" style="font-size:11px; padding:3px 9px;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>
<!--PRODUCT IMAGE-->
<td align="left" valign="top" style="font-size:11px; padding:3px 9px;">
<?php $product = Mage::getModel('catalog/product')
->setStoreId($_item->getOrder()->getStoreId())
->load($_item->getProductId()); ?>
<img src="<?php echo Mage::helper('catalog/image')->init($product, 'image')->resize(75); ?>" width="75" alt="" />
</td>
Anything would help at this point
hello please just change
getAllItems() changes to getAllVisiableItems()
then in item modify code
<td align="left" valign="top" style="padding:3px 9px">- <?php echo $this->htmlEscape($_item->getName()) ?></td>
<!--PRODUCT SKU-->
<td align="left" valign="top" style="font-size:11px; padding:3px 9px;"><?php echo $this->htmlEscape($this->getSku($_item)) ?></td>
<!--PRODUCT IMAGE-->
<td align="left" valign="top" style="font-size:11px; padding:3px 9px;">
<?php
$sku=$item->getSku();
$productid = Mage::getModel('catalog/product')
->getIdBySku(trim($sku));
// Initiate product model
$childproduct = Mage::getModel('catalog/product')->setStoreId($_item->getOrder()->getStoreId());
// Load specific product whose tier price want to update
$childproduct ->load($productid);
<img src="<?php echo Mage::helper('catalog/image')->init($childproduct , 'image')->resize(75); ?>" width="75" alt="" />
</td>

Show sub-data in each data with php

I'm trying to solv this issue. I have this php code.
<?php
if (count($Modulos)>0){
for ($x=0; $x<count($Modulos); $x++){
// SOME CODE, to define variables
$controller = 1;
require_once "../controller/moduloController.php";
for ($z=0; $z<count($ActividadesMOD); $z++){
echo $ActividadesMOD[$z]['actividad']. "<br/>";
}
?>
<tr height="35">
<td align="center"> <strong><?php echo $modulo;?> </strong></td>
<td align="center"> <?php echo $encargado[0];?> </td>
<td align="center" valign="middle"> <?php echo $deadline;?>
<a href="javascript:VerDeadline(<?php echo $idmodulo;?>, '4','<?php echo $deadline;?>', '<?php echo $modulo;?>', '<?php echo $finalizado;?>')" onClick="">
<img src="../img/zoom-icon.png" width="17" height="17" align="absbottom">
</a>
</td>
<td align="center"> <strong> <?php echo $avance . " %";?></strong></td>
<td align="center"> <img src="<?php echo $img;?>" width="28" height="15" title="<?php echo $ttl;?>" /> </td>
<td width="7%" align="center"> </td>
</tr>
<?php }
} else { ?>
<tr height="30" style="font-size:11px" >
<td align="center" colspan="5"> [ NO HAY REGISTROS ] </td>
</tr>
<?php } ?>
Result:
Now, each MODULO has ACTIVIDADES (activities) that i need to show below it.
In the image above, it displays the ACTIVITIES from the MODULO 1 and not the other ones.
Taking the example from other page, should be like this:
I got it !!
Changing the require_once for include.
The result with some css:
Greetings.

Displaying received data from a SQL Database in a list item

Old ASP developer migrating to PHP. I writ a PHP script to retrieve entries from an MS SQL Database and display. Looks like this:
<?php
$query = "SELECT DateUploaded, Title ";
$query .= "FROM TableName ";
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["DateUploaded"] . $row["Title"] . "</li>";
}
?>
Now when I want to get it to display echoing it just on the page works fine. Using this section of code:
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["DateUploaded"] . $row["Title"] . "</li>";
}
However when I try and put it into a table Ive created to display it it doesn't seem to work, although I've read a few tutorials and feel it should, it is also similar to a technique I used to use in ASP.
Looks like this:
<TABLE cellSpacing=1 cellPadding=2 align=center bgColor=#aaaaaa border=0 width="100%" class="logintbl">
<TR>
<TD bgColor=whitesmoke colSpan=0><B>News</B></td>
</tr>
<tr>
<td bgColor=#ffffff>
<table align="center" cellSpacing=0 cellPadding=2 border="0" width="100%">
<tr>
<td align="center" valign="bottom"> <font color="#4d71a1"><b>Date Uploaded</b></font> </td>
<td align="center" valign="bottom"> <font color="#4d71a1"><b>News Title</b></font> </td>
<td align="center"></td>
</tr>
<tr bgcolor="#eeeeee">
<tr bgcolor="#ffffff">
<td align="center"><?php echo $row["DateUploaded"]; ?></td>
<td align="center"><?php echo $row["Title"]; ?></td>
<td align="center">
<img src="images/0013-pen.gif" width="16" height="16" alt="" border="0">
<a href="NewsManage.php?do=del&id=" return false;">
<img src="images/1001-cancel16.gif" width="16" height="16" alt="" border="0">
</a>
</td>
</tr>
<tr><td colspan="7"> </td></tr>
<tr>
<td colspan="7" align="center">
</td>
</tr>
</table>
</td>
</tr>
</table>
I'm probably doing it totally wrong, but could someone point me in the right direction please?
Put the row into echo inside your loop:
<?php
while($row = mssql_fetch_array($result))
{
echo '<tr bgcolor="#ffffff">
<td align="center">'.$row["DateUploaded"].'</td>
<td align="center">'.$row["Title"].'</td>
<td align="center">
<img src="images/0013-pen.gif" width="16" height="16" alt="" border="0">
<img src="images/1001-cancel16.gif" width="16" height="16" alt="" border="0">
</td>
</tr>';
}
?>
Start the while loop right before the row with the data,
and end it right after that.
<table align="center" cellSpacing=0 cellPadding=2 border="0" width="100%">
<!-- header row here -->
<?php
$alterColor = true;
while ($row = mssql_fetch_array($result)) { // start while
// alternating bg color for rows
$color = ($alterColor) ? "#fff" : "#eee";
$alterColor = !$alterColor;
?>
<tr bgcolor="<?php echo $color; ?>">
<td align="center"><?php echo $row["DateUploaded"]; ?></td>
<td align="center"><?php echo $row["Title"]; ?></td>
<td align="center">
<img src="images/0013-pen.gif" width="16" height="16" alt="" border="0">
<a href="NewsManage.php?do=del&id=" return false;">
<img src="images/1001-cancel16.gif" width="16" height="16" alt="" border="0">
</a>
</td>
</tr>
<?php } // end while ?>
</table>
PS One of these seems to be extra, are they there for alternating color or something like that:
<tr bgcolor="#eeeeee">
<tr bgcolor="#ffffff">
You should not really have a tr within a tr directly.

codeigniter view are not loading in constructor with parameter

I am trying to load a view from constructor with parameter $data. Earlier it was working fine and now suddenly it stopped working. Below is the code:
permissionerror View
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="6" align="left" valign="top" background="<?php echo base_url();?>images/bg/topbg.gif"><img src="<?php echo base_url();?>images/bg/top-left.gif" width="5" height="34" /></td>
<td height="34" align="left" valign="middle" background="<?php echo base_url();?>images/bg/topbg.gif" class="heading">Access Forbidden</td>
<td width="6" align="right" valign="top" background="<?php echo base_url();?>images/bg/topbg.gif"><img src="<?php echo base_url();?>images/bg/top-right.gif" width="5" height="34" /></td>
</tr>
<tr>
<td align="left" valign="top" background="<?php echo base_url();?>images/bg/main-content-bg-left.gif"> </td>
<td height="165" valign="top" bgcolor="#FFFFFF" class="leftredheading"><div style="margin:30px auto;padding-left:15px"><? if(isset($sn_error)) echo $sn_error;?></div></td>
<td align="right" valign="top" background="<?php echo base_url();?>images/bg/main-content-bg-right.gif"> </td>
</tr>
<tr>
<td align="left" valign="bottom" background="<?php echo base_url();?>images/bg/bottom-bg.gif"><img src="<?php echo base_url();?>images/bg/bottom-left-corner.gif" width="5" height="5" /></td>
<td valign="top" background="<?php echo base_url();?>images/bg/bottom-bg.gif"></td>
<td align="right" valign="bottom" background="<?php echo base_url();?>images/bg/bottom-bg.gif"><img src="<?php echo base_url();?>images/bg/bottom-right-corner.gif" width="5" height="5" /></td>
</tr>
</table>
Template code:
<?php $this->load->view('includes/login/header'); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#e7e7de">
<tr>
<td width="18"><img src="<?php echo base_url();?>images/bg/zero.gif" width="18" height="1" /></td>
<td width="191"><img src="<?php echo base_url();?>images/bg/zero.gif" width="191" height="1" /></td>
<td width="18"><img src="<?php echo base_url();?>images/bg/zero.gif" width="18" height="1" /></td>
<td width="100%"> </td>
<td width="161"><img src="<?php echo base_url();?>images/bg/zero.gif" width="18" height="1" /></td>
<td width="191"><img src="<?php echo base_url();?>images/bg/zero.gif" width="191" height="1" /></td>
<td width="18"><img src="<?php echo base_url();?>images/bg/zero.gif" width="18" height="1" /></td>
</tr>
<tr>
<td> </td>
<td align="left" valign="top"><table width="191" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="<?php echo base_url();?>images/bg/left-menu-white-bg.gif"> <?php $this->load->view('includes/login/top_right'); ?> </td>
</tr>
<tr>
<td height="50" background="<?php echo base_url();?>images/bg/left-menu-white-bg.gif"> </td>
</tr>
<tr>
<td background="<?php echo base_url();?>images/bg/left-menu-white-bg.gif"><table width="166" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top"><img src="<?php echo base_url();?>images/bg/needhelp-top.gif" width="166" height="7" /></td>
</tr>
<tr>
<td align="center" valign="top" bgcolor="#F8F7EC"> <?php $this->load->view('includes/login/bottom_right'); ?>
<br /></td>
</tr>
<tr>
<td align="left" valign="top" bgcolor="#F8F7EC"><img src="<?php echo base_url();?>images/bg/needhelp-bottom.gif" width="166" height="7" /></td>
</tr>
</table>
<br /></td>
</tr>
<tr>
<td background="<?php echo base_url();?>images/bg/left-menu-white-bg.gif"><table width="191" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6" align="left" valign="top"><img src="<?php echo base_url();?>images/bg/left-bttom.gif" width="6" height="6" /></td>
<td width="100%" background="<?php echo base_url();?>images/bg/leftbottom.gif"></td>
<td height="6" align="right" valign="top"><img src="<?php echo base_url();?>images/bg/right-bttom.gif" width="6" height="6" /></td>
</tr>
</table></td>
</tr>
</table>
<br /></td><td> </td>
<td valign="top" <? if($main_content != 'dashboard' || $main_content == 'publisher_dashboard') { ?> colspan="3" <? } ?>><?php $this->load->view($main_content); ?></td>
<td> </td>
<? if($main_content == 'dashboard' || $main_content == 'publisher_dashboard') { ?>
<td align="right" valign="top"> <?php $this->load->view('includes/login/left'); ?>
</td>
<? } ?>
<td> </td>
</tr>
</table>
<?php $this->load->view('includes/login/footer'); ?>
Here in the above code i am checking whether logged in user is having permission for access then do else part otherwise through the error from if case block.
In IF case it loads the error template.
Please somebody help me to fix the above issue ASAP!
Call parent::__construct(), not parent::Controller().
Edit:
After it was made clear that CodeIgniter 1.7.1 is used and after the view itself was shown, this is your issue:
Your view tries to echo $error instead of $sn_error. If you don't pass $data to the view, then $sn_error (which is checked for) isn't set and that error doesn't occur - that's why the view gets loaded in that case.

Categories