⚠ 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

Bug? suffix problem



christian1988

christian1988
  • profile picture
  • Member

Posted 10 February 2012 - 16:54 PM

Hi,
i'm using this amazing libray to develop my backend but i have a big problem.
I'm using CodeIgniter for the frontend and i set a suffix (.html) for my pages and when i render the table with grocery CRUD the edit button doesn't work cause it doesn't recognize the .html suffix of the link.
How can i fix?

web-johnny

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

Posted 11 February 2012 - 00:29 AM

Yes you are right, I forgot that the url suffix don't work with grocery CRUD. A work around for this should be by simply add this type of code at your config.php .


list($tmp, $first_segment) = explode("/",$_SERVER['PATH_INFO']);
$config['url_suffix'] = $first_segment == 'admin' ? '' : '.html';


The 'admin' is just the controller name you can change it for example 'backoffice' or whatever. Is it good also to not use in general suffix because in my personal experience I had lot of issues with this. Though if you like to use it is OK but try to avoid it at your backend controller with this simple hack.

christian1988

christian1988
  • profile picture
  • Member

Posted 11 February 2012 - 09:50 AM

ok thanks, i don't really need a suffix so i can easly remove it.
By the way your code returned an error on te explode function


A PHP Error was encountered
Severity: Warning
Message: Wrong parameter count for explode()
Filename: config/config.php
Line Number: 60

web-johnny

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

Posted 11 February 2012 - 14:18 PM

Oups you are right. I didn't check it actually to tell you the truth. The right thing was:

list($tmp, $first_segment) = explode("/",$_SERVER['PATH_INFO']);

I just writed to the forums code not even in an editor!!! But you get the point anyway.
I edited the code so perhaps other users can use it.

Not using a suffix it was the best thing for you. I really had many problems with suffixes in past and I don't use them anymore unless it is really necessary.

christian1988

christian1988
  • profile picture
  • Member

Posted 11 February 2012 - 14:41 PM

[quote name='web-johnny' timestamp='1328969882' post='485']
Oups you are right. I didn't check it actually to tell you the truth. The right thing was:

list($tmp, $first_segment) = explode("/",$_SERVER['PATH_INFO']);

I just writed to the forums code not even in an editor!!! But you get the point anyway.
I edited the code so perhaps other users can use it.

Not using a suffix it was the best thing for you. I really had many problems with suffixes in past and I don't use them anymore unless it is really necessary.
[/quote]

no problem and thank you for the support!
I hope to find an answer to my other multiple insert question now xD

Kai Lange

Kai Lange
  • profile picture
  • Member

Posted 05 October 2012 - 16:14 PM

Hello,

i know the last answer is a long time ago but the problem ist still there ... (http://www.grocerycrud.com/documentation/known-issues)
isn't it better to change it like this:

libraries/grocery_crud.php
search for "site_url()" and replace with base_url() ...

for me this works :)