Jump to content

Search the Community

Showing results for tags 'options'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 14 results

  1. I have a manufacturers page select field and a dependent models one with pages of template `model` which are allowed children of pages with template `manufacturer`. So I have this as the findPagesCode for the models page options field: return $page->manufacturer->children(); However this requires the page be saved in order to display options. This is not ideal. I have a singular autoload module with the following: public function init() { $this->pages->addHookAfter('render', $this, 'filterModels'); } public function filterModels($event) { $page = $event->arguments('page'); if($page->template != 'boat_vessel') return; $this->message("models filter"); } It's doing nothing. I was thinking I could work out something with this example but I would need the above test to be working first anyway... $this->pages->addHookAfter('changed', function(HookEvent $event) { $page = $event->object; $change = $event->arguments(0); if($page->template == 'boat_vessel' && $change == 'manufacturer') { // execute some code } }); But what? How do I refresh the models field? Is there a way to do this in the field settings? I would think in the custom PHP textarea that `return $page->manufacturer->children();` would work but it doesn't.
  2. Hi Guys, Just finished a website locally and wanted to upload it on the webserver of my customer. I got a server 500 error. Now, the guidelines of the hoster (world4you.com) does not allow "Options" in the htaccess-file. So, when I uncomment these: Options -Indexes Options +FollowSymLinks the site is visible, but the content won't show and no links are available. Not sure if I need the Symlinks-part but I guess I need a workaround for the Index-part. Can anybody help here? I need the website up and running asap.... Thanks! Roli
  3. In the Doc it says: I have an options field (options_colors) configured like this: I want to have a query returning only pages with the VALUE 'red'. This is a query that works: $newsentries = $pages->find('template=news-entry,options_colors=number1,sort=-created,limit=16'); this is a query which does not work $newsentries = $pages->find('template=news-entry,options_colors=red,sort=-created,limit=16'); How do I query for 'red' instead of the title for the value?
  4. Hi! this should be easy, but I can't get it to work. I have a repeater with events. Every event has an option-field with multiple checkboxes. To filter the events on the frontend I have a script, that uses the class names to filter the results (an event can have multiple categories). Now I just want to add every checked option (title) to use as my class name. This is what I have so far, wich only gets the first title. foreach($page->events as $event) { $tags = $event->options->title; echo "<div class='size1of2 {$tags}'>"; echo "<img src='{$event->image->url}'>"; echo "{$event->text_editor}"; echo "</div>"; } I know there is an example with a foreach, but how would I use it in this context? foreach($page->countries as $country) { echo "<li>$country->title</li>"; }
  5. hey there, i'm using processwire for the first time, so maybe it's a dumb question. but i'm trying to have an options field which values are the users of the processwire. i don't need the values to be displayed, it's just for the administration of the page. but each time a new user is created / a user is deleted the options field should be updated automatically. is something like that possible?
  6. Hi all, first time poster on the forums but long-time user of Processwire. I couldn't find this exact problem in the forums and I'm hoping it's just something simple I'm missing (first day back from vacation so I am a little brain dead). I have a Select Options Field Type where the client can choose an array of numbers. If nothing is chosen, nothing is outputted onto the page. This works for most pages using this specific template. However, on just one page where I have the field set to blank, I am finding it is still outputting "0", when it actually shouldn't be outputting anything. My code: <?php if($page->percent_leased->has('id!=0')){ ?> <h2><?=$page->percent_leased->title?>% Leased</h2> <?php } ?> On this specific page, it is outputting "0% Leased". It's also doing something kind of weird in the database under the percent_leased field type. It's repeating the same ID of the specific problem page twice (page ID 1086) when I set it to blank. It works fine if I actually choose a number and the duplicate goes away. I've never really delved deep into the databases so maybe this is normal? The weird thing is is that this is working fine on all other pages using this template. It's just this one page acting weird. FWIW, this particular site is running version 2.6.1. Thanks for reading!
  7. Hi, I have multiple Options fields on a certain page. On an overview page I like to add a filter, which display`s all the distinct value`s of the optionfield, but only the once that are in use. As an addition I would like to have the amount of times this specific value is in use. So: Given the following: 1=ABC 2=DEF 3=FOO 4=BAR I have for examples 5 pages were Page 1 uses 1 Page 2 uses 1 Page 3 uses 2 Page 4 uses 4 Page 5 uses 4 So on the overviewpage I like to have an overview with (note the 3=FOO is not displayed): Options: ABC (1) DEF (1) BAR (2) I know in the API there is a possibility to use $all_options = $field->type->getOptions($field); But I would need the $all_inuse_options ;-) Next to that It would be a nice to have to add the count.
  8. This is in my module's install() function: $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_template")->set("label", "Template"); $f->option_table = "templates"; $f->option_value = "id"; $f->option_label = "name"; //$f->filter('id not in (2,3,4,5)'); $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); // set to select from template's allowed parents $f->type = wire('modules')->get('FieldtypePage'); $f->set("name", "iu_parent")->set("label", "Parent"); $f->set("derefAsPage",1)->set("required",1); $f->set("findPagesSelector","template!=admin,hasParent!=2"); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeOptions'); $f->inputfieldClass = 'InputfieldCheckboxes'; $f->set("name", "iu_actions")->set("label", "Action(s)"); $f->options = ["import" => "Import", "update" => "Update"]; $f->set("tags", "-impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeOptions'); $f->set("name", "iu_uid")->set("label", "Match Field"); $f->description = "Values must be unique."; $options = array(); foreach(wire('fields') as $opt) { $options["{$opt->name}"] = "{$opt->title}"; } $f->options = $options; $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); Oddly every time I install the module the second field `iu_parent` says it still needs configuring, without fail; I have to go to the field editor and just save it as it is one time. Anyway the real field in question here is the last, i.e., `iu_uid`. That method of adding options is entirely ineffective, sadly; it adds none at all. What I need is for it to dynamically populate with the fields in the previously selected template's fieldgroup on saveReady. This is possible with page fields, to dynamically populate options based on another field's value. Alternatively I can set up `iu_uid` like so: $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_uid")->set("label", "Match Field"); $f->description = "Values must be unique."; $f->option_table = "fields"; $f->option_value = "id"; $f->option_label = "name"; $f->set("required",1); $f->set("tags", "-impupd")->set("columnWidth",50)->save(); Then I would just need for a hook to filter the options to correspond with the `iu_template` value. Any pro tips/guidance to spare on this subject?
  9. I have a checkbox with only 1 possible value called "A Project". I'm using the relatively new Options field type. I'm trying to echo some html if that checkbox is checked. I tried this if ($page->portfolio_type ) { but it always outputs my HTML even if the checkbox isn't checked. I then tried the following from the forum suggestion if ($page->portfolio_type == 1) // 1 is checked, 0 is unchecked This has no effect either so I'm wondering if I need a different approach based on the fact that I'm using the Options fieldtype rather than a standard page based options?
  10. Hi folks, I am using the Select Options module to set up up options for content within a repeater (if the image you've added wants to be full, half or quarter width) and I have setup a few options: 1=Full 2=Half 3=Quarter This all works fine in the admin end; but on the front end I am trying to determine, for each in the loop, which options was selected. I have it set up like this: <div class="col-xs-12 <?php if ($image->issue_raw_image_width === 1) : ?>col-sm-offset-1 col-sm-10<?php elseif ($image->issue_raw_image_width === 2) : ?>col-sm-6<?php elseif ($image->issue_raw_image_width === 3) : ?>col-sm-3<?php else : ?>not-working<?php endif; ?>"> However, this isn't working at all; it just echos out my test 'not-working' class. If, for each, I ask it to echo out `$image->issue_raw_image_width` then it returns the correct value. Any thoughts?
  11. I think this could be a bug. I'm using an Options field to create an array of radio fields. This field is required. Each option activates a conditional field and this works perfectly. I added a required if condition to this conditional fields, on a template level, and this is displayed correctly with the red *. But the fields are not validated and the page saves nonetheless. I figured since the red asterisk is on, I've configured the fields conditions correctly, right?
  12. How could we add a repeater-field to our module configuration pages? I tried to add it like any other input field, but no success! (Just as a sidenote: Unfortunately my php skills are really restricted) This is my current state, but it just throws an exception: Error: Exception: Unknown column 'field_title.count' in 'field list' (in wire\core\Database.php line 118) public static function getModuleConfigInputfields(array $data) { $data = array_merge(self::getDefaultData(), $data); $inputfields = new InputfieldWrapper(); ... $field = wire("fields")->get("title"); $field->type = $modules->get("FieldtypeRepeater"); $repeater = wire("modules")->get("InputfieldRepeater"); $repeater->name = "somethingUnique"; $repeater->add($field); $repeater->page = wire("page"); $inputfields->add($repeater); ... return $inputfields; } Any idea what I'm doing wrong, or how we could achive this?
  13. When working with Pageimages and one don't want to use the default options the coding possibilities should be enhanced. For example, if you are working with the default settings from site/config.php, the setting for cropping is true! If you want to limit the maxlength of mixed images (landscape and portrait) for now you have to do it like this: $img = $page->images->first(); $options = array('cropping'=>false); echo "<img src='{$img->size(500,500,$options)->url}' alt='' />"; We have to use an options array. - But I think it is more straight forward if we could call it like this: $img = $page->images->first(); echo "<img src='{$img->setCropping(false)->size(500,500)->url}' alt='' />"; If we can use these setters like they are available in ImageSizer (setCropping, setUpscaling, setQuality, setSharpening, setAutoRotation) together with Pageimages, the coding-flow feels better and also readability is better What do you think? ------ If this is found to be useful theres not much to do to achieve that. The pageimage class only needs some wrapper methods to store the individualOptions. These get merged together with the default-, config- and direct passed options. Thats all. I have tested this and here are the code snippets I use: And the complete file is here:
  14. Hey everyone, I would like to start off saying that I am sorry for posting this but I couldn't find something about this and I really need to know this ASAP. So I want to create a module where the admin can enter an API key in the module settings, how do i create that input field and more important, how and where do i save the information he admin has entered? Much appreciated and thanks in advance!
  • Create New...