Jump to content

The way fields work could use a big overhaul.


Recommended Posts

Coming from Perch (CMS) to Processwire, the one major downside I've found is that every place I want to insert content into my pages requires a single field (be that an image, integer, string, etc.). This can be a real pain to setup and manage if you have a lot of pages, many of them with dozens of unique fields. For example, on the Projects page of a site I'm working on right now I have to have fields for donate_amount (1-15, meaning fifteen unique fields that I have to duplicate manually), goal_amount(1-15), card_body(1-15), etc. After using Perch for a while, the way their system works is simply easier. You instead create your fields in a single PHP template (for every unique section, like a card) and their CMS imports those fields into the CMS when you choose to use that card, then you just fill in the values. You can also choose to reuse that card multiple times and each one you add gives you the several fields you need to fill in. So you can easily add your 15 cards, each with a picture, title, paragraph, and link, etc. and each one is basically given a unique ID that you can reference in your CSS files. If there's any way to make fields and templates work more like that, it would be a truly outstanding and efficient CMS. The great advantage of the way Perch is setup is that I can make a card with 10 fields, if need be, and easily duplicate that card out 40 times if I need 40 cards on the page and wouldn't need 10 fields for 40 cards (meaning in PW I would need 400 fields). If there's an easier way to do this in PW I would love to know, but as of right now, from what little I do know about the CMS 400 fields would be the only way to set that up, and that would be much more time consuming than if I could create one card (in PHP) with 10 fields that automatically added a number to the end of each field for each card (if that makes sense).

Link to post
Share on other sites

Thanks Ivan,

I'll look into all three extensively as I firmly believe this is the one thing in PW that should be done differently. I absolutely love the CMS otherwise. Thanks for the speedy reply and links!

Link to post
Share on other sites

The one obvious downside of ProFields is the cost. $160 is steep, especially if you chose PW because it was free, for example to make sites for organizations like Non-Profits, like I currently am. Mystique doesn't look like my cup of tea mainly because it stores the data in a JSON file (database) and not in MySql, and they admittedly mention that "searching for data is limited" because of that fact. So, repeaters sounds like my best option right now, so I'll definitely play around with them a bit. Thanks again for the suggestions!

 

  • Like 1
Link to post
Share on other sites

I never used PerchCMS and from what I know and looked up over on their site reminds be a bit of something Functional Fields do in ProcessWire.
Yet kind of different but still similar. AND another Pro module.

Back to your concerns regarding 400 fields+.

400 fields for just a few cards and donations goals/amounts and such seems not only quite hight it's probably unnecessary as well.

I'd bet if you could outline your needs more detailed and maybe even a screenshot of what it would look like in PerchCMS and it's behaviour that the forum might already have a solution for you or at least an idea.

  • Like 2
Link to post
Share on other sites
9 hours ago, spercy16 said:

You can also choose to reuse that card multiple times and each one you add gives you the several fields you need to fill in.

Wouldn't this be the concept of a template, that has the 15+ fields you need. So on your page tree you could end up with something looking like this:

- Cards (a page with a template called cards-display-page, without any other field aside from title)
-- Card 1 ( a page with a template called card, with the 10+,15+ fields you need)
-- Card 2 (another page of type card, ready to be filled)

Since you seem to be new to ProcessWire (at least from what I perceive on your posts!), maybe you are not familiar with the idea that a Page can also be just a sort of "data bucket", it doesn't really have to render the page itself. I see that you have solved this issue of your cards with a Repeater, though just wanted to let you know you could potentially do this, and actually behind the curtains,  Repeater items are actually regular Page objects!

I have used Perch in the past to build a couple sites and I do remember it was very practical to define fields inside the templates.

  • Like 4
Link to post
Share on other sites

Wbmnfktr, I no longer use Perch so screenshots aren't possible. It's a paid CMS, and I'm currently doing work for organizations that can't afford it (NPOs). Plus their support was horrible so I decided to find a better option, which is when I found ProcessWire. I briefly looked at the Functional Fields page you linked to and it is very similar to how Perch works. I haven't used Perch for several years though so I'm not sure if I could do the same things in Processwire or not.

