Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » GoogleSiteMap change Locale

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

Page: 1
Go to End
Author Topic: 937 Views
  • snaip
    Community Member
    180 Posts

    GoogleSiteMap change Locale Link to this post


    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

    $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 ?


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

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.