Company Directory localization and pretty URL issue

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
dillmcgill
New Member
New Member
Posts: 2
Joined: Tue Aug 26, 2008 10:20 pm

Company Directory localization and pretty URL issue

Post by dillmcgill »

I'm using the Company Directory module as a staff directory for an organization, I was able to change most instances of "Company" or "Companies" to staff in the lang file, but when you drill down to the detail level, the urls become:

http://mysite.url/companies/321/123/

Which is fine, except for the companies part. It would be great if it pulled the "companies" terminology from the lang file, especially in this instance and also for non-English sites. I tried to fix it myself, by editing /modules/CompanyDirectory/action.default.php

in line 140:

Code: Select all

$urlfmt = 'companies/%d/'.($detailpage!=''?$detailpage:$returnid);
I simply changed it to:

Code: Select all

$urlfmt = 'staff/%d/'.($detailpage!=''?$detailpage:$returnid);
I then cleared the site cache, and it did change the links, but now they just reload the summary page, rather than linking to the detail page.

Also would be great if instead of pulling ids for the rest of the url, it pulled names. Not a big deal though. Any help on this would be great. Thanks.
alby

Re: Company Directory localization and pretty URL issue

Post by alby »

dillmcgill wrote: I then cleared the site cache, and it did change the links, but now they just reload the summary page, rather than linking to the detail page.
If you change url format you must change in MODULE.module.php the relative RegisterRoute ....

Alby
dillmcgill
New Member
New Member
Posts: 2
Joined: Tue Aug 26, 2008 10:20 pm

Re: Company Directory localization and pretty URL issue

Post by dillmcgill »

Hey thanks for the reply, alby.

I changed all instances in the CompanyDirectory.module.php file as well as my previous edit, but no dice. Is there something else I'm missing?

Here's what I changed:

In action.default.php

Code: Select all

//
// Build the pretty urls
//
$urlfmt = 'companies/%d/'.($detailpage!=''?$detailpage:$returnid);
if( isset( $params['detailtemplate'] ) )
  {
	$urlfmt .= '/d,'.$params['detailtemplate'];
  }
becomes this

Code: Select all

//
// Build the pretty urls
//
$urlfmt = 'staff/%d/'.($detailpage!=''?$detailpage:$returnid);
if( isset( $params['detailtemplate'] ) )
  {
	$urlfmt .= '/d,'.$params['detailtemplate'];
  }
and in CompanyDirectory.module.php

Code: Select all

	  // Friendly URL stuff
	  // todo, add defaults here
	  $this->RegisterRoute('/[cC]ompanies\/(?P<companyid>[0-9]+)\/(?P<returnid>[0-9]+)$/');
	  $this->RegisterRoute('/[cC]ompanies\/(?P<companyid>[0-9]+)\/(?P<returnid>[0-9]+)\/d,(?P<detailtemplate>.*?)$/');
	  $this->RegisterRoute('/[cC]ompanies\/(?P<companyid>[0-9]+)$/');
	  $this->RegisterRoute('/[cC]ompanies\/bycategory\/(?P<categoryid>[0-9]+)$/');
	  $this->RegisterRoute('/[cC]ompanies\/bycategory\/(?P<categoryid>[0-9]+)\/(?P<returnid>[0-9]+)$/');
becomes this:

Code: Select all

	  // Friendly URL stuff
	  // todo, add defaults here
	  $this->RegisterRoute('/[sS]taff\/(?P<companyid>[0-9]+)\/(?P<returnid>[0-9]+)$/');
	  $this->RegisterRoute('/[sS]taff\/(?P<companyid>[0-9]+)\/(?P<returnid>[0-9]+)\/d,(?P<detailtemplate>.*?)$/');
	  $this->RegisterRoute('/[sS]taff\/(?P<companyid>[0-9]+)$/');
	  $this->RegisterRoute('/[sS]taff\/bycategory\/(?P<categoryid>[0-9]+)$/');
	  $this->RegisterRoute('/[sS]taff\/bycategory\/(?P<categoryid>[0-9]+)\/(?P<returnid>[0-9]+)$/');
martinneil
Forum Members
Forum Members
Posts: 15
Joined: Thu Mar 12, 2009 6:02 pm

Re: Company Directory localization and pretty URL issue

Post by martinneil »

was this ever solved?

this is what im trying to do as well at the moment.
Post Reply

Return to “Modules/Add-Ons”