Jump to content

Search the Community

Showing results for tags 'fields'.

  • 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 Guys, I recently have received a client who has various page layouts. I wanted to give them the ability to simply add their HTML into a body field with CKEditor to allow HTML customization. However, the client isn't very familiar with HTML. This has left me to build a template that has multiple of the similar field types. The thing is, I cannot use the repeater since I cannot repeat lets say an image for repeated item 1 and only body field for repeater item 2. Therefore, I have to literally add 15 fields for them to totally be able to edit the page without issues. What are your thoughts on this approach? Also, I have to name the template according to what it contains, so I was thinking of using numbers instead of words. Reason being, numbers can describe the amount of title fields, body fields and images. Therefore something like, 3-3-2.php or three-three-two.php I have never run into a situation where the client needed so many fields. I was always able to get around it with repeaters etc. Thoughts?
  2. Hello There fellow PW gurus. I am trying to make a field show as open only if the field is filled out with at string. for example: "my_styles.css" and stay hidden if the field is empty. The field in question is of type "text" if that helps. And i put in the "show this field only if" css_filename!='' because the field name is "css_filename" But no mather what the field is closed because i have choosen it as "closed" as default. What am i doing wrong? i am running PW 3.0.83 Dev.
  3. Hi guys, is there a way to declare numbers other than integer and float? My issue is that intgere is not enough for me because i'm dealing with multiple of bilions (let's say something like 111,532,372,567) Thanks, Rob
  4. Based on this forum post, I wanted to find a more elegant solution for changing a field's settings per template. Hooking the page editor after it generates the form works and may still be needed for more complex modifications. But using field & template context, it's easier to modify the field settings and it greatly reduces the need for creating an almost identical field just to adjust a few things. In my blog post, I've written on how to extend contextual options to allow any fieldtype / inputfield settings to be changed depending on the template. Hope you find it useful, and if you have any questions or comments, feel free to post them here. https://abdus.co/blog/doing-more-with-fewer-fields-in-processwire/
  5. Hello all. I know it might sound silly, but wanted to check how are you guys proceeding if in the theme development you have a need of some fields that are repeating in several templates. For example, I am having an image field that can be used as the site logo in "Settings" template or as to show the page image in the markup of the inner page template or else. I am aware, that if I leave the resizing in the markup, than the field can be used on multiple templates, but the field has some specific label/description, notes and/or placeholder that would be not-related. Sticking to the logo example, I have a label saying: Add your logo image here. So if I use the same field for something else, the same text would show while editing the new next page calling for image. How are you guys taking care of this? Are you creating specific fields for every aspect of your theme or there are some tricks I am missing in the big picture? P.S. Besides the descriptive text of the field some might require to have a single image and some an array (e.g. you don't need to upload multiple logos, unless you want to randomize or call one based on some criterias, but for a gallery - sure I would have multiple)
  6. Hi guys, let's assume I'm developing a site (custom theme with custom fields) for my customer, where he can list any articles. For example: Article1 -> item1, item2, item3, item4, etc... Each item is a textfield. Now if I want to add a new item, in this example item5, then I have to clone an existing field in the admin panel and also add this field to pagefile with PHP. If there would be 100 items, do I really have to clone an existing field and add this field to PHP code everytime? But my main question is: if my customer want's to add a new item (on the admin panel with own user), is there a way that he can clone an existing field (item) and edit the text inside and publish this field on the site, without customizing with PHP?
  7. I've been trying to figure a way to output the values of several fields within a single repeater using a foreach() without having to reference the name of the fields. Typically, for repeaters, I understand you would do foreach($repeater_field as $afield) { echo $afield->fieldname_a; } pretty straight forward. Anyways, what I'm doing is using a single repeater as just a container for other fields. I've tried using $page->my_repeater->getArray(), then looping through the array, and all sorts of methods, without luck. It seems I must specify the field name for output. For instance, my (single) repeater is set up to hold a few different fields: my_repeater field_a field_b field_c Trying to output it using something like this: foreach($page->my_repeater as $afield) { echo $afield->value; // I'm not wanting to have the reference the field name e.g. use $afield->field_a } Any suggestions?
  8. I would like to be able to fetch the labels for fields in a language different than the current logged in user. For field values that's easy // p is page, l is language, and f is field $p->getLanguageValue($l, $f); I'm looking for something like $fields->getLanguageValue('en', 'length'); The only solution I know of is to save the current user language, iterate through the languages by setting the user language and fetching the value, and then restore the user language.
  9. I have a fieldsettab I want to populate with two collapsable fields that are for display not input. One will display data directly from an extra MySQL table (corresponding with PW pages) and the other will list certain PW pages. How do I go about this? I wanted to lay them out using Dynatable, one per each field. Thanks.
  10. I have a category template and each page can be associated with multiple categories using a page field type. i have this in php : - $categories = $pages->find("template=category, limit=6"); I want to sort the results by the amount of pages each category has, is there a way to do this in a selector or is there a better way of doing this?
  11. Hey guys. Need some little help for a newbie. How can i foreach all possible values from existing field of a child template into select form? Trying like this but it showing me results from created pages and their fields. $fields = $page->find("template=item, sort=item_type"); echo "<select>"; foreach($fields as $item) { echo " <option>{$item->item_type->title}</option> "; } echo "</select>";
  12. Hi all, I got a Internal Server Error when accessing de /setup/fields in my back end... Also when i try to reach it through the page tree, i can't edit the 'fields' page, same error. I do modify a image field through the api, i don't know if that has something to do with it, below the code i use to upload an image through the api, I deleted the parts that are not important. If anyone can help me that would be great. To clarify; the code below works fine, my image and page is created as expected, the only thing is that I can't access my /setup/fields/ page in my CMS anymore due to the Internal Server Error. <?php if($input->post->submit) { $photoPage = new Page(); // create new page object $photoPage->template = 'photo'; // set template $photoPage->parent = wire('pages')->get('/foto/'); // set the parent $photoPage->name = urlBuilder($input->title_photo); // give it a name used in the url for the page $photoPage->title = $input->title_photo; // set page title (not neccessary but recommended) $photoPage->save(); // next: process photo upload // Set a temporary upload location where the submitted files are stored during form processing $upload_path = $config->paths->assets . "files/photos/"; // New wire upload $file_upload = new WireUpload('file_upload'); // References the name of the field in the HTML form that uploads the photo $file_upload->setMaxFiles(1); $file_upload->setOverwrite(true); $file_upload->setDestinationPath($upload_path); $file_upload->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); // execute upload and check for errors $files = $file_upload->execute(); // Run a count($files) test to make sure there are actually files; if so, proceed; if not, generate getErrors() if(!count($files)) { $file_upload->error("Sorry, but you need to add a photo!"); return false; } //success //echo 'photos stored';exit; $photoPage->save(); //$session->redirect($locationPage->url); } else { ?> <section class="add-location"> <div class="container"> <div class="row"> <div class="col-xs-12"> <h2>Spot toevoegen</h2> <form id="add-form" action="" enctype="multipart/form-data" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>" /> <div class="col-xs-12 col-md-6"> <label for="fileselect">Upload jouw foto:</label> <p> <input type="file" name="file_upload" id="file_upload" accept="image/*" class="inputfile" /> <label for="file_upload"> <span></span> <strong><i class="fa fa-upload" aria-hidden="true"></i> Kies je foto…</strong> </label> </p> </div> <input type="submit" name="submit" value="Upload" /> </div> </form> </div> </div> </div> </div> <?php } } include('./includes/foot.php');?>
  13. 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.
  14. mamo_length_ft is not a field. I don't see it anywhere in the database neither. Where could this possibly be stemming from?
  15. I have a module that I am using to create an image field like so: $mf[] = [[ 'tags' => $tag, 'name' => $pre.'logo', 'type' => wire('modules')->get('FieldtypeImage'), ],[ 'label' => 'Logo', 'columnWidth' => 50, 'inputfieldClass' => 'InputfieldImage', ]]; Yet upon its creation, initially, when I try creating a page of a template including it, it says that the field must first be configured. Once I go and save the field as-is, everything's honkey dory. It's just an annoyance, with every image field. I figured it would be the required inputfieldClass field field, but as you can see, that's included up in there, and it's still not good to go off the bat.
  16. Hey y'all! I've been digging through the forums trying to find a workaround for the Page AutoComplete Field. So far, no luck. Here's the problem: Currently, to use the Page AutoComplete Field, you have to define a single parent for the pages you want to select from. I want to use the AutoComplete field to add multiple pages from different parents. For instance, I have a field for location, and I want to add the MET Museum and The Louvre, but the MET has parent USA, and the Louvre has parent France. Currently, it's very labor intensive to scroll through a list of 300+ locations, or use AsmSelect to drill down. AutoComplete would be a godsend. I've not been able to find any way to workaround this issue, any ideas? Thanks for any help or recommendations! — Reed
  17. Hello guys. I am starting as a new project to work with my daughter on a cooking recipes website to use it as an initial web development learning curve (for both of us ). So far we did the main page and category listings, but now we need to find an approach for adding the ingredients. Initially I thought to add a simple TextArea field and allow to list the ingredients, quantities etc. in it, however that won't allow us to style it properly (especially if somebody else is adding recipes too). What we are trying to achieve is an ability to add ingredients one per line and then style them with a class in between <ul> & <li> (my guess guess is we need to use some php to separate every line from the rest and make it an array or else but how to easily achieve it - that is the question) Any ideas/suggestions how to accomplish that?
  18. Hello, I'm new to PW and like it already I have just created my first site with PW and need some help getting repeater posts from one page to expl. home page. I have a page called Events with template events.php . Page has a repeater field called Events_repeat. Now I would like to show last three events on a homepage, how do I do that. I have tried with: <?php foreach ( $pages->find('template=events, limit=3') as $event ):?> <div class="hovereffect"> <img src="<?=$event->images->first->url ?>" width="100%" class="img-responsive" style="border: 9px solid white;"> <div class="overlay"> <h2><?= $event->images->description->first ?></h2> </div> </div> <? endforeach; ?> But it doesn't work, what am I doing wrong. I tried to look on a forum but couldn't find anything helpful really. Thank you very much R
  19. Hi, I was just playing around with the Repeater fieldtype and wondered if this might be a good fit for something I would call a "FieldCollection". In a FieldCollection the behavior should be exactly the same as in a Repeater fieldtype where minimum and maximum items are set to "1" – just the look and feel in the backend should be slightly different. Think of templates that share two or more fields for the exact same reason – e.g. a "published from" and a "published to" date field and a checkbox. Instead of adding those three fields to every template that needs them, why not create a FieldCollection? Changing the FieldCollection will change the fields on every page it is added to. The only caveat of using a Repeater item set to min and max 1 item is its appearance in the backend: Some of the Repeater features (delete item, add new item, ...) wouldn't be needed for that particular usecase. What do you think? Many greetings! Nik
  20. I have a page which lists articles, and if there are images uploaded via the images field for that page, a thumbnail is displayed next to the article headline. However for a number of pages, I will be placing an existing image from another page in the tree into the body field. In these cases, is there anyway to check the body field's content for an image so I can display that in the article list? Logic would be: If the image field has one or more images uploaded { get first and display as thumbnail } elseif the body field has one or more images placed from another page { use the first body image as the thumbnail } else { omit thumbnail } Anything I can try that would work as shown (or is there an alternative to consider)? Thanks in advance!
  21. When you start a website from scratch and have to make both front-end and back-end of it, how do you set up your workflow? I’m a bit confused because 1) I’m new to PW 2) I’m setting up a marketplace where the vendors need to have access to the back-end, so they can manage their services/products, which will be listed in the front-end for “normal” users to buy them. More beginners' questions: What do you do first the back-end or the front-end? Is it correct to think of fields -> pages -> templates in this order? If yes/no why? Is the product page that the "normal" user see in the front-end, the same that the vendors have access in the back-end? Thanks!
  22. Hello, im porting my first static site to PW and still trying to get my head around all the options and logics..maybe you can help out. I have a simple list (ul>li) of Names on the page, which i want my client to alter at any time. Right now, the only option i see is to create a textfield with the CKEditor. Is there a more more straight foreword way to accomplish this, like creating one field in which my client can put comma separated names, and i loop through this field in the template? I tried to find something like this in the cheatsheet but im still struggling with all the options. Thanks for your help.
  23. Hi! I am building a website and it would be great to have a way to update the value of a field when other is changed. Let's explain with an example: I have a template for Books. I have a template for Authors. In the Books template I have a field called Author, with the type page, and restricted to the template books. When I insert a Book, I simply fill the Author in the field. Imagine that now I have a lot of Authors and Books inserted, and I want to link them. The easiest way is to go to the Authors and fill in the Books, so I have to edit less pages. Is there any way to to it? I have though on adding a new field on Authors called Books, so when I fill it, the author field gets updated in the Authors automátically. Is this possible? Thanks!
  24. Hi, I'm playing with my first "fields". I have accented characters : é, è,... to display. I don't really understand how to handle this. Previously I stored them html encoded in my own DB tables, example : "&eacute;v&egrave;nement" (means 'event' in french). Now I want to replace my own PDO SQL queries by PW fields. Do I need to paste html encoded content only within the fields in the admin or will it be encoded on the fly ? Until now I didn't success to view html encoded version of my data through the view source page in the browser, it's displayed as 'é', 'è', I was waiting for "&eacute;" ... I've tried CKEditor and the textarea, I've played with the markup/html - html entity encoder functions with no more success. Any idea ? Thanks
  25. Hi all. I'm creating module and it needs to create some actions in admin panel to work correct. So it would be great if somebody tell my how to do some things below using api (___install() method): create fields put fields to template Thanks
×
×
  • Create New...