Jump to content

Search the Community

Showing results for tags 'field'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hi, excuse me but I need any suggest... I want to create 1 page of my site with 200 plants, 200 description and 200 link to another page. I begin put in 1 Template 2 field-text, and I see that it appear in Field-List! If I create 200+200+200 field... I see all in tha list! BUT If I create 200 article by filed-textarea, I don't see it in Field-List! I create yet 75 article in 75 pages, but I don't see it in Field-List! What I don't understand? :/
  2. I'm confused by how Processwire should display custom fields. I have Home page set up with a field type Page (called 'blocks'), and that field has one page selected (called 'footer'), and that page contains 3 fields. The idea is that this footer page is reusable as a block on any other page, while also being fully editable in the backend (and only needing to be edited once to change on all pages). This is as close to a Drupal blocks approach as I could get. In principal, certainly from the backend, this is working fine. It's clear enough for a site editor. The issue is how to display this 'blocks' field (the page attached to it and content of fields that page contains). This system only works if I can display that field, without needing to specify or hard code the page name within the field, or fields within that page (because this may change later). The one constant will be that the 'blocks' field is always linked to selected page templates. Based on what I understand of Processwire logic, because I display the title with $page->title, I would have expected the following to work: $page->blocks or $page->fields->get('blocks') This however only returns what I presume is the field ID. I have looked through the docs, but they are light on highlighting typical uses (perhaps an example for each api element that shows how it works and why it exists in relation to backend data to frontend display, similar to the PHP manual. Something perhaps I can help with at a later date). I also think this is a type of issue can be a deal-breaker for new users because of the logic gap ($page->title outputs field content, $page->blocks outputs what might be field ID), and us newcomers can be an impatient group! So I hope solutions here will be a useful addition to the docs. After I learn how to deal with this, I'll add any info that might be useful for newcomers.
  3. I've been experimenting with field type Page, to add a page within a page (to replicate a block like system). I encountered some issues rendering the results, and while debugging and displaying the $page->fieldtypePage object I realised it was huge. I mean 1 minute to display huge. Even though in normal operation, printing out the whole object wouldn't be necessary. However I presume having an object that large must affect site performance. I won't be using this field type Page any more because I'm a bit of a fanatic for clean code and good performance. But in general, what do you think? Should this be submitted as a bug? If so, what's the correct procedure for that?
  4. I am making a aporism site. In my main page I put pepople and their apohrisms. https://cdeniz.com/kisiler/ In another page I made tags. https://cdeniz.com/konular/ Finaly i am making tag page. Related aphorisms will be together. https://cdeniz.com/konular/sevgi/ and its source: $kisiler= $pages->find("template=kisi,sort=title,repeater_ozlusoz=[ozlusoz_konusu=$page->id]"); $n=1; foreach ($kisiler as $kisi) { foreach($kisi->repeater_ozlusoz as $aforism) { $tags = ''; foreach ($aforism->ozlusoz_konusu as $tag) { $tags .= '<a href="'.$tag->url.'">'.$tag->title.'</a>&nbsp; &nbsp;'; } echo '<p>'.$n.'. <a href="'. $kisi->url .'">'.$kisi->title.'</a> : "<i>'. $aforism->ozlusoz.'</i>"<br/>&nbsp; &nbsp; Etiketler: '.$tags.' </p>'; $n=$n+1; } echo "<hr>"; } I passed very big code issues but now i can not go more. In tag the list related aphorisms come but with other aphorism which are belonging to person. Tag is "Sevgi". But second aphorism should be in the list. I could not exclude. Sorry for my english. Thank you very much for your helps
  5. Hello, I am newbee. This is my first message. I am trying to learn PW. After modx, I loved it very much. My question: I am tryin to make a site which shows people and their aforism. I made a field but just one aphorism can input. How can I add more data to a field ? This is my previous page which made with modx : https://cdeniz.com/k105/Nazim-Hikmet.html Thank you
  6. Hi there! And thanks for Processwire which i really like! Got a specific repeater-related question which i couldn't resolve. Will appreciate any help. Let's imagine we have Places (pages), Offers (pages) and Partners (PW users). Any Place can have many Offers attached to it via a repeater field. Any Partner can have many Places (repeater or a multiple-value field). He can offer some Offers at each Place he is attached to. His Offers for any Place should be selectable only from Offers already attached to this Place. Partner-Places-Offers management should be performed in admin interface via PW input fields. The ideal solution which i imagined could be a "dynamic" partner_place_offers repeater where multiple Offers for a single Place could be selected from dynamically built list dependent on selected Place. But it appears that PW doesn't have such functionality yet. Thanks in advance for giving some idea on the subject!
  7. Hello processwire community, this is my very first post, I am newbie in php - trying to test a simple search form which allow frontend user to search and filter data. Macro steps are as follow: 1) Create the form with options as checkboxes, allowing the user to choose multiple values selection within multiple checkbox groups; 2) Create the pw process code in order to revert back the selected items (as a result of multiple checkbox filter combination), allowing pagination as some results may be more than 50 items; --- Here some of the most related topics I've found over PW forum: https://processwire.com/talk/topic/7282-paging-issue-with-html-form-check-boxes/ https://processwire.com/talk/topic/3472-enable-pagination-for-search-results/#comment-38214 https://processwire.com/talk/topic/1883-how-to-use-input-whitelist-with-checkboxes-or-any-array/ https://processwire.com/talk/topic/1547-getting-multiple-checkbox-values-within-processwire/ https://processwire.com/talk/topic/1034-search-form-with-multiple-fields/ https://processwire.com/talk/topic/10193-multiselect-search/ --- Now, the html form works just fine (code below), it brings all checked values to the url string. Essentially I have four different groups of checkboxes: cb_sectors[] (multiple pages as categories); cb_expertise[] (multiple pages as categories); cb_status[] (multiple pages as categories); cb_year[] (integer). The user may select multiple values within the above four checkbox groups, thus creating even quite complex combination. <form name='search' id='search-works' method='get' role='form' action='<?php echo $pages->get('/search/')->url; ?>'> <div class="collapsible-header">Sector</div> <?php foreach($pages->get("/sectors")->children as $sec) echo " <p class='checkbox'> <input type='checkbox' name='cb_sectors[]' value='{$sec->name}' id='{$sec->name}'/> <label for='{$sec->name}'>{$sec->title}</label> </p> " ?> <div class="collapsible-header">Status</div> <?php foreach($pages->get("/taxonomy/Status")->children as $st) echo " <p class='checkbox'> <input type='checkbox' name='cb_status[]' value='{$st->name}' id='{$st->name}' /> <label for='{$st->name}'>{$st->title}</label> </p> " ?> <div class="collapsible-header no-padding">Expertise</div> <?php foreach($pages->get("/expertise")->children as $cb_expertise) $checked = $cb_expertise->name == $input->whitelist->cb_expertise ? " selected='selected' " : ''; echo " <p class='checkbox'> <input type='checkbox' name='cb_expertise[]' value='{$cb_expertise->name}' id='{$cb_expertise->name}' $checked/> <label for='{$cb_expertise->name}'>{$cb_expertise->title}</label> </p> " ?> <div class="collapsible-header no-padding">Year</div> <?php // generate a range of years from '09 to '17, or maybe better doing it via pages as years? for($year = 2009; $year <= 2017; $year += 1){ echo " <p class='checkbox'> <input type='checkbox' name='cb_year[]' value='$year' id='$year' /> <label for='$year'>{$year}</label> </p> "; } ?> <input class="no-class" type="submit" id="search-submit" name="submit" value="Search"> </form> The question is then mostly focusing on the second step, the pw process code: As some previous posts on this topic say - I should (in sequence) sanitize, whitelist and validate the results before pass them to the final output (correct me if I'm wrong). The thing is that I cannot find a way to get all values in a array and sanitize/whitelist/validate them -> some post suggest to use arraytoCSV as a way to let PW remember the filtered items while moving through pagination. Is arraytoCSV the best way to sanitize and whitelist the user input combination? The following code simply get selected values coming from the above form. As you can see, no sanitize nor whitelist nor validation is in place, as without the array the sanitizing function gives back only the last selected value (not the full combination for every group of checkboxes). Can you please help me implementing an array within the following code and the way to sanitize - whitelist - validate "get" values? I know for most of you is just as simple as drinking coffe, but would be great if you could drive me in the right direction. Thank you in advance! <?php namespace ProcessWire; if(count($input->get)) { if($input->get->cb_expertise) { foreach ($input->get->cb_expertise as $expertise) { // here we are just ensuring submitted products are in fact valid echo $expertise; } } if($input->get->cb_sectors) { foreach($input->get->cb_sectors as $sector) { // here we are just ensuring submitted products are in fact valid echo $sector; } } if($input->get->cb_status) { foreach($input->get->cb_status as $status) { // here we are just ensuring submitted products are in fact valid echo $status; } } if($input->get->cb_year) { foreach($input->get->cb_year as $year) { // here we are just ensuring submitted products are in fact valid echo $year; } } } ?>
  8. Say I have a field for an unordered list. I need to have such a list twice on the page with different list items. Ideally I would create one field that can take html and only allows for <ul> and <li>. I can add the field to another template. But it seems I can't add that field twice to a template or am I missing something?
  9. Hi all, Currently I'm developing a new feature for my module ImportPagesPrestashop. This module imports your categories, products and more from a prestashop database and implement that data in ProcessWire pages. I've made the following structure for this: Products (Parent Page which the user has to choose) Categories (implemented from the database) Products (Implemented from the database) And inside of the product pages several fields for the specifications of the products, description, images and more. So I've build a check inside of my module which doesn't allow you to first import the images and then the products or in another way, but you have to follow this route: Categories Products Specifications Images This is because the products require a category as their parent page and the specifications and images need a product page. Now I want to remove the check if you used this module before, so all pages you need are already there, you only need to update the pages. That's why I have done the following: $parent = $this->parent; if (!$parent->hasChildren()) { //if parent has no children, module isn't used before // set ranking in import // my code } if ($parent->hasChildren()){ //module is used before, so parent has children //no ranking in import, any button can be clicked. No specific path required. //my code } So far so good. It works and I was happy with it, until I tried to import the images of the products. I encountered a error which says this: Error: Call to a member function add() on a non-object (line 986 of / etc etc) So I was like huh, why doesn't this work. I will explain how I perform the import of the images. If the button is clicked, another function is called: if ($this->input->post->importimg) { return $this->processForm51($form); } so function ProcessForm 51 is called, below you can see this function: protected function processForm51(inputfieldForm $form){ ///... some code $this->ImportImages(); //Function is called which performs the import of the images return $this->processFormMarkupImg($imgImported); //return after the import } This function links to the function that performs the import: protected function importImages(){ // some code to get the images and store it in $pictures $pagesWithImages = wire("pages")->find("images_product.count>0"); //find pages with that field for the images foreach ($pagesWithImages as $product_page) { $product_page->images_product->removeAll(); // remove existing images $product_page->save(); } foreach ($pictures as $picture) { $id_product = $picture['id_product']; $product_pages = wire("pages")->get("productid=$id_product"); //get the correct page so the images are placed in the correct product page // ensure output formatting is off $product_pages->of(false); $str_prlink = $picture['product_name']; //make sure end of string ends with alphanumeric $image_name = preg_replace('/[^a-z0-9]+\Z/i', '', $str_prlink); $image_url = $picture['file_id'] . "/" . $image_name . '.jpg'; $image_path = "http://www.website/" . $image_url; try { $imgfield = $product_pages->images_product; $imgfield->add($image_path); //add the images to the field } catch (Exception $e) { } $product_pages->save(); } } This should work because when I perfom this import WITH the ranking in import (first categories, 2nd products etc) it works! I don't get it why this gives an error WITHOUT the ranking in import. So that's why I am asking it over here, hopefully anyone knows how to solve this. Thanks in advance, ~Harmen
  10. At page editor level I need to place a piece of code which is unique to that page. This is the code: <healcode-widget data-type="class_lists" data-widget-partner="mb" data-widget-id="xxxxxxxx" data-widget-version="0.1"></healcode-widget> This code pulls in data from a third-party site. The Body Field won't accept this code. I could place this in the template file but for that I'd have to crate a separate template file for each page. I'd rather use a common "basic_page" template file for most pages. Also, I would like to give the client the ability to change/edit code when necessary if it is at page editor level. Is there any way to achieve this? Thanks.
  11. Hi I'm now understanding the basic of PW but for this one, I have no idea where to begin. I have 2 pages : publication and member. I want to add publications (automatically as I created them) to its member. Since I have hundred of publications, I want to create them using csv import. I used a specialised software to export them in the way I want. The format would be Name LastName1, Name LastName2 (2016) Title. Journal. Vol:Number. Url. I have variable numbers of authors by publication. My member's template have the title containing "Name LastName" and have a pageField "publi". How I can achieve that? I read in the forums I could assign page to a field via hooks. But I'm not sure what I should do. Also a more design question, do I should create all authors as unique fields? How I can create the good number of those fields? Or can I just create 1 author field in publi's template and search inside this value? Also for the others fields, do I should create them individually if I want to output this specific markup (italic, bold)? Hope it is clear... Thanks Mel
  12. Hello! We are currently using ProcessWire 2.7.2 for one of our sites and we're having a bit of a problem with an Image field. The field is configured to display images using the "Rows" view, display thumbnails in page editor and it has a maximum of 1 allowed file. However, when the field is rendered within a Repeater item, it defaults to the "Grid" view, completely ignoring that I had selected the "Rows" view while configuring the field. I feel that this is bad UX for the user, because if he/she wants to use the little trash can icon to delete the uploaded image, the user *needs* to know that he/she has to click the View Toggle icon first, in order to get to the "Rows" view. I want "Rows" view to be the default, so the user immediately sees the trash can icon once an image is uploaded. What do you think?
  13. Hello, I want to put some data in a table field, but if I put the label of the first table field, it gives an error: Item 'feature' set to TableRows is not an allowed type Here is my code: foreach ($fetchAll as $fetch => $feature) { $productid = $feature["id_product"]; $pages = wire("pages")->get("productid=$productid"); $pages->of(false); // ensure output formatting is off $pages->Specification->feature = ($feature['name']); $pages->Specification->value = ($feature['value']); $pages->save(); } I tried to give the label other names, but it still doesn't work. How can this be solved?
  14. Hi everybody! As I may have already wrote, I really like processwire. After a short time of not knowing whether this thing is really able to get everything going (= bigger more complex sites), this slowly kicks of. Coming from MODx processwire really is a treat - and a lot faster! So now: I just tried adding a new field which I named "book_exhibit_year" used the type "Datetime" and tried setting the "Date/Time Output Format Code" to "Y" (year with four digits) and also did the same with "Date Input Format Code". My customer wants to add his own "books" as child pages and requires them to have them sorted by exhibition year. To make it as easy as possible I want him/her to be ONLY to enter years - not whole datetimes... I also thought about just using a simple "text", but then I maybe not able to sort all child pages based on the year (?). Long story short: using only "Y" (see above) will not save anything. If I enter "2014" it will always reset to "1970". I suppose the datetime expects "good" (whole) dates... I'm out of ideas right now. Maybe using a text field and then converting the value to a datetime object? Thanks!
  15. Hi folks, I have a production site which has been fine for the first few months but the client is now experiencing an issue with uploading further images to a repeater field. I've replicated the problem myself and get the same result. They have uploaded the first 9 items but can't upload the 10th and beyond. The repeater field uses an image uploader then two text fields for each item to form an image gallery. We have 9 items uploaded with no problem but when we try and a 10th (and 11th etc.) the image gets uploaded OK on editing but when we go to save the page (and the admin page refreshes) the the image is gone leaving just the text fields populated and the text 'No file chosen' next to the image upload button. One thing I have noticed when looking at the site/assets/files directory folder is the last image that loaded OK is at ID 1091 and there are already folders at IDs 1092, 1093 etc. I'm not sure how PW issues new IDs but I thought it might be related. I've used repeaters for these things before (up to 43 items on one site...) but I'm foxed by it here. Host: Fasthosts Ignite PW: 2.7.2 Can anyone give me guidance or has anyone seen this on their own sites? Thanks!
  16. Ill try to explain this as best I can. I am making a site map and using the following: foreach($page->sitemap as $site) { $out = "\n<url>"; $out .= "\n\t<loc>" . $site->httpUrl . "</loc>"; $out .= "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>"; $out .= "\n</url>"; echo $out; } This works perfectly and the url displays as http://sitename.com/data/datasetone/page-one . I was wondering for the sake of this question, is there a way to only pull from /page-one in the url? I know $site->url would give me data/datasetone/page-one, but I really need just the page name
  17. I have a module that creates a repeater field on install: $f = new Field(); $f->type = wire('modules')->get('FieldtypeFieldsetTabOpen'); $f->set("name", "iu_maptab")->set("label", "Mapping"); $f->set("tags", "impupd")->save(); $r = new Field(); $rName = "iu_map"; $r->type = wire('modules')->get('FieldtypeRepeater'); $r->set("name", $rName)->set("label", "Map Fields"); $r->set("tags", "impupd")->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeSelectExtOption'); $f->set("name", "iu_field")->set("label", "Template Field"); $f->option_table = "fields"; $f->option_value = "id"; $f->option_label = "name"; $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeText'); $f->set("name", "iu_value")->set("label", "Source Value Selector"); $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeCheckbox'); $f->set("name", "iu_static")->set("label", "Use Static Value"); $f->set("tags", "impupd")->set("columnWidth",50)->save(); $f = new Field(); $f->type = wire('modules')->get('FieldtypeFieldsetClose'); $f->set("name", "iu_maptab_close");//->set("label", "Mapping"); $f->set("tags", "impupd")->save(); $rfg = new Fieldgroup(); $rfg->name = "repeater_{$rName}"; $rFields = ["iu_field", "iu_value", "iu_static"]; foreach($rFields as $rf) { $rfg->append($this->fields->get($rf)); } $rfg->save(); $rt = new Template(); $rt->name = "repeater_$rName"; $rt->flags = 8; $rt->noChildren = 1; $rt->noParents = 1; $rt->noGlobal = 1; $rt->slashUrls = 1; $rt->fieldgroup = $rfg; $rt->save(); $rpg = "for-field-{$r->id}"; $r->parent_id = $this->pages->get("name=$rpg")->id; $r->template_id = $rt->id; $r->repeaterReadyItems = 3; foreach($rfields as $rf) { $r->repeaterFields = $this->fields->get($rf); } $r->save(); Now I can't uninstall it, on account of a field being used in the fieldgroup created for the repeater -- can't delete that field because it's in the fieldgroup which I am trying and failing to delete: $rf = wire('fields')->get('iu_map'); $rt = wire('templates')->get('repeater_iu_map'); $rfg = $rt->fieldgroup; if($rf) { wire('fields')->delete($rf); wire('fieldgroups')->delete($rfg); wire('templates')->delete($rt); } foreach(wire('fields')->find("tags*=impupd") as $f) { wire('fields')->delete($f); } Please help this is such a bother. The fieldgroup should be deleted before attempting to delete the field itself.
  18. Hey, I've searched for this and I couldn't find it, what i want to do is check if a page (object) already is in a PageArray field? Ofcourse i can go through it with a loop but if theres already a method to do this then i dont want to re invent the wheel.
  19. Working with a multi-language site. I have a field 'province' with the list of provinces in Options in English and in French tab. The field is selectable in the 'municipality_page' template as a dropdown box. I have an Ajax call to retrieve the choice of the province to list the municipalities of that province. Everything works well in English, however, I am having an issue with the French, I don't know if it is because the French provinces uses accents and dashes in them. I was able to make it work for 9 out of 12 provinces with the following code. $province = $_GET['prov']; if(strpos($province, "-") !== false){ $choice = str_replace("-", "|", $province); } else { $choice = $province; } $entries = $wire->pages->find("template=municipality_page, province%=$choice"); Just can't figure out how to get 'Colombie-Britannique', 'Nouvelle-Écosse' and 'Territoires du Nord-Ouest' to be found. I tried manually with the code below, but it didn't even worked. It also doesn't seemed to be a typo in the field. $entries = $wire->pages->find("template=municipality_page, province%=Colombie-Britannique"); What is missing in the code to be able to find those 3 provinces?
  20. Hi Folks, I've got a site with some contact and quote forms which get sent to my client and get saved as pages so the client has a record of the submitted forms. He'd like to analyse some of the form data. So for instance, there's a field that asks 'where did you hear about us?' with select options like 'Advertisement', 'Google', 'Recommendation', 'Magazine', etc. I'd like provide a page so the client could see how many respondents chose 'Google' vs 'Advertisement', etc. A simple tally would be fine, but then I could calculate percentages, maybe chart the results, etc. My first thought was to use $pages->count('selector') to count the pages with a certain answer. I'd know what percentage that was by comparing it to the total of saved pages for that form. But would I need to do this for each question? Is there a better way to tally/count all the answers for a given field?
  21. Should the "New page from inputfield" option work on PW v3? Cause it doesn't seem to work for me. I have this tree for adding taxonomies and terms: Taxonomies > Taxonomy > Terms (these are templates with only the title field). Then i have a field tags of type page with parent Tags (taxonomy template), template set to terms , label is title(default) and input field type asmselect. Taxonomies > Tags > tag1, tag2, tag3 The asmselect field is displayed on the page and populated with the tags but i don't have the option to create a new term. I hope you understand my jumble.
  22. Hello, I am developing an Inputfield Module for a Page Field that has the user interact with a modified InputfieldSelector. I have added buttons on InputfieldSelector to modify a hidden HTML textfield that I have appended to the module rendering. I would like to save the textfield's contents to the database. My question is, how would I do that, given that the module is of type Page? Let me know if clarification is needed. Thanks.
  23. Hi there, I noticed, that one can easily import images from other pages into a textarea field in the backend, while the images field only allows for upload from the local machine. Correct me if i am wrong. Is there a possibility to copy images from another page, e.g. a special image repository page, into an image - type field from the backend, for the average page editor? Thanks for your thoughts.
  24. How do I get the output of a field that is a FieldTypePage? I've tried echo $page->first_name . " "; but it just prints numbers instead of picking data from that page it's referencing to. Couldn't find any info on how to use this module/field either.
  25. I used a repeater field on my site to handle arrest reports. (It's much easier for the user than say adding a new entry for each person arrested as you would a new page). Basically, my client creates a new entry with the arrest report section then starts adding repeater "records" and data which include: name dob offense mugshot ... repeat the above for each offender This is a small county newspaper and we rarely have over 100 arrests listed per report. I noticed when about 60 repeaters are added after that I get a server timeout when trying to edit the page. I bumped up max_execution_time to 90 seconds and I get a 500 error. When I set max_execution_time to 60 seconds it loads -- but that is really pushing it. It was my belief that the Repeater field type could handle lots of repeaters, with the exception of getting into say a thousand or more, but 60-70? This may take care of it for this project, but, I'm thinking about future projects. I noticed that ProFields has a Table field type and watched the video, however, I didn't see any option of adding an image field in there. Is that possible? This would allow for fast entry of data with the addition of an image for each record. Any other suggestions are appreciated. thanks.
×
×
  • Create New...