Jump to content

Pete

Administrators
  • Posts

    4,054
  • Joined

  • Last visited

  • Days Won

    67

Everything posted by Pete

  1. I've been tinkering with this with a view to some sort of invoicing system (if you think about it, the only thing missing to produce something like that in PW was repeatable fields and adjustable-width columns, both of which are now here ). The only thing I feel is missin is the ability to display repeatable fields as a table, or more of a grid view. What I mean is the field titles are repeated with every repeater row, whereas for invoicing or similar needs it would be great to have them as a grid. One of the problems here is that as far as I can tell grid views aren't part of jQueryUI (yet), however when I looked at the example 3rd party plugins I immediately got excited by SlickGrid's examples - check out the Making it editable example, as well as looking at the different ways to display data (although data display should be more about the end-user experience and doesn't belong in the admin, but you get where I'm going with the editable part of it at least). My thinking is that to achieve something like this requires: Settling on a jQuery plugin to use - requires some thought as you wouldn't want to have to change it at a later date ideally Adding a checkbox to repeatable field configuration to choose to display it as a grid instead of the normal repeater - this needs the usual "only tick this if your repeater will display tabular data" disclaimer as it will obviously break if you add image fields or RTE text fields etc to your repeater. Some code to display it as a grid Some code to add a button to the end of the table to add another row, as well as a button at the end of each row to remove only that row I think that's it - sounds easy huh? I'm not sure whether ryan already has plans for something like this, or whether it should be included as part of the current module or as an additional module if it were ever to be built, but I think the possibilities for this could be very exciting indeed.
  2. That'll keep happening a lot throughout your experience I'm sure. I kept looking for more complicated ways to accomplish things in ProcessWire when it turns out that the majority of the time there's a really simple solution. Of course it helps if you know a bit of PHP for the templating side of things, but I'd go so far as to say that the small bit you will need for most projects is easily learned from the default templates.
  3. Yup - I think we were advised to update the .htaccess in one release (can't honestly remember) but it's certainly not the norm and I'm sure Ryan would mention it if it were required.
  4. At the same time though, Linux can have a problem with many files in the same folder, so it's a tricky one to address.
  5. I think that even for slightly more complex pages it could be useful to throw up a modal window that goes through the process of adding that page as you would normally. I've got a few fields on one project where it's more than just a title, so whilst I would like to see a simple option for fields that are just linking to a page with a title I think that being able to add a more complex page would be hugely beneficial. What I wouldn't want to do is have the ability for someone to add a new page title and then forget to fill out the rest of the page after saving the current page, but I think that displaying a large page inline like with the repeater fields could get messy - especially since you need to take into account that page's tabs too. That's the only reason I was thinking of a modal window for it
  6. I'm with Antti - not had a chance to keep up lately with so much other stuff going on and it's been amazing to see all the new things that are coming out lately - good work! I will have a large(ish) PW site up and running by the time you're back and will definitely be playing with this e-commerce module for the next project
  7. I don't suppose you'd be able to share the code would you Bill? No problem if not as I could probably work it out myself next time I need it, but no point everyone doing the same thing either
  8. Thanks guys - Antti's was closest since this field allows multiple values. The goal for this was to pre-populate the author field with the current user's ID if the author field is empty (something that would only be the case on new articles). The check for empty ensures that editing old articles doesn't end up appending my name to them all In the module's init() function we have this: $this->addHookBefore('InputfieldPageAutocomplete::render', $this, 'addUserOnEmptyAuthor'); and the function is simply this: public function addUserOnEmptyAuthor(HookEvent $event) { $autocomfield = $event->object; if ($autocomfield->attr('name') == 'authors' && !$autocomfield->attr('value') && !in_array(wire('user')->id, $autocomfield->attr('value'))) { $autocomfield->attr('value', wire('user')->id); } } So it first checks the field is called "authors", then checks it's empty before adding the current user ID. I also left in another check (that's not required, since the check for empty is enough), but might be useful for others thinking of doing something similar, which simply checks if the current user's ID is in the list of values already. I know that even if it did appear twice in the editor, PW only saves it once, but it would look a bit odd to have the same person's name twice so there's a check for that if anyone needs it. And now I also know a bit more about OOPHP too as well as how to set default values for other fields Thanks all!
  9. Thanks for that ryan - I can see that I can access the array in a function from that - I added a hook that ran a function called 'test' just to drill down to the values: public function test(HookEvent $event) { echo "<pre>"; print_r($event->data['object']->attributes['value']); echo "</pre>"; } This works fine and I can see if a field has a default value, but unfortunately I don't seem to be able to add a value - could you point me in the right direction for that please? I'm not very good with OOPHP, so I tried the following to add page 1306 to the value array and it didn't work: array_push($event->data['object']->attributes['value'],1306); Aside from that I can easily see how to check the field name to make sure it's the one I want (useful as the template has 3 autocomplete fields ) so I'm halfway there. EDIT: Ah, hang on, I found setAttribute in the autocomplete module so I'm nearly there. Will post the whole thing up shortly
  10. Nice module - and distributed under the WTFPL too
  11. Hi ryan I've just come across a need for this in an autocomplete field. Would it be easy enough to do simply by checking for a field and overriding that module or is it a bit more involved than that? My thinking is to somehow override the current module, check for a specific field name and insert a default value if no values are stored for that field, but I'm not sure how possible that is. It's not a big issue, I just have a scenario whereby people will be posting news and it would be better to have a field that automatically stores their user ID as the author rather than making them select it themselves. The reason for the autocomplete is because there are already a large number of writers, plus just to make it even trickier more than one writer can be attributed to an article
  12. Good work statestreet - that looks great! I think you're definitely right about the goals of such a profile - showing off enough to entice someone to learn more, wonder how it can be this easy, and actually be able to use it as their site (or rapid prototyping for a project or whatever they want ).
  13. Nice module Jim - this is very handy for one project I've got coming up as I can now integrate it with the company's domain to some degree and not have the hassle of people trying to change/remember their passwords in multiple places. It's also going to be a good starting point for another sooner project that was going to require me to code something very similar, so thanks as that will be coded in no time at all working from your module! I would have to change a forum setting and that would affect everyone's post, but it's possible to have everything appear right-to-left if you like
  14. I think it's somewhere between the two to be honest. It can be simple (and deceptively so) but there are a lot of people who do get put off by code and just want to built a website, which is where site profiles will play a part later on It's a powerful tool for developers and design agencies, as well as being a great CMS for those willing to get their hands a little dirty (which I think includes anyone who's done much with the templates in Wordpress as well). I'm hoping that as the web seems to be evolving - to me at least - into more of a community where people want to get involved more that this will help ProcessWire to become even more successful. I certainly think the fact that pretty much everyone now knows someone who's had a go at building a website themselves, whereas you couldn't say the same thing just five or ten years ago, means that the time for people to get a bit more hands-on is arriving as people want more control over what they create. Or maybe I'm just daydreaming, but it's a nice dream
  15. Pete

    Hello from Wes

    Hi Wes Welcome to ProcessWire Just a quick one - repeatable fields are currently being worked on and Ryan has released a video as well as hinting that they might be available this weekend. Can't link to the actual topic as I'm on my phone, but it should be easy to search for.
  16. Thanks for this ryan - this one in particular makes sense in terms of the original post I think (assuming this is being called from the "Videos" page itself): $page->find("parent=$page->children");
  17. I think you could just do this: $pages->find('color=');
  18. Without actually testing this, I think you could just do the following to fetch those pages: $grandchildren = $page->children->children;
  19. Thanks - that looks awesome! I'll have a play with it tomorrow at some point Like the sound of field-level access too - there's a lot of great stuff on the roadmap. Keep up the good word!
  20. Is there a way to hide the publish button for a user? I've had a look around the forums and I can't see that this has come up before, but what I'd like to do is have it so that certain user groups can add pages, edit and save them but not publish them. The idea is that the new pages then have to be approved by someone with higher permissions before the page appears on the site. Linked into this, I'd also like the ability for the user not to be able to edit a page once it's published if that makes sense? So they can add a page (article in this case) tweak it and edit it, let someone with higher perms check over it and publish it, and then at that point the author wouldn't be able to edit the page. I feel like this should be reasonably easy to accomplish with a module but just need a friendly shove in the right direction Something completely different that crossed my mind but would be useful in my situation (and maybe others?) would be the ability to hide a field depending on the user group and set a default value instead. The scenario for this is articles again - I've been using an autocomplete field to tag authors to articles (very occasionally it will have multiple authors), but for users of a certain group I'd like this field to be hidden instead and default the value to their user ID - not sure if that's actually possible? It's not 100% necessary, but again if there's a way to do it with a module I'd happily give it a shot Just as an extra, yet not entirely relevant, piece of information, I was also considering adding a checkbox to the end of the Article temlpate so that the author could then tick the box to say it's ready for review by an editor, and then have a list of articles ready for review on the admin homepage. That might be of interest to someone else working on some sort of approval-based site section, so I'll happily share the code
  21. 16 or even 30 is quite low for PHP. I don't think I've ever seen it set anything below 128mb personally, which is the default (see this page: http://www.php.net/manual/en/ini.core.php#ini.memory-limit ). The thing to remember is that it's not the memory required for the page contents, but rather running PHP and querying mySQL to process a given request - at least that's my understanding.
  22. I think it's possible that you may not have limited the image field to only have one entry (or it might apply wither way) but try: image_field->first()->url
  23. I think that'd be the way to do it Ryan - it covers every website I've done so far as they all have admin thumbnails turned on. Obviously other people's scenarios will vary but that would cater for the majority I think.
  24. Also worth noting that pagination won't display if the limit you set is greater than the number of articles you have. Sounds obvious but I confused myself tend other day first by not setting a limit and then by setting it too high
  25. Here's another scenario that's slightly more suited to some sort of cache I think. All my articles have a publish_date field (datetime). On a sidebar, I'd like to list all the years for articles, and if I click on a year, list all the months that have articles for that year (it's basically an archive link list). This basically works fine as I've already built the code behind it, however I'm very conscious that to pull this together it has to iterate through EVERY article. Would the most sensible way to cache this be to use a module again, cache the result using MarkupCache and then perform a check for a new page being saved using the article template and rebuild the list? I'm thinking that to be flexible I'd probably just be safer caching a serialized array of all the relevant years and months. Also, since articles are becoming a bit sporadic on this site, how long can you actually cache something for using MarkupCache? Just wondering if that makes sense or if there's a better way - I'd rather not have to iterate through every article every time someone hits that section of the site I'm also finally going to play with pagination tonight. Should be fun!
×
×
  • Create New...