Jump to content

Search the Community

Showing results for tags 'fields'.

  • 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







  1. Hello guys. I am new to ProcessWire and I'm dealing now with the next: I need an image array with three properties: the image itself description and the image title ProcessWire by deafult provides me everything but the title. So I'm wondering what would be the right way to add the title property?
  2. Hello, I would like to find all fields that are multi-language. My code $langFields = new FieldsArray; foreach ($fields as $f) { if($f->type instanceof FieldtypePageTitleLanguage || $f->type instanceof FieldtypeTextareaLanguage || $f->type instanceof FieldtypeTextLanguage) { $langFields->add($f); } } Is there a more generic way of how I can determine whether a field is multi language, other than checking "$f->type instanceof" for all three fieldtypes?
  3. Instead of creating a field one by one, is there any way to create multiples at the same time? For instance, if I wanted 3 text fields, it would be so awesome if I could type 3 comma separated names, labels and descriptions thus reducing time and increasing efficiency. I would love this feature!
  4. Hey guys, I'm trying to build a submit form with the ProcessWire API. After the form is submitted its data should be saved into different pages. I've followed Soma's great tutorial and wanted to improve it for my use case: Instead of adding every field manually to the form I already managed to automatically read out the fields that belong to a specific template like this: // Build form $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'$page->name'); // Build fieldset $fieldset = $modules->get('InputfieldFieldset'); $fieldset->label = 'Personal Data'; // Read out template fields and append them to the fieldset $registration = $templates->get("registration"); foreach ( $registration->fields as $field ) { $field = $field->getInputfield($page); $fieldset->append($field); } $form->append($fieldset); // more fieldsets... // Submit $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Anmelden"); $submit->attr("id+name","submit"); $form->append($submit); This seems to work great – with just one little restriction: Instead of the global field labels I would love to get the template specific settings for each field (defined within the template). E.g. in this template I'm using a body-Field not labeled as "Body" but as "Description". Same would be great for things like field's columnWidth, required properties and Co. Is this possible? Thanks a lot for your help! Nik
  5. Hi, Having ploblems with this search page code. I'm trying to get all images with tagged with the search query, which works currently. Then get a url and add <a> wrapping the image to a page that references that image in its image_select field - doesnt work. if($input->get->q) { $q = $sanitizer->selectorValue($input->get->q); $input->whitelist('q', $q); } $matches = $pages->find("imageTags.title%=$q, limit=20"); if(count($matches)) { $out .= "<ul class='grid-list'>"; foreach($matches as $m){ // $name = $m->image->name; // $out = $name; // $mWork = $pages->find("image_select=$name, limit=1"); // var_dump($mWork); $out .= "<li>"; // $out .= "<a class='' href='{$mWork->url}'>"; $image = $m->image; $image = $image->width(450); if($image) $out .= "<img src='$image->url'>"; // echo "</a>"; echo "</li>"; } $out .= "</ul>"; }
  6. I have some functionality on an intranet site that uses Lazy Cron to query an external API and then update a bunch of pages based on the API response. A problem I've noticed is that this breaks our author / editor tracking – whenever a user triggers the Lazy Cron job, the page metadata for `$page->modified` and `$page->modifiedUser` is (naturally) updated, so it now looks like that user edited the page at that moment in time, even if the content of the page was edited months ago by someone else. It seems like the ideal solution here would be to somehow exempt certain fields (the ones that get updated by this external API) from triggering a timestamp update... Any ideas on how I'd go about hooking into that?
  7. Why is field greyed out in add field?
  8. I have a contact form that feeds to a engine.php. However when I go to fill it out, I get a 403 error )permission denied. I am using mamp, so maybe it is an issue with this. However, I was wondering if anyone else had run into this problem before. I have the url to the .php file using " <?php echo $config->urls->templates?>form/
  9. Hello everyone i gotta simple problem everytime after refreshing my backend, the fields that i have closed before are still opened (For example the repeater). is there a (maybe localstorage) functionality which remembers the action in relation to the open/close activity?
  10. I'd like to use the API to get all fields that are tagged with XXX. I can't find anywhere that tells me what selectors can be can used with $fields. I suspect this isn't possible? I've realised a way to work around this - just get all the fields, and then filter them by prefix of name. But it wouldn't be quite as neat.
  11. Hello - Total newbie here. I'm using the Profields module to make a table for settings. I would like for one row to contain a "copyright date" with a corresponding integer value according to https://processwire.com/talk/topic/8373-use-delimited-texarea-table-or-yaml-for-settings/ I have this code (courtesy of @Macrura) $copyYear = 2015; // Set your website start date $curYear = date('Y'); // Keeps the second year updated echo $copyYear . (($copyYear != $curYear) ? '-' . $curYear : ''); I want to set the value for $copyYear in a text field. Will it be parsed as an integer? Thanks!!
  12. Hi, On a project I'm working on I have a select options field that you can select what type of content you're posting. It has the following options: 1=Article 2=Q and A 3=Visual snippet 4=Gallery 5=List The assigned template has an icon (file-text-o), which is great for articles but maybe not so for galleries. Is it at all feasible/possible to change the assigned icon based on a field value within a page? Or even append a page title in the tree with an icon based on a field value?
  13. I am creating a custom search routine. This code of Ryan has been very useful to encompass all fields of the page. foreach($page->fields as $field) {echo "<p>"; echo "Field: {$field->name}<br />"; echo "Type: {$field->type}<br />"; echo "Value: " . $page->get($field->name); echo "</p>"; } But I failed to get the subfields of repeater's field type. It may be something simple, but I have several hours trying with unsuccessfully options. Any suggestions?
  14. Currently there is no way for an editor to change those fields. Both are static. Even from the API. But sometimes – especially when using a news site or some kind of blog – you have to use those fields a lot. It would be nice if the fields become editable, so you can change the creation date for example.
  15. Hello everyone, Been working rough 5-6 months with this beast and i gotta tell you that it's almost perfect Of course every software has it's ups and downs, just like life does and nothing is perfect or meant for everyone, but here we go... I think database structure is about correct and flexible enough, what i don't like is that i can have similar field with 3x different prefix just because i need different control data for that same field. How about if template would control fields data instead of field? Field could have it's own control data as default, but i would really like to see that template could at least control some data, like visibility, appearance, required, stuff like this. Why? Because past 5-6 months i faced fact that for example when i need to custom admin interface for some template i would like to use same field over and over again, but it's kind of impossible when width can be 50%, 33% or 100% for different templates, data how ever is very same. Feels so stupid to create field over and over again, when it could use existing database tables. You already have control tables for fields and data tables separated, which is good model, so how big deal would this to be to implement something like this? If this already exists and i'm blind, lemme know and i'll buy you beer I hope i'm not the only one feeling like this, cheers for listening
  16. Oleg


    Hi! How to print the value of $ fields from one template in another template?
  17. Hi guys, As the title tries to explain, I have created custom fields for users on the backend like images, job title, description etc. and that works fine if you have access as a user to the 'user-admin' role but if I give team members this role if means they can access each others profile settings and update passwords. I would like to show the fields that have been created for users under the profile page so that the users can update their custom fields. Is this possible from the back end easily? Hope that makes sense. Any help would be greatly appreciated! Cheers
  18. Hello all, First time poster here. I've been playing around with ProcessWire for some time and am currently in the middle of my first project based entirely on PW. I have a problem with the field type drop-down list in the "Add new field" tab. All of the sudden it's blank. Am I missing something, or is this an error? It looks like this, no field types, nothing. I didn't even modify any particular settings in the meantime. Half an hour ago it was working just fine. Thanks in advance for any help.
  19. Hi Guys, I have just started to experiment with Processwire and really like what I see so far. I am hoping to try my first production site on it soon. I have long been a wordpress user, but want something new and more efficient. I am wondering if there is a module/feature similar to this for wordpress: http://www.wpallimport.com/ it's a full XML importer where you can import to create new pages (posts on wordpress) and map parts of each entry to certain fields of each page. Is this possible for Processwire? I use this with the advacned custom field plugin on wordpress to great effect. Each time the plugin is run, it will update the posts if they have already been created, and add new ones for new entries in the XML feed. I've seen this module, but does it work with the latest version, and could it work with what I need: http://modules.processwire.com/modules/process-data-import/ If anyone can point me in the right direction I would appreciate it. Thanks, Aaron
  20. The field is empty, the template has over 2 million pages. So of course caution is necessary... I can't try anything too crazy. When I try to delete the field in admin area, as soon as I click on the confirmation checkbox and submit, it goes straightaway (fraction of a second) to a Bad Gateway 502 (nginx) error page. I also tried the API solution outlined by kongondo here: https://processwire.com/talk/topic/7480-removing-a-field-from-database/?p=72039 - it does not work, the script just stops running (again very quickly) at the save() part. Also tried deleting from the $fieldgroups api variable instead of from $templates. Same issue. Here is what I am getting from debug=true: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /www/wire/core/PageFinder.php on line 306 Call Stack: 0.0000 242496 1. {main}()/www/index.php:0 0.0663 4512544 2. ProcessPageView->execute()/www/index.php:240 0.0663 4512896 3. Wire->__call()/www/index.php:240 0.0663 4512896 4. Wire->runHooks()/www/wire/core/Wire.php:320 0.0663 4515024 5. call_user_func_array:{www/wire/core/Wire.php:365}()/www/wire/core/Wire.php:365 0.0663 4515360 6. ProcessPageView->___execute()/www/wire/core/Wire.php:365 0.0721 4647600 7. Page->render()/www/wire/modules/Process/ProcessPageView.module:172 0.0721 4647784 8. Wire->__call()/www/wire/modules/Process/ProcessPageView.module:172 0.0721 4647784 9. Wire->runHooks()/www/wire/core/Wire.php:320 0.0722 4652776 10. PageRender->renderPage()/www/wire/core/Wire.php:387 0.0722 4653128 11. Wire->__call()/www/wire/core/Wire.php:387 0.0722 4653128 12. Wire->runHooks()/www/wire/core/Wire.php:320 0.0722 4655256 13. call_user_func_array:{www/wire/core/Wire.php:365}()/www/wire/core/Wire.php:365 0.0722 4655592 14. PageRender->___renderPage()/www/wire/core/Wire.php:365 0.0726 4696624 15. TemplateFile->render()/www/wire/modules/PageRender.module:356 0.0726 4696808 16. Wire->__call()/www/wire/modules/PageRender.module:356 0.0726 4696808 17. Wire->runHooks()/www/wire/core/Wire.php:320 0.0726 4698936 18. call_user_func_array:{www/wire/core/Wire.php:365}()/www/wire/core/Wire.php:365 0.0726 4699104 19. TemplateFile->___render()/www/wire/core/Wire.php:365 0.0727 4723816 20. require('/www/site/templates/delete.php')/www/wire/core/TemplateFile.php:169 0.0742 4726296 21. Fieldgroups->save()/www/site/templates/delete.php:14 0.0742 4726648 22. Wire->__call()/www/site/templates/delete.php:14 0.0742 4726648 23. Wire->runHooks()/www/wire/core/Wire.php:320 0.0742 4728464 24. call_user_func_array:{www/wire/core/Wire.php:365}()/www/wire/core/Wire.php:365 0.0742 4728800 25. Fieldgroups->___save()/www/wire/core/Wire.php:365 0.0745 4733760 26. FieldtypeInteger->deleteTemplateField()/www/wire/core/Fieldgroups.php:196 0.0745 4734200 27. Wire->__call()/www/wire/core/Fieldgroups.php:196 0.0745 4734200 28. Wire->runHooks()/www/wire/core/Wire.php:320 0.0745 4736336 29. call_user_func_array:{www/wire/core/Wire.php:365}()/www/wire/core/Wire.php:365 0.0745 4736760 30. Fieldtype->___deleteTemplateField()/www/wire/core/Wire.php:365 0.0745 4737192 31. Fields->deleteFieldDataByTemplate()/www/wire/core/Fieldtype.php:878 0.0745 4737632 32. Wire->__call()/www/wire/core/Fieldtype.php:878 0.0746 4737632 33. Wire->runHooks()/www/wire/core/Wire.php:320 0.0746 4739464 34. call_user_func_array:{www/wire/core/Wire.php:365}()/www/wire/core/Wire.php:365 0.0746 4739888 35. Fields->___deleteFieldDataByTemplate()/www/wire/core/Wire.php:365 0.0754 4743128 36. Pages->find()/www/wire/core/Fields.php:536 0.0754 4743480 37. Wire->__call()/www/wire/core/Fields.php:536 0.0754 4743480 38. Wire->runHooks()/www/wire/core/Wire.php:320 0.0754 4745344 39. call_user_func_array:{www/wire/core/Wire.php:365}()/www/wire/core/Wire.php:365 0.0754 4745680 40. Pages->___find()/www/wire/core/Wire.php:365 0.0758 4749608 41. PageFinder->find()/www/wire/core/Pages.php:199 0.0758 4750048 42. Wire->__call()/www/wire/core/Pages.php:199 0.0758 4750048 43. Wire->runHooks()/www/wire/core/Wire.php:320 0.0758 4751864 44. call_user_func_array:{www/wire/core/Wire.php:365}()/www/wire/core/Wire.php:365 0.0758 4752288 45. PageFinder->___find()/www/wire/core/Wire.php:365 Hope this is enough information for one of you seasoned folks to help me out.Thanks in advance!
  21. Hello all! I'm Andrea and I'm new in PW world. Lovely place, i like it! It's the perfect hook between cms and framework! But now, we come to the question. - It's possible to duplicate (throught .append() jquery method) the form section in backend admin panel? (i.e. http://tristandenyer.com/using-jquery-to-duplicate-a-section-of-a-form-maintaining-accessibility/) I created a form backend, allowing the user to enter information, but I would like to duplicate a section (the section name products). - is there the possibility of generating a .jpg or .pdf from a php page? Sorry for my bad english guys !
  22. I am looking to create a multiselect field that allows a user to select some PicasaWebAlbums on the admin side of PW. I know how to get the PicasaWebAlbums list and all, but it requires PHP. I also know how to make a multiselect field the Page input type and defining which parent holds the select options, etc. What I do not know is how I can create a custom multiselect field that is generated via PHP. For example: I have a list of albums from PHP (these are not actually what I have but you get the point): - id: 1000, title: Album 1000 - id: 1004, title: Album 1004 - id: 1008, title: Album 1008 - id: 1005, title: Album 1005 - id: 1003, title: Album 1003 How do I make a multiselect field where the options are: <option value="1000">Album 1000</option> ... etc ... Is this possible? Do I have to make a module? Point me in the right direction
  23. My vessel template has a price field (actually field group: with price_currency, price_amount). But when the price is lowered, the listing should qualify to appear on a "Price Cuts" page automatically... so here's what I'm doing (or skip to the bottom): So I was thinking I could add another couple of read-only fields, price_amount_was (since it's unlikely that the currency would change) and price_cut_date. price_amount_was would default to the set price once one is set on save (starts empty, stays empty until a price is set and the page saved). price_cut_date would be null by default. Then another hook after page save would check if the price_amount is lower than price_amount_was, and if so, change the price_cut_date to the current day. Then my Price Cuts page could just show "template=vessel, limit=10, price_cut_date!='', sort=-price_cut_date". But if I wanted to keep a history of price cuts for each listing, that wouldn't work. I could use a repeater field but I don't think that's all that necessary, since only the current and last price (or I guess that'd be second-to-last, last is current) need be queryable. I could add another read-only textarea field, price_history, and on every save that the price is changed, append the price and date (comma-separated, followed by a newline). So that's what I'm trying to do now, but I don't know how to append to price_history. In my module init I hook after page save, this function: protected function setPriceHistory($event) { $page = $event->arguments('page'); if($page->template != 'vessel') return; if($page->price_amount) { //$this->message("Price exists"); if(!$page->price_amount_hold) { $page->set("price_amount_hold", $page->price_amount)->save(); // append price_amount, date(), newline to price_history $this->message("Updated hold price to current price."); } if($page->price_amount < $page->price_amount_hold) { $page->set("price_amount_was", $page->price_amount_hold)->set("price_amount_hold", $page->price_amount)->set("price_cut_date", wireDate('Y-m-d'))->save(); $this->message("Price Cut set on {$page->price_cut_date}."); } } } So you see that commented out line in if(!$page->price_amount_was){}... I could set the value, but I don't want to reset it, just add to it. Thanks.
  24. public function init() { // add a hook after each page is saved $this->pages->addHookAfter('saved', $this, 'populateDefaults'); } /** * Populates model defaults after save for corresponding blank fields. * */ public function populateDefaults($event) { $page = $event->arguments('page'); if($page->template != 'vessel') return; //$this->message("hi {$page->model->hulls}"); if($page->model && !$page->hulls && $page->model->hulls) { $page->set("hulls", $page->model->hulls); $this->message("hi $page->hulls {$page->model->hulls}"); } } This sort of works; the message echoed is "hi 1082 1082". When I set the hulls to null in the above code, it then goes back to "hi 1082". However, it doesn't update the select input in the edit screen, and the "Missing required value" error for that field remains... Also the message shouldn't even be showing if $page->hulls is set... How can I get it to update the field value and the input?
  25. I have a page field 'make', which consists of manufacturer template pages. A new page can be created from that field, but I currently have that functionality disabled, since following that field is another page field 'model' with a custom selector, 'parent=page.make, template=model'. So since the model field parent is dynamic, new pages cannot be created from the field, as the first requirement for that feature is that a single parent and template be pre-selected... Is there some way I can hook into the options there and add an 'Add New' option at the bottom, opening up the new model in a modal? Thanks.
  • Create New...