Search the Community
Showing results for tags 'dropdown'.
-
Hi there, I am new to PW but already very convinced. I need to build a dropdown button to browse in a collection of authors by country and language. The dropdown should be editable in the BACK and displayed on the same as the authors collection. I tried my luck with "PageField Creator" but I don't know how to display the dropdown, I simply used: "$content .=$page->Land;" (the name of the select field) but nothing is displayed... I see there is a 2nd module out there to achieve this : "Select Options Fieldtype". I am not sure what is the difference, anyone has a tip? And a clear tutorial with the necessary steps to build this? I am a bit confused which should be the parent template or page, if it should have a file or not... Thanks a lot in advance!
- 5 replies
-
- dropdown
- dropdown selection
-
(and 1 more)
Tagged with:
-
Hi everyone, here's the problem I'm trying to solve. I have a config area in my PW admin that is locked down for admin use. I use pages to store a bunch of settings that I'll use for my clients website. It's mostly used for visual things like colours and theming. This list could be tiny or large, depending on the sites requirements, but its great because I can store any information I want to. So the page tree could look something like this: ADMIN SETUP Home Config Aesthetics Colours Red Field: Custom Label - "Red" Field: Class name - "theme--red' Green Field: Custom Label - "Green" Field: Class name - "theme--green' Blue Field: Custom Label - "Blue" Field: Class name - "theme--blue' etc... Sizes Small Field: Custom Label - "Small" Field: Class name - "sm' Medium Field: Custom Label - "Medium" Field: Class name - "md Large Field: Custom Label - "Medium" Field: Class name - "lg" etc... Icons Target Field: Custom Label - "Hands shaking Icon" Field: Icon SVG - "[svg code]' Target Field: Custom Label - "Target icon" Field: Icon SVG - "[svg code]' Success Field: Custom Label - "Happy face icon" Field: Icon SVG - "[svg code]' etc... HOW I USE THIS I'm then able to set up page reference fields for colour, size and icons. I'll use these fields on particular pages so that my clients can select a particular colour, size or icon, or anything really. Currently, with the page reference field I can create a custom label for the options. So for something like colour I can label the field "Theme" and present a list of colours like "Red, "Green" and "Blue" using the custom page label label format of the colours page. This of course means that I can use this to do some lovely presentation on the front end of the site. With a colour selected I'll then be able to use the page reference to get the class name for that colour theme so that I can update the page's look and feel. So in my markup I'd end up with "theme--red" or "theme--green" etc. THE PROBLEM I have this all working which is great and it's really flexible for the client which they love. However, I'd love to be able to make things more visual for the client. Is there a way to be able to output more than just text in the page reference field? I might have a bunch of different blue colours, so instead of a list like so: Navy Blue Deep Blue Bright Blue Sea Blue ... it would be great to be able to output actual colour swatches, which is a lot mor visual for the client. Taking the icon selector, I would ideally like to show the actual svg that I've stored against that icon as a selectable image instead of seeing text options like: Hands shaking icon Target icon Happy face icon Just a couple of scenarios here, but as you can see there could be any number of reasons to display a more visual method of selection. ANY SOLUTIONS? I've looked at modules like FieldtypeColorPicker which could help in solving the colour issue, but it doesn't allow me to select a colour and then use a particular class name assigned to it the way I describe above. Considering the other use cases I mention above, does anyone know if anything exists already that would help me to create custom presentaion for page reference lists, or if there's anything planned? Thank you in advance for anyone who's read this far and has any words of wisdom! Dave
-
Reference: PW 3.0.111 and uikit3 based site using the Regular-Master profile. I am trying to add a field that provides a dropdown menu but there are no Options or Selector(s) type available - see attached image of field types available. The following reference under the docs does not appear to be applicable any more: https://processwire.com/api/modules/select-options-fieldtype/ I can't see how to achieve this. Any assistance would be appreciated.
-
Hi everyone, Currently I'm struggling with a filter option and I hope somebody can help or advise me the right way to this. What I want is an index page where campaigns are shown and where I can filter the campaigns by year. Each campaign has a datetime field with the output set to "j F Y", so it shows "1 April 2016" in the frontend. The dates are unique for each campaign, but there can be multiple campaigns in the same year. The page structure is: -client --campaign-a --campaign-b --campaign-c --campaign-d This is the PHP code I use on the client page to display all the campaigns. $campaigns = $page->children("sort=sort"); foreach ($campaigns as $campaign) { if($campaign->campaign_description) { echo '<div class="campaign-description info">'; echo '<h2>' . $campaign->title . '</h2>'; echo '<p>' . $campaign->campaign_description . '</p>'; // Todo remove only for testing $campaignDate = $campaign->campaign_date; $campaignYear = substr($campaignDate, -4); echo '<i>' . $campaignDate . '</i>'; echo '</div>'; } } $campaignYear is where I see the years, 2015, 2016, 2017 and so on. Here I create the dropdown to show the unique years: if (count($campaigns)) { // Store unique Years $arr = array(); foreach ($campaigns as $campaign) { $campaignDate = $campaign->campaign_date; $campaignYear = substr($campaignDate, -4); $arr[] = $campaignYear; } $unique_years = array_unique($arr); // Show dropdown with unique years echo '<select id="campaign-date-select">'; foreach($unique_years as $year) { echo '<option value="' . $year . '">' . $year . '</option>'; } echo '</select>'; } I read a couple of articles, for example this: https://processwire.com/talk/topic/8513-sort-with-select-dropdown/ but I can't figure out how to dynamically change the output of the campaigns, based on the input of the select options. Maybe the datetime field is not the best option, or maybe I have to use URL segments and JavaScript to combine something... Any help or advise is welcome!
-
i want to output a menu with just one dropdown-option and an class="active" if the user is on the active page this is my tree – root –– page A –––– child page A –––– child page A –––– … –– page B ––– child page B ––– child page B ––– child page B –– page C ––– child page C ––– child page C and the output should be like this –– page A (just dropdown, no link! just text) –––– child page A (link) –––– child page A (link) –––– … –– page B (link) (children should not be listed) –– page C (link) (children should not be listed) and if the current page matches A, B and C matches on any level a class should be added to page A or B or C this my code so far but i dont how to make page B and C an link and page A just text and how not to output the children of page B and C <?php $root = $pages->get("/"); $children = $root->children(); foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ""; echo "<li $class ><a >{$child->title}</a>"; echo "<ul>"; foreach($child->children as $grandchild) { echo "<li ><a href='{$grandchild->url}'>{$grandchild->title}</a></li>"; } echo "</ul></li>"; } ?>
-
Hi folks, As the title suggests, is it possible to output the label from a select/dropdown, rather than the value? I am using this module: http://modules.processwire.com/modules/fieldtype-select/ and I am currently outputting the value as follows: <?php echo $project->project_location_type; ?> Thanks in advance, R
-
I see a fieldype made by Hanni; and i have a question with multi language; there's a way to made this fieldtype to save to multiLanguage processwire 2.5.* ? The module is: https://github.com/Hani79/Processwire_FieldType_Select_Drop_Down PD: i know there's a page fieldtype; but i dont wanna use that cause the final user dont need to see a page with 30 children for 1 category dropdown. Regards,