sh404sef and Fabrik

kushiel

Member
Hi. I'm having trouble getting sh404sef to play nicely with Fabrik.

Joomla! 2.5.7
Fabrik 3.0.6.3-221-ge05b513 (latest GitHub)

What I'd like is to have: site.com/menutitle/tablename/slug.html (or at least something close to that)

The only option under Fabrik Options > sh404 SEF that seems to be working for me is "Table name on forms"

I've tried every option under "Format for records" and nothing I select changes the output.

Here is what I do get... the Fabrik ? List menu item shows up as site.com/tablename.html

When I load up the list, the items all have the same URL instead of unique URLs. They show up as site.com/tablename/ with each one referencing the first row of the table.

I believe this is the same problem mentioned by jfquestiaux here: http://fabrikar.com/forums/showthread.php?t=28541

I've looked through /components/com_fabrik/sef_ext/com_fabrik.php but the code is beyond my PHP knowledge.

I enabled logging for all error/alert/debug/info messages in the shlib plugin. I scanned through the logs and this stuck out:

Code:
2012-10-17	23:04:02	8-error	-	guest	ShlSystem_Strings::ShlSystem_Strings::pr::44: RegExp failed: invalid character on page /tablename.html

I am using Fabrik for several other functions on my sites and normally don't need SEF URLs, but my latest project requires it. I am creating a catalog of information of sorts. I am considering using K2 to set this up, but it lacks the power that Fabrik has. Plus, I think Fabrik is great and I am growing more and more comfortable with it so I'd like to use it for this project. The only thing holding me back is compatibility with sh404sef. Hope I can figure out a solution to this, please let me know if you have any ideas. Thanks.
 
Sorry I don't have sef404 so can't really test.
The code was donated by several community users jfquestiaux was the last to work on it - perhaps you can send him a private message on the forum to ask for advice?
 
Thank you jfquestiaux. I will keep an eye on your original post. Looking forward to seeing the ID issue fixed so that sh404sef compatibility can be restored. I appreciate your current oversight on the plugin.

Rob, I assume that you and Hugh do not look after the sh404sef plugin because sh404sef is now a paid component? Or perhaps because you have no need of sh404sef in your Fabrik projects? Just curious, because from my forum searches it seem that the working status of the plugin has faded in and out over time based on the availability of various Fabrik community members.

I haven't used all of the other application builder or CCK-like components for Joomla, but Fabrik blows away the few that I have used in terms of power and usability. But, it does seem that sh404sef compatibility is a weak link, considering that it is one of the most used and relied upon SEF components for Joomla.

Anyway, I'm glad that at the present time jfquestiaux is here to look after it. I will hold off on looking into other component solutions as I am looking to build something similar to what jfquestiaux linked to in his post and I think Fabrik will work great for it.
 
It took me some time but, as far as my tests go, the problem is now solved.
I uploaded the changes on GitHub and send a pull request, so I guess in a day or two it waill be available.

EDIT: as of Git 241, the changes are included.

If, like myself, you had a working install that stopped returning the correct url for links to details view (returns "index.html" for all links), this is the way to go :


  1. Update to latest GitHub version (once the pull request has been accepted - check the "commits" to find out)
  2. Once the update is complete, go to Components > sh404SEF > URL
  3. Filter the URL by component on "fabrik"
  4. In the list of URL SEF, look for one "index.html" entry. If you don't include the list name in the URL (setting in the Fabrik general settings), you should have only one (but with many duplicates). If you include the list's name, you can have several.
  5. Check the file(s) "index.html" and click on "Delete with duplicates" (it is important to delete ALL the duplicates)
  6. Immediately after, go to Site > Maintenance > Purge cache
  7. Check all the files and delete them
  8. Purge also the expired files (I found that sometime necessary to be sure to clear the cache completely)
Now the correct URL (including the slug) should be displayed for the links to details.
 
Excellent! I have made some progress on my project in the past few days, so I look forward to adding SEF URLs. Thanks for your contribution and the clear instructions. I'll keep my eye on GitHub.
 
I must have edited my post while you were writing yours. The changes are now included in GitHub (> 241).
 
Very nice. I'll try it out later tonight. From my quick scan of your changes on on sef_ext/com_fabrik.php, I see where you added $formid to the fetch slug section. I thought to do the same when I was trying to fix it, but it would have taken me MUCH longer to eventually figure out what you did!
 
Well, don't hold your breath! Although i could get it working on my test server, I could not get the same result on the live site, so I need to restart from the beginning to see where it sticks. also there is a new sh404SEF version that may be the problem.
I will let you know.
 
Strange that it doesn't work for you on the live site. My site is not live yet so I haven't been able to test that. But, so far so good, as it's working for me on my local server.

One thing that doesn't work is "prepend menu title" (from sh404sef Fabrik Options). "Table name on forms" does work however. "Format for records" doesn't seem to have any effect, though I haven't tested it thoroughly. The slug IS getting picked up by sh404sef which is enough for me to be satisfied.

What I was going for was something like site.com/menutitle/tablename/slug.html

But, I couldn't get the menu title picked up, so what I've done to achieve this is setup my slug element as a calc that does some queries to grab my preferred names for the URL. I end up returning something like this:

PHP:
return $menu_name . strtolower(str_replace(" ", "-", $form_name)) . "/" . strtolower(str_replace(" ", "-", $title));

sh404sef removes the spaces and replaces with dashes, and there is also a setting to force lowercase for all URLs, but I wanted to keep it clean so I did everything here anyway.

Then I deselect "Table name on forms" so that sh404sef only uses my slug element to create the URL. Seems to be working just fine... great even. Although I haven't transferred it to the live server yet. Hopefully I won't run into any problems then. It will be another week or so before I do that so I'll let you know if I hit any stumbling blocks.
 
If it works locally, it should work when you set the site live since it is the same site.
I don't know why it is not working for me, but I had to test so many thing to fix the plugin that I may have changd something somewhere.
That is why I want to start from the beginning each step at a time. Glad to know that it seems to work anyway.

Regarding the "prepend menu title", the title of this section of Fabrik setting is a bit misleading: it used to be "SEF settings" but seems to be now "sh404SEF settings" which is not! It is really the Joomla SEF settings.
I did picked up the "Table name on forms" setting, but have not implemented the menu title. I may have a look on this to see whether it is something that can be implemented.
Otherwise your idea to use a calc element for the slug is a good one.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top