Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

GoogleSiteMap change Locale


Go to End


1481 Views

Avatar
snaip

Community Member, 181 Posts

9 June 2010 at 9:46am

Edited: 09/06/2010 10:41am

hi

i have site in 8 languages
how to modify GoogleSiteMap to create map for each language ?

in GoogleSiteMap.php there is a code


		$filter = '';
		
		$bt = defined('DB::USE_ANSI_SQL') ? "\"" : "`";
		if(self::$use_show_in_search) {
			$filter = "{$bt}ShowInSearch{$bt} = 1";
		} 
		
		$this->Pages = Versioned::get_by_stage('SiteTree', 'Live', $filter);

i tried to put
$filter = 'Locale = en_US'; -> doesnt work

or
$this->Pages = DataObject::get('SiteTree', "Locale == 'en_US'", '', '', '');
which gave me an error

[User Error] Couldn't run query: SELECT "SiteTree_Live"."ClassName", .....
...
"ErrorPage_Live" ON "ErrorPage_Live"."ID" = "SiteTree_Live"."ID" WHERE (Locale == 'en_US') AND ("SiteTree_Live"."Locale" = 'pl_PL') ORDER BY "Sort" Something is wrong in your syntax obok '== 'en_US') AND ("SiteTree_Live"."Locale" = 'pl_PL') ORDER BY "Sort"' w linii 1

so i put:
Locale = 'en_US'

and now the SQL Query is searching pages which are satisfing the conditions Locale = 'en_US' AND "Locale" = 'pl_PL' but it is always false

how to change this conditions "Locale" = 'pl_PL' to other Locale ?

[SOLVED]

there was a problem with Translatable::set_default_locale in _config.php