Filed under: Web Design, PHP, Joomla — ChrisCTI on Thursday, November 8th, 2007 @ 7:22 pm

We recently developed a site where we are using the excellent Joomla component Mosets Tree (version 2.0.2). To generate SEF URLs for the site, we are using the sh404SEF component as JoomSEF doesn’t play as nice out of the box.

However, when using sh404SEF there are a couple of issues, most noticeably the fact that status alerts (such as the “Listing submitted successfully! or “Your review is pending approval.” messages that appear when the user submits/rates/reviews/etc. something in the directory) do not appear. This is obviously bad for the user as they don’t get any feedback on whatever action they have just performed.

Luckily, there is a way to fix this that’s not too complicated …

We will need to edit the following file:

/components/com_mtree/mtree.php

Once you have this file open, search (ctrl+f) for “mosRedirect” (without quotes). What we are looking for are lines of the following type:

mosRedirect( "index.php?option=$option&task=viewlink&link_id=$link_id&Itemid=$Itemid", $_MT_LANG->REPORT_HAVE_BEEN_SENT);

These lines basically tell the browser to redirect to a specific page after performing a task (for example, when a user submits a review of a listing), and also to append a user message to the URL which will be displayed.

To get these working as they should be, we need to add the function

sefRelToAbs()

to the URLs, which we do like so:

mosRedirect( sefRelToAbs(“index.php?option=$option&task=viewlink&link_id=$link_id&Itemid=$Itemid”), $_MT_LANG->REPORT_HAVE_BEEN_SENT);

Note that we only enclose the URL within the function and not the appended message or any other arguments that might be present.

Continue to go through the file adding this function to all similar lines (there are about a dozen or so if I remember correctly), then save and upload it.

The user messages should now be working (you may need to purge any SEF URLs that have already been generated)!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment


Are you human? Type the word into the box (it helps reduce spam).
Anti-spam image