Jump to content

kixe

Members
  • Posts

    802
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by kixe

  1. While trying out language switcher together with the calendar. I put this to the beginning of the script:
     

       $lang = substr($page->url,1,2);
        $lang_code = ($lang=='en')?'en_US':$lang.'_'.strtoupper($lang);//works not for all countries but most of them (fr, de, it, nl, is, ru, es, tr)
        setlocale(LC_TIME, $lang_code);
    
     

    and changed the forward backward links:

       $out .= "<a href='/".$lang."/calendar/". date('Y', $lastMonth) ."/".  date('m', $lastMonth) ."/'>←</a>";
        $out .= "<a href='/".$lang."/calendar/". date('Y', $endTime) ."/". date('m', $endTime) ."/'>→</a>";
    
     

    I am using url-segments for year and month, like ryan recommended

    $year = ($input->urlSegment1)?$input->urlSegment1:date('Y');
    $month = ($input->urlSegment2)?$input->urlSegment2:date('m');
    
     

    this will put out the current month as standard under the url en/calendar/

    echo renderCalendar($page, $year, $month, $field = 'startdate');
    
     

    its good to have such an easy going calendar. Thanks. Fun (while working with PW) has already started. :rolleyes:
    kixe

    • Like 2
  2. A known monday is also the day after last sunday! Isn't it? ???

       $weekDayNames=array();
        $i=0;
        while($i++ < 7) array_push($weekDayNames, strftime('%a', strtotime('last Sunday + '.$i.' day')));
    
     
     
     

     change this 


     

      // if we're at the beginning of a week, start a new row
            if($day > 1 && $dayName == $weekDayNames[0]) $out .= "<tr>";
    
     

    and that
     

          // if last day in week, then close out the row
            if($dayName == $weekDayNames[6]) $out .= "</tr>";
    
     

    kixe

  3. Hi,

    first step is done. language switcher is working. I gave the / directory the names "en", "de" and "fr".
    If I am now putting out $page->name on the site, I always get "en", even if I have switched to "de". Why?
    What is the right api to get the names? I tried out with substr($page->url,1,2) which works. But is it really safe? Put out bool(false) in case of "/" (home directory in default language). It would be nice to have en API which put out language iso-code of the current page.

    Ideas?
    kixe

  4. I am using on localhost same page with three language fields. Even tried out language page name module and (which is important here) "frontend user login". That's why I was a little bit astonished, the language didn't switch after login via frontend.

    I am thinking about to use PW-Users for "Comments" or small Forum. In this cases it would be nice to have the language also switched in the frontend, after setting a language to the user!

    I have already implemented a language switcher on the page, which is working fine.
    Which Api should be used to get the /en/ or /de/ from the url-path to use it in links on the template. Something like $user->language->ISO-Code ('en' for english for example)

    If I use $user->language->name the language name in the current language appears, like set in the backend (for example "francais", for french in french)
    Thanks for help.
    kixe

  5. Hi,

    where can I include a language switcher, which sets, if exists, the site language automatically to the browser language?
    Maybe Redirection from /home/ to  /home/de/ or /home/en/
    I am looking for something like this:

    $user->language->name = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
    
     

    Thanks for help

    kixe

  6. Hello Community,

    after a colleague recommended PW to me I am playing around with it since two weeks. Now I can imagine the big potential PW has and I am really happy about it because it fits perfectly to what I have been searching for since a long time. :)
    Now I would like to do a small project with it to get motivation of something real visible.

    The project should be in three different languages. I implemented the modules and it seems to work fine. But the problem is, that the frontend is always shown in the default language. I put some different users to the platform and set different languages to them. In the backend the language switches to the users language but not in the frontend. :(  Maybe I forgot something in the template. I don't know. Please help to save time.
    Thanks in advance.

    kixe

  7. ... no answer. I decided to help myself and hope somebody else will profit from it. I changed the following lines (450 ff) in the module-file from:
     

     if ($this->user->avatar) {
        $cropped_avatar = $this->user->avatar->first()->size(150);
        $avatar = $cropped_avatar->url;
     }
    
    

    to:
     

    if ($this->user->avatar->first()->url) {
        $cropped_avatar = $this->user->avatar->first()->size(150);
        $avatar = $cropped_avatar->url;
    }
    
    

    Now its working.

    About security:
    After logging-in each user can reach every profile about other users via profile/info/username.
     

    I think I will make some modifications for my personal use in this line (481):

    if($this->user->isLoggedin() && $this->input->urlSegment1 == 'info' && $this->sanitizer->name($this->input->urlSegment2)) {
    
     

    I would also recommend to include a field which inquires the old password before giving the allowence to set a new one in the edit-area.

    Until going deeper in PW I like it more and more and can image how big the potential for the future is.

    kixe

    • Like 4
  8. Hi,

    installed the "User-Profiles-for-PW" - Module and got an error message:

    Error:     Call to a member function size() on a non-object (line 449 of
    ../../site/modules/FrontendUserProfile.module)

    If I give an individual Avatar to the User everything works fine. I checked the access of the no-avatar.jpg. It is ok!
    Couldn't find the problem quickly.

    btw: I would also recommend to make the module translatable.

    good to have a module like this.

    kixe
     

  9. Thats right Soma its the latest Version 2.3.
    What I did:
    1) Admin -> Modules | enabled Languages Support and Languages Support -Fields
    2) Admin -> setup -> Languages -> Add New ("german")
    3) Admin -> Setup -> Languages -> Install from file http://processwire.c...5-german-de-de/
    4) Admin -> Setup -> Fields -> Body | changed the Type from Textarea to TextareaLanguage
    5) Warning: Screenshot 2 (my_last_post_above) Warning ignored
    6) Error: Screenshot 1 (of_my_last_post_above) occured
    7) Admin -> Setup -> Fields -> Title | changed the Type from PageTitle to PageTitleLanguage
    8) Warning: Screenshot 2 (my_last_post_above) Warning ignored
    9) Database crashed, Error: Screenshot 3 occured

    I am just playing around with the system and the example page. Until now I didn't put in any data.
    I need the possibility of multi language editing in the backend.

  10. Hello Processwire-Community,

    I have installed German Language Module from here: http://processwire.com/talk/topic/925-german-de-de/

    While trying to enable multi-language, I got that:

    Error:     Exception: Unknown column 'field_title.data1009' in 'field list'
    (in /Users/c/Sites/processwire/wire/core/Database.php line 118)

    Any solutions???

    Christoph/ Cologne/ Germany

    screenshots:
    pcw_error_1.tiff
    pcw_error_3.tiff
    pcw_werror_2.tiff

×
×
  • Create New...