Jump to content

Need help, data output from different pages.


siaweb
 Share

Recommended Posts

Good afternoon, everyone. Faced with the problem of displaying data on the main page. I'm asking for help since I'm just at the beginning of learning CMS. I have.

  • 1. Home
  • 2 Menu
  •  2.1 breakfast
  •  2.2 Lunches
  •  2.3 Already.

I need to take and items 2.1/2.2/2.3 the data from the assortment_name field is a Repeater. There are only 3 text fields. I don't know how to do it. Maybe someone will help.

There are also checkbox fields. This is usually if it is output to the main page. The name of the home_menu checkbox.

Spoiler

assortment_name

  • assortment_title - TextLanguage
  • assortment_price - Text
  • assortment_note - TextLanguage
  • assortment_icon - Options
  • home_menu - Checkbox 

 

Link to comment
Share on other sites

Everything coped helped in another place a little. Thank you all.

If someone needs a cheat sheet, then I pulled it all out. You can close the branch.

Spoiler

$hm_pages = $pages->find("assortment_name.home_menu=1");
                        if (!empty($hm_pages)) {
                            foreach ($hm_pages as $hm_page) {
                                foreach ($hm_page->assortment_name as $an_item) {
                                    if ($an_item->home_menu) {
                        ?>
                            <li class="ct-foodMenu">
                                <div class="ct-dottedBg"></div>
                                <label class="ptn13 ct-u-font2"><?php echo $an_item->assortment_title; ?>
                                <?php
                                if ($an_item->assortment_icon->count > 0) {
                                    foreach ($an_item->assortment_icon as $icon) {
                                             {  echo '<i class="' . $icon->title . '"></i>';}
                                    }
                                }
                                ?><?php $icons = $an_item->assortment_icon; include 'assets/theme/_icon_assortment.php';?>
                                </label> 
                                <span class="ptn13 ct-u-font1"><?php echo $an_item->assortment_price; ?></span>
                                <div class="clearfix"></div>
                                <div class="ct-u-foodIngredients"><?php echo $an_item->assortment_note; ?></div>
                            </li>
                        <?php

 

Link to comment
Share on other sites

Hi @siaweb,

Do visitors have access to the pages of the "assortment_name.home_menu=1" selector?

Did you try with include=all in the find()? Looks like an issue of access control: https://processwire.com/docs/selectors/#access_control

I personally think it would be better to resolve the access of the pages instead of using include=all, but you do you ?

  • Thanks 1
Link to comment
Share on other sites

5 hours ago, Studio Lambelet said:

Привет@siaweb,

Доступны ли посетителям страницы селектора "имя_ассортимента.home_menu=1"?

Вы пытались  включить include=all  в find()? Похоже на проблему контроля доступа:  https://processwire.com/docs/selectors/#access_control

Я лично думаю, что было бы лучше разрешить доступ к страницам вместо использования include=all, но вы делаете ?

Thank you really with include=all everything works and shows well.

As for your first question, this page is available for viewing. I have a part of the assortment of the cafe displayed on the main page. The administrator puts a check mark that this element should be shown. That's all.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...