⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

php errors when calling grocery crud functions



ivanebalan
  • profile picture
  • Member

Posted 09 April 2012 - 14:51 PM

im getting these errors during testing examples given:


[b] A PHP Error was encountered[/b]

Severity: Warning
Message: include(assets/grocery_crud/languages/english.php): failed to open stream: Permission denied
Filename: libraries/grocery_crud.php
Line Number: 2734

[b] A PHP Error was encountered[/b]

Severity: Warning
Message: include(): Failed opening 'assets/grocery_crud/languages/english.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')
Filename: libraries/grocery_crud.php
Line Number: 2734

[b] A PHP Error was encountered[/b]

Severity: Notice
Message: Undefined variable: lang
Filename: libraries/grocery_crud.php
Line Number: 2736

[b] A PHP Error was encountered[/b]

Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: libraries/grocery_crud.php
Line Number: 2736

[b] A PHP Error was encountered[/b]

Severity: Warning
Message: include(assets/grocery_crud/themes/flexigrid/config.php): failed to open stream: Permission denied
Filename: libraries/grocery_crud.php
Line Number: 1950

[b] A PHP Error was encountered[/b]

Severity: Warning
Message: include(): Failed opening 'assets/grocery_crud/themes/flexigrid/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')
Filename: libraries/grocery_crud.php
Line Number: 1950

[b] A PHP Error was encountered[/b]

Severity: Notice
Message: Undefined variable: config
Filename: libraries/grocery_crud.php
Line Number: 1952

What could be wrong? I copied all the files to my codeigniter folder as provided in the instructions. I am using Ubuntu 11.10.

Thanks in advance.

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 09 April 2012 - 19:18 PM

[font=arial, sans-serif][size=3]Probably you don't have permissions as the messages simply say. If it is at your local machine just a chmod 777 I believe that would do the job. For example: [/size][/font]

[font=arial, sans-serif][size=3]
sudo chmod -R 777 /var/www/your_project
[/size][/font]
[font=arial, sans-serif][size=3]I say 777 because it will work for sure and it is a quick way to do your job. [/size][/font]
[font=arial, sans-serif][size=3]However at the production server machine of course DON'T EVEN THINK to use this command as it is really dangerous for your online project. At the production server with a simply ftp upload it will work as normal without any change so don't worry about this.[/size][/font]

ivanebalan
  • profile picture
  • Member

Posted 10 April 2012 - 00:26 AM

I tried your advice and it was great! All is well now!

I will be using my CRUD applications as stand-alone applications but still I will consider your advice on security.

Thank you very much and more power!

Cheers! :)

duangsin.k
  • profile picture
  • Member

Posted 25 May 2012 - 08:17 AM

[color=#000000]sudo chmod [/color][color=#666600]-[/color][color=#000000]R [/color][color=#006666]777[/color][color=#000000] [/color][color=#666600]/[/color][color=#000088]var[/color][color=#666600]/[/color][color=#000000]www[/color][color=#666600]/[/color][color=#000000]your_project[/color]

[color="#000000"]or chmod by filezillar ftp , right click change permission 0777[/color]


[color="#000000"]thank[/color]

kesing
  • profile picture
  • Member

Posted 20 July 2012 - 12:14 PM

Hi, I'm having kind of the same problems, but are not for permissions. I've cheked the folder structure and it's like the one mentioned in the Insatallation page (just few differences, like database.php instead of datatables.php that I think is because the versions are changing a bit the names...). This is what I get:





[b] A PHP Error was encountered[/b]

Severity: Notice
Message: Undefined variable: css_files
Filename: views/admin_view.php
Line Number: 137

[b] A PHP Error was encountered[/b]

Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: views/admin_view.php
Line Number: 137

[b] A PHP Error was encountered[/b]

Severity: Notice
Message: Undefined variable: js_files
Filename: views/admin_view.php
Line Number: 140

[b] A PHP Error was encountered[/b]

Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: views/admin_view.php
Line Number: 140


[b] A PHP Error was encountered[/b]

Severity: Notice
Message: Undefined variable: output
Filename: views/admin_view.php
Line Number: 145

I hope you know what is the problem...

Thanks guys!

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 22 July 2012 - 10:14 AM

You forgot to add your $output variable to your view. For example you have to do it like this:


....
$output = $crud->render();

$this->load->view('admin_view.php', $output);

kesing
  • profile picture
  • Member

Posted 23 July 2012 - 15:33 PM

mmm well, I do the following:


...

$output = $crud->render();
$this->_example_output($output);
...
}


