⚠ 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

Add Record, Edit andn Delete pointing to a wrong base_url



yemane
  • profile picture
  • Member

Posted 14 May 2013 - 15:12 PM

Hello,

 

Thanks for great tool. I was able to load using the instruction for the newbie and everything works.

The table loaded fine and I can see all my data. But when I click the "Add Record" or "Edit/Delete" it takes a wrong urL

 

I load my project using  "http://myhostname/mygrocerycrudrootdir/index.php/main/customer "

 

and it loads fine including the site_url works fine but when I click on the "Add Record"  it goes to 

"http://myhostname/mygrocerycrudrootdir/main/customer/add"

 

it is missing the index.php in the url.

 

 

 

my base_url is set to "http://myhostname/mygrocerycrudrootdir/"

 

and my site_url is set in the template to '/main/customer'

 

 

Thanks,

Yemane


davidoster
  • profile picture
  • Member

Posted 14 May 2013 - 17:21 PM

Try this,

under application\config open the config.php file and make these two values like this:

 

$config['base_url'] = '';

 

$config['index_page'] = 'index.php';

yemane
  • profile picture
  • Member

Posted 14 May 2013 - 17:36 PM

Hello David,

 

Thanks for the quick reply.

 

I am getting the same thing.. I cleared my cache, cookies just in case and tryed it using your suggestion...but still missing the index.php on the url path for the add,edit and delete

 

Thanks.


davidoster
  • profile picture
  • Member

Posted 14 May 2013 - 17:41 PM

Then you need to post here your controller and the view file.


yemane
  • profile picture
  • Member

Posted 14 May 2013 - 17:47 PM

ok thanks..

 

Here is my controller.

 

 

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Main extends CI_Controller {
 
    function __construct()
    {
        parent::__construct();
 
        $this->load->database();
        $this->load->helper();
$this->load->library('grocery_CRUD');
 
    }
 
    public function customerdata()
    {
        $this->grocery_crud->set_table('customerdata');
        $output = $this->grocery_crud->render();
 
  /* echo "<pre>";
        print_r($output);
        echo "</pre>";
        die();
        */
$this->_example_output($output);
    }
 
    function _example_output($output = null)
 
    {
        $this->load->view('our_template.php',$output);
    }
  
}
/* End of file main.php */
/* Location: ./application/controllers/main.php */

 

 

 

 

And here is my View:

 

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
 
<?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; ?>
 
<style type='text/css'>
body
{
    font-family: Arial;
    font-size: 14px;
}
a {
    color: blue;
    text-decoration: none;
    font-size: 14px;
}
a:hover
{
    text-decoration: underline;
}
</style>
</head>
<body>
    <div style='height:20px;'></div>  
    <div>
        <?php echo $output; ?>
 
    </div>
</body>
</html>

 

/* end of our_template.php */

 

 

Using firebug in firefox..i see the below for "Add Record"

<a class="add-anchor" title="Add Recordhref="http://localhost/CI/main/add">

 

Missing the index.php path. between CI and main path.

Thanks.


davidoster
  • profile picture
  • Member

Posted 14 May 2013 - 21:04 PM

Probably you're missing the url helper?

$this->load->helper('url');

If you don't autoload it then change this line to the above.


yemane
  • profile picture
  • Member

Posted 16 May 2013 - 13:59 PM

Hello David,

 

Yes I have tried that one already and still having the same issue.

 

 

Regards,

Yemane.


yemane
  • profile picture
  • Member

Posted 16 May 2013 - 14:49 PM

Hello David,

 

I re-installed CI and grocerycrud and now it's working..copied the same config, controller and view I had previously.

 

Now I have issue with not searching but will open a different topic on that..

 

Thanks for all your help..