icetea Posted July 9, 2015 Share Posted July 9, 2015 Hello ProcessWire team I'm new hir and make my first steps with ProcessWire. To my problem: I'd like in a section which is repeated. Here I would insert Columne individuel once but 2 another time 3 Columne my code is not working. f_columns is a field Type = repeater with title and f_box_1_spalte_wysiwyg f_box_1_spalte_wysiwyg is a field Type = textarea the code I is used <?php $panels = $pages->find("template=t_pw_page_pool"); foreach($panels as $panel){ ?> <section class="main <?= $panel->f_box_erscheinungsbild->title; ?> <?= $panel->f_box_ausrichtung->title; ?> dark fullscreen inactive" id="<?= $panel->f_id_css_d4m->title; ?>"> <div class="content box style2"> <header> <h2><strong><?= $panel->f_box_title_bold; ?></strong><?= $panel->f_box_title_d4m; ?></h2> </header> <?= $panel->f_box_1_spalte_wysiwyg; $panel->f_columns; ?> <a class="fa fa-chevron-circle-up top" href="#top"></a> </div> <a class="scroll-down-link icon fa fa-chevron-down" href="#<?= $panel->f_id_css_link->title; ?>">Next</a> </section> <?php } // end foreach?> Link to comment Share on other sites More sharing options...
icetea Posted July 9, 2015 Author Share Posted July 9, 2015 Hello ProcessWire team I'm new hir and make my first steps with ProcessWire. To my problem: I'd like in a section which is repeated. Here I would insert Columne individuel once but 2 another time 3 Columne my code is not working. f_columns is a field Type = repeater with title and f_box_1_spalte_wysiwyg f_box_1_spalte_wysiwyg is a field Type = textarea the code I is used <?php $panels = $pages->find("template=t_pw_page_pool"); foreach($panels as $panel){ ?> <section class="main <?= $panel->f_box_erscheinungsbild->title; ?> <?= $panel->f_box_ausrichtung->title; ?> dark fullscreen inactive" id="<?= $panel->f_id_css->title; ?>"> <div class="content box style2"> <header> <h2><strong><?= $panel->f_box_title_bold; ?></strong><?= $panel->f_box_title; ?></h2> </header> <?= $panel->f_box_1_spalte_wysiwyg; ?> <?= $panel->f_columns; ?> <a class="fa fa-chevron-circle-up top" href="#top"></a> </div> <a class="scroll-down-link icon fa fa-chevron-down" href="#<?= $panel->f_id_css_link->title; ?>">Next</a> </section> <?php } // end foreach?> output from <?= $panel->f_columns; ?> is 1039 l 1040 l 1041 as I have to query the contents of repear in a repear loop? Link to comment Share on other sites More sharing options...
Wanze Posted July 9, 2015 Share Posted July 9, 2015 Hi icetea, $panel->f_columns is again a PageArray, you need to loop over it with a second foreach loop and output the columns. However, nesting multiple repeaters is not the best idea and even though it seems to work technically, you get yourself in troubles when your data is growing. A better approach might be to use "regular" pages which then can be linked via page fields. Cheers Link to comment Share on other sites More sharing options...
mr-fan Posted July 9, 2015 Share Posted July 9, 2015 You don't need a repeater in a repeater....just make some better fieldsetup. example: your repeater f_columns should have all fields needed to get your output: 1. textarea 1 2. textarea 2 3. textarea 3 4. how many columns you need.... and now some kind of magic field 5. a options or pagefield type with the setting for the needed columns name it f_type or something like that - take a look at the options fieldtype for this. now you have a option to get different setups for your repeater field. example: if f_type has the options 1=One Column 2=Two Columns you could setup in your textarea 2 the display settings to only show if f_type=2 and so on... ...and in the template you could switch the layout on the f_type field...some screenshots below. Or you could look at the PageTableExtended (with kind of wysiwyg rendering in backend) field. Some good example for repeater as flexible layout field is there: https://processwire.com/talk/topic/6647-blue-vr-processwire-site-profile/ codedetails: (look at the pageblocktypes1-6) https://github.com/gayanvirajith/BlueVrSiteProfile/tree/master/templates/markup regards mr-fan 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now