The suggestion elabx made, to use whole pages as the cards and then just bring that info into the page I need, is an great option as well. I never even considered using pages like that (as "data buckets") but will try that method soon and see if I can configure it to meet my needs. It would definitely be more user-friendly to do it that way as I could configure the field widths to be less than 100% (which they're not configurable in the Repeater module).

Thanks to both of you for the excellent extra ideas!

  • Like 1
Link to post
Share on other sites
2 hours ago, spercy16 said:

they're not configurable in the Repeater module

They are, you need to configure that inside the repeater field, on the Details tab where you add the actual fields for the repeater, click on the field's label/name and it will popup a configuration screen that will be set the configuration in the context of the repeater field. (in case you use the fields in other places, for example)

  • Like 4
Link to post
Share on other sites
8 hours ago, spercy16 said:

I never even considered using pages like that (as "data buckets") but will try that method soon and see if I can configure it to meet my needs.

When working with ProcessWire always think "pages first", there are loads of creative ways to utilize them, they form the bases of the ecosystem.

@Robin S and @adrian and others have lots of useful free modules to make it even easier to work with them. Just a few examples, randomly selected:

and more to discover: https://processwire.com/modules/

BTW, welcome to ProcessWire 🙂

  • Like 4
Link to post
Share on other sites

welcome to processwire - structure your site is essential for the fun of setup a site best blogpost ever is this one:

This one made my first steps a lot faster thanks to @kongondofor this very very helpfull post for beginners...;)

kind regards mr-fan

  • Like 6
Link to post
Share on other sites

I had a go at something like this a few years ago, exactly after I played a bit with the Perch trial. It didn't gain much traction and I never got to develop the concept further, but what I had was working flawlessly.

 

  • Like 3
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By prestoav
      Hi all,
      I could have sworn I used to be able to use the site generic 'title' field as a sub field of a repeater field. However I've tried to do this on two 3.0.165 sites recently and, while it will add the title field in the repeater field setup, it wont save the repeater title sub field's content when the repeater is used in a page template and edited.
      It;'s not a big issue but I wondered if this was a known restriction?
    • By opalepatrick
      I see old posts saying that repeaters are not the way to go in Custom Process Modules. If that is the case, when using forms (as I am trying to do) how would one tackle things like repeat contact fields where there can be multiple requirements for contact details with different parameters? (Like point of contact, director, etc) or even telephone numbers that have different uses?
      Just for background I am creating a process module that allows me to create types of financial applications in the admin area (no need to publish any of this, pure admin) that require a lot of personal or company information.
      Maybe I am thinking about this incorrectly?
    • By spercy16
      I was previously using individual fields to capture and output multiple cards onto my web page but after recently learning about repeaters would prefer to use this field type, as it will be a lot more user friendly for end users to create new cards. I tried to modify my code to grab the fields from the new Repeater field(s) but am getting this error message on the page:
      Here is the code I'm currently trying to use for the cards:
      <?php // https://processwire.com/api/arrays/ // check if the array of images has items foreach($page->tall_card as $card) { $count = 0; $count++; $options = array( 'quality' => 70 ); $image = $card->image; $img = $card->image->size(550, 400, $options); $cardHeading = $card->title; $cardBody = $card->plain_paragraph; $raised = $card->raised_amount; $goal = $card->goal_amount; $link = $card->link; if ($raised == 0 ) : $percent = 0; else: $percent = $raised_amount / $goal_amount * 100; endif; if ($percent <= 5) : $percent = 0; endif; ?> <span id="card<?php echo $count?>" class="card"> <img class="cardThumb" src="<?php echo $img->url; ?>" alt="<?php echo $image->description; ?> Thumbnail" /> <div class="cardBody"> <div class="cardText"> <h2><?php echo $cardHeading; ?></h2> <?php echo $cardBody; ?> </div> <div class="progressBarSection"> <progress class="progressBar" id="progressbar<?php echo $count; ?>" value="<?php echo $percent; ?>" max="100"></progress> <span class="raisedAmount"> $<?php echo $raised; ?> usd </span> <span class="goalAmount"> $<?php echo $goal; ?> usd </span> </div> <div class="primaryBtn"> <a href="https://www.paypal.com/donate?hosted_button_id= <?php echo $link; ?> &source=url"> <button> <i class="fas fa-donate"></i> Donate </button> </a> </div> </div> </span> <?php } ?> Thanks in advance for any help!
    • By benbyf
      Never really got my head around field groups and it shows, In my module uninstall I think I figured out how to delete a page, then a template and it's fieldgroup so that nothing gets upset. But for fields that belong to templates that need to stoick around I'm still abit stuck to how you would remove the field and when I try I still get:
      Unable to delete field '[field name]' because it is in use by these fieldgroups: 'user'
      is there a tutorial or best method for removing added fields, pages and templates?
    • By carlitoselmago
      It's been twice this year as a PW developer where clients have asqued me to have a way to put content on specific coordinates of a picture. Something like what image maps are made of. But not necesarly on links, sometimes text, sometimes images and links. 
      So I've been thinking to build an inputfield for that purpose. But I'm not sure how could it be the most flexible so I can share it in github/modules page.
      Ideally it would need to work like a repeater field where you start uploading an image and then adding any custom field like title, url etc. So the user could add multiple elements floating over that image.
      Does anybody here know the ideal way to start the arquitecture of something like that? I could just hardcode the fields I need for the website I have to code this month but it would be nice to be something more flexible.
×
×
  • Create New...