public function _example_output($output = null)
{
$this->load->view('cabecera_html_view');
$this->load->view('cabeceraadmin');
$this->load->view('admin_view',$output);
$this->load->view('pie_html_view');
}



So, it should be something else... :(

P.S.: nice job!

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 23 July 2012 - 20:05 PM

Can you post your admin_view to check what is wrong? This is really weird

kesing
  • profile picture
  • Member

Posted 24 July 2012 - 07:09 AM

well, first of all I should say that the errors appear just for one second, after that the page is loaded perfectly. But when I go out without log out and I want to go back again... in that case I have to change the cookie... :s

here is the code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Admin page</title>
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
background-color: #fff;
margin: 40px;
font: 13px/20px normal Helvetica, Arial, sans-serif;
color: #4F5155;
}
a {
color: #003399;
background-color: transparent;
font-weight: normal;
}
h1 {
color: #444;
background-color: transparent;
border-bottom: 1px solid #D0D0D0;
font-size: 20px;
font-weight: normal;
margin: 0 0 14px 0;
padding: 14px 15px 10px 15px;
}
code {
font-family: Consolas, Monaco, Courier New, Courier, monospace;
font-size: 14px;
background-color: #f9f9f9;
border: 1px solid #D0D0D0;
color: #002166;
display: block;
margin: 14px 0 14px 0;
padding: 12px 10px 12px 10px;
}
#body{
margin: 0 15px 0 15px;
font-size: 14px;
}
p.footer{
text-align: right;
font-size: 11px;
border-top: 1px solid #D0D0D0;
line-height: 32px;
padding: 0 10px 0 10px;
margin: 20px 0 0 0;
}
#container{
margin: 10px;
border: 1px solid #D0D0D0;
-webkit-box-shadow: 0 0 8px #D0D0D0;
background-color:#FBFFFB;
}
.error {
color: red;
}
table {
background-color: #FFFFFF;
border: none;
color: #495E49;
font-family: arial, helvetica, sans-serif;
text-align: center;
}
table a:link, table a:visited, table a:active {
background-color: transparent;
color: #0096BD;
text-decoration: none;
}
table a:hover {
background: transparent;
color: #000000;
text-decoration: underline;
}
table caption {
background-color: transparent;
color: #67BD2A;
font-family: Georgia, serif;
font-size: 24px;
padding-bottom: 12px;
padding-left: 8px;
text-align: left;
}
table, td, th {
margin: 0;
padding: 0;
}
tbody td, tbody th {
background-color: #D6F2C3;
border-bottom: 2px solid #B3DE94;
border-top: 3px solid #FFFFFF;
padding: 9px;
}
tbody tr.odd th, tbody tr.odd td {
background-color: #C8EDAE;
border-bottom: 2px solid #67BD2A;
}
tbody tr:hover td, tbody tr:hover th {
background-color: #BAE899;
}
td, th {
vertical-align: middle;
}
tfoot td, tfoot th {
font-weight: bold;
padding: 4px 8px 6px 9px;
}
thead th {
font-family: arial, helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
line-height: 19px;
padding: 0 8px 2px 8px;
white-space: nowrap;
}
</style>
</head>
<body>
<h1>
<div id="container">
<h1>Results</h1>
<div id="body">
<?php //if ($this->session->userdata('logIn'))
foreach($css_files as $file): ?>
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php foreach($js_files as $file): ?>
<script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>
<div>
<?php if ($this->session->userdata('logIn'))
echo $output; ?>
</div>
<span class="error">
<?php
if (!$this->session->userdata('logIn'))
echo 'You are not logged in. Please log in';
?>
</span> </p>
<p>&nbsp;</p>
</div>
</div>
</h1>
</body>
</html>

bigkingchile
  • profile picture
  • Member

Posted 22 September 2016 - 17:22 PM

I have same error... 

 

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: output

Filename: views/admin.php

Line Number: 12

Backtrace:

File: C:\xampp\htdocs\ci_auth-master\application\views\admin.php
Line: 12
Function: _error_handler

File: C:\xampp\htdocs\ci_auth-master\application\controllers\Admin.php
Line: 69
Function: view

File: C:\xampp\htdocs\ci_auth-master\index.php
Line: 292
Function: require_once

-------

My View is: