⚠ 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

i have a problem making grocery crud at the homepage



Abdalla Mohamed

Abdalla Mohamed
  • profile picture
  • Member

Posted 07 September 2012 - 22:17 PM

hello johnny,
i'm trying to use grocery crud as an adamin area to handle deleting and editing files so i want to make the grocery crud the default controller
i call the controler file "main"
and the view file "file.php"
i justed followed your tutorial
so i edited the routes.php as the following
$route['default_controller'] = "main.php";
when i load the homepage i get the following errors




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

Severity: Notice
Message: Undefined variable: css_files
Filename: views/file.php
Line Number: 10

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

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

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

Severity: Notice
Message: Undefined variable: js_files
Filename: views/file.php
Line Number: 14

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

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




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

Severity: Notice
Message: Undefined variable: output
Filename: views/file.php
Line Number: 51


best regards,
Abdalla

victor

victor
  • profile picture
  • Member

Posted 07 September 2012 - 23:47 PM

Hi! Write your code.
If you are at the homepage do not use the library, you must remove the code
<?php
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; ?>


that is, you have to use a different template for the homepage.
Helped you?

Abdalla Mohamed

Abdalla Mohamed
  • profile picture
  • Member

Posted 08 September 2012 - 01:18 AM

thank you victor
i did what you said but i got a blank page nothing on it
i think there's away to change the templete path

bthiban

bthiban
  • profile picture
  • Member

Posted 09 September 2012 - 14:51 PM

Yes, Just follow up this instructions and create templates like header, body, footer, left/right.

http://maestric.com/doc/php/codeigniter_template

fredconv

fredconv
  • profile picture
  • Member

Posted 10 September 2012 - 08:42 AM

Hi

i wonder if this will help you.
in my project i ve put in my header:

<?php if (isset($home_page) && $home_page !== TRUE):?>
<?php
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; ?>
<?php endif;?>


in my MY_Controller in the construct function:

function __construct()
{
parent::__construct();
// Load shared resources here or in autoload.php
$this->load->vars(array(
'home_page' => FALSE
));
}


and in the index function of the home page (where there is no crud grid displayed:):

$this->load->vars(array(
'home_page' => TRUE
));


so whenever there are no crud grid, i jsut set the value to true.. (maybe i should call it home_page :D

Hope this will help you .

DRKgatsby

DRKgatsby
  • profile picture
  • Member

Posted 16 October 2012 - 17:40 PM

@Afredconv

the problem is that if you don't have the header code for grocery crud then the table will not be in its normal view, there will just be words from the database on the screen

DRKgatsby

DRKgatsby
  • profile picture
  • Member

Posted 16 October 2012 - 17:41 PM

is there a way to get rid of the num error without removing the header code?

im trying to put a crud table on my homepage but i keep gettting this error


[color=#000000] A PHP [/color][color=#660066]Error[/color][color=#000000] was encountered[/color][color=#008800]

Severity: Notice
Message: Undefined variable: num
Filename: libraries/[/color][color=#000000]grocery_crud[/color][color=#666600].[/color][color=#000000]php
[/color][color=#660066]Line[/color][color=#000000] [/color][color=#660066]Number[/color][color=#666600]:[/color][color=#000000] [/color][color="#006666"] 1878[/color]