Jump to content

xxxlogiatxxx

Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About xxxlogiatxxx

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. That was my mistake i have to use default values. Thanks everyone 😅
  2. Is there any ideas how to find pages by it's translated value of Select Options field title? For example i want to get pages in current language by some option title: Default: 1=Precious 2=Semi-precious Italian: 1=Preziosa 2=Semipreziosa No idea why italian version returned me empty results. $type = $sanitizer->text($input->get->type); $input->whitelist('type', $type); if($type) { $results = $pages->find("template=encyclopedia-item, encyclopedia_item_type.title={$type}, limit=5, sort=title"); } else { $results = $pages->find("template=encyclopedia-item, limit=5, sort=title"); } foreach($results as $result) { echo $result->title; } $data contain value Precious/Preziosa
  3. How to get all possible options from the select field in current language? This code always returns me options in default language: $field = $fields->get('encyclopedia_item_type'); $options = $field->type->getOptions($field); foreach($options as $option) { echo "<option>$option->title</option>"; } I can filter them by language through PHP and use $option->title1020 instead of $option->title foreach($options as $option) { echo "<option>$option->title1020</option>"; } But i believe there is a better way
  4. Hello guys. Can anyone explain how to get all page fields and return them as json? $myPages = $pages->find('template=catalog-item'); $data = $myPages->explode(['title', 'created', 'some_field']); echo wireEncodeJSON($data); This code returned me id, created date but there is no fields. I need something like array(title: "Page title", body: "Some text", image_url: "/images/123.jpg"). Any ideas?
  5. Hey guys. Need some little help for a newbie. How can i foreach all possible values from existing field of a child template into select form? Trying like this but it showing me results from created pages and their fields. $fields = $page->find("template=item, sort=item_type"); echo "<select>"; foreach($fields as $item) { echo " <option>{$item->item_type->title}</option> "; } echo "</select>";
×
×
  • Create New...