Jump to:

3433 Posts in 1058 Topics by 734 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: 928 Views
  • snaip
    Avatar
    Community Member
    180 Posts

    GoogleSiteMap change Locale Link to this post

    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

    928 Views
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.