Roych Posted August 12, 2021 Share Posted August 12, 2021 Hello I'm working on some tabbed content and need some help, please. I m using text field for naming tabs. All is working fine if I write one word inside. But if there are two words (expl: Food Prices) the tabs stop working. The field is called "text1" And Im using repeater for my work. Is it possible to output the field without spaces. I tried with ID but its somehow not working. My whole code just for reference: Spoiler <!-- Menu Page Start --> <section class="menu_page_area"> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="menu_page_inn"> <div class="menu_nav"> <ul class="nav nav-tabs" id="myTab" role="tablist"> <?php foreach($item->cenik_repeater as $cenik) :?> <li role="presentation"> <a href="javascript:;" class="<?php if ($cenik->active_checkbox) :?>active<?php else:?><?php endif;?>" id="<?=$cenik->text1?>-tab" data-bs-toggle="tab" data-bs-target="#<?=$cenik->text1?>" role="tab" aria-controls="<?=$cenik->text1?>" aria-selected="<?php if ($cenik->active_checkbox) :?>true<?php else:?>false<?php endif;?>"><?=$cenik->text1?></a> </li> <?php endforeach;?> </ul> </div> <div class="tab-content" id="myTabContent"> <?php foreach($item->cenik_repeater as $cenik) :?> <div class="tab-pane fade <?php if ($cenik->active_checkbox) :?>show active<?php else:?><?php endif;?>" id="<?=$cenik->text1?>" role="tabpanel" aria-labelledby="<?=$cenik->text1?>-tab"> <div class="row"> <div class="col-md-11 mx-auto"> <div class="food_menu_inn"> <div class="row justify-content-between"> <?php foreach($cenik->cenik_table as $cene) :?> <div class="col-lg-5 col-sm-6"> <div class="menu_page_table"> <a class="food_menu_item" href="#" rel=""> <div class="menu-item_content-wrap"> <div class="menu-item_content"> <div class="menu-item_title"> <h4><?=$cene->ime_storitve?></h4> </div> <div class="menu-item_price"> <h4><?=$cene->cena?><span class="currencySymbol"> €</span></h4> </div> </div> <div class="menu-item_desc"> <p><?=$cene->opis_storitve?></p> </div> </div> </a> </div> </div> <?php endforeach ;?> </div> </div> </div> </div> </div> <?php endforeach ;?> </div> </div> </div> </div> </div> </section> <!-- Menu Page End --> Thank you very much R Link to comment Share on other sites More sharing options...
Rudy Posted August 12, 2021 Share Posted August 12, 2021 I think you want to convert your field value to name format (no spaces, replace with underscores or hyphens)https://processwire.com/api/ref/sanitizer/name/ Something like $sanitizer->name($cenik->text1); 1 1 Link to comment Share on other sites More sharing options...
Roych Posted August 12, 2021 Author Share Posted August 12, 2021 Omg, so simple. ? It works perfect now. Thank you very much ? R 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