Jump to content

cabrooney

Members
  • Posts

    18
  • Joined

  • Last visited

Posts posted by cabrooney

  1. I have the following situation: The user can add child-pages to a page and can choose between two different possible templates (On the page with the headline "Add New"). Is it possible to select, which of the two templates is preselected in the pulldown? (Because one is only used in 5% of the cases, but is preselected at the moment).

    What i tried so far:
    - I found the "PageAdd module settings" but changeing the order there does not seem to work.
    - Also the order of the parents "Family" section under "Select the template" does not change anything.

  2. Thank you very much for your help. it worked perfectly! Here is my final code:

    $zeit_a = strtotime($jahr."-12-01 00:00:00");
    $zeit_b = strtotime($jahr."-12-31 23:59:59");                                
                                    
    $terminliste=$pages->find("template=repeater_termin_repeater, include=all, sort=termin_datum, termin_datum>=$zeit_a, termin_datum<=$zeit_b");

    One other thing i had to figure out after that was the use of ->getForPage() to get access to the "origin" page. 

    • Like 1
  3. Is there a simple solution to generate (find) and sort an array of repeater field entries, that come from multiple pages?

    In my case the setup is like this:
    - I have pages for "theater plays" (storing title, text, artists etc.).
    - Each of these pages has a repeater field in it for the dates that the play is performed (storing datetime, location, tickets, prices etc.) 

    Now i need to generate an overview showing all the events (Titel and date) that will take place in december.

     

    What i managed to do so far is to search for a timespan, but only in one repeaterfield on one page (and the results are not sorted):

    $zeit_start = strtotime("2021-12-01 00:00:00");
    $zeit_end = strtotime("2021-12-31 00:00:00");    
    $terminliste=$page_play->termin_repeater->find("termin_datum>=$zeit_start , termin_datum<=$zeit_end ");
    
    foreach($terminliste as $termin){
       // echo $termin->title;
    }

    So how can i use "find()" to scan all the repeater field entries of all the pages, and how can i then uns "sort()" to bring them in the right order?

     

  4. I have a repeater field containing a list of pages (each page with people information like first_name, last_name etc.).

    When i try to sort and display with foreach(), the sorting puts all lowercase-starting entries at the back after Z...

    My Script:

    foreach ($group->group_people->sort("person_name") as $person){
              echo $person->person_name;
    }

    Output:

    Alberts
    Bernard
    Constantin 
    ...
    Zachary
    van Bergen 

    The last Name "van Bergen" is lowercase and is put at the end of the sorting array. Is there a way to sort while ignoring upper/lowercase?
     

  5. I save an Image from an URL to an image field using setAndSave().
    The image field is set to "Single Item (0 if empty)" and "Maximum Files Allowed = 1".

    But the line

    $page->setAndSave('bild', $imgurl);

    uploads the picture and adds it to the existing one. So there are now a growing number of pictures in my "single item" field.

    What i expected to happen was, that the new image would overwrite the existing one.

    Am i doing something wrong or is there another setting that i missed?

    (Sorry if i posted this in the wrong forum.)

  6. Is it possible to hide specific inputfields from specific users/roles? I want the user to be able to edit the page, except a single field in that page.

    I already found the visibility setting under setup/fields/input but i don't get the right parameters for "Show this field only if ...".

    I hoped it would be something like "$user!=admin" but this does not work.

×
×
  • Create New...