Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/08/2017 in all areas

  1. ProcessWire doesn't have concept of required fields. There are only required "inputs", which is just for the forms handling editing pages. You can find more about it in the discusions here https://github.com/ryancramerdesign/ProcessWire/issues/1743 and maybe a bit here https://github.com/processwire/processwire-issues/issues/252
    4 points
  2. Got to disagree - I learnt a great deal, and I'm sure many others will appreciate having our hands held in a thorough and thoughtful way. Very much looking forward to the next one!
    4 points
  3. Ok, so I've completed the first module and a detailed step by step write-up. https://abdus.co/blog/creating-a-simple-and-configurable-module-for-processwire/ It's a markup module that adds tracking code for analytics. It has hooks, hookable methods, and it's translatable and configurable. https://github.com/abdusco/pw-ga-lite Once I make sure it's ready to go, and write a good intro, I'll create a separate post for it.
    4 points
  4. Hi TheoTop, and welcome to ProcessWire. The methodologies and philosophies of CI and PW are considerably different. When it comes to MVC (or other similar chain), I prefer to use Laravel - but PW can easily handle most things quite well (especially in terms of information storage with relations etc). With that said, I recommend you have a look at the various courses available online to better your skills before you start choosing between frameworks and systems. TutsPlus, Coursera, Khan Academy, just to name a few. When you've done that, grasping Laravel/CI/PW/etc will be much easier, and you would be able to easily draw your own conclusions and choose the right framework for whatever task you have on hand. For payments, I think these are the go-to PW modules https://github.com/apeisa/PaymentStripe/ and https://github.com/apeisa/PaymentPaypal/. If you're looking to de e-commerce, try out https://www.padloper.pw/ (I haven't used it myself, but it looks perfect for the task - others can comment in on that). Best, Mike
    2 points
  5. Little admin helper module: Using this module you can view all template cache settings at once. E.g. cache status, cache time (configurable). Furthermore it adds the functionality to clear the entire template cache or just the template cache for a given template. Note that this may cause a temporary delay for one or more requests while pages are re-cached. GitHub: https://github.com/justb3a/processwire-templatecacheoverview
    2 points
  6. @Robin S thanks for the feedback! I will make that change. @maxf5 I see what you're saying completely - but I am also endeavoring to keep my sites from disintegrating into the norm of wordpress sites - being made up of gazillions of similar, undocumented functions. At least with a module they're easy to find... I also plan to add more functionality to the module in the long run. I like your one-line solution, but as much as anything else, it was an educational experience for me, that's all!
    2 points
  7. Hello, I'm a little confused by your description of the problem, but I don't think you have your URL segments set up correctly. In what follows, I am assuming you have edited the URL tab of the template for your page to turn on URL segment processing and you have something entered in the "Which URL segments do you want to allow?" field. I'm guessing that you want to have the first segment be an action - either edit or new - and the second segment to be a numeric id. If that is the case and you want PW to enforce the first segment to be either 'edit' or 'new' then you need to use a regular expression as documented here to match the actual URL you are supplying. More specifically, could you try... regex:^new/[0-9]+ regex:^edit/[0-9]+ Another approach may be to leave that field totally blank and do all the checking yourself, in which case I think macrura's code should work.
    2 points
  8. @horst's code worked. Thank you.
    2 points
  9. Have you disabled or refreshed browser caching? Have you checked the files in local and or FTP directory? or do you only noticed this "not changing" in the website by using the browser?
    1 point
  10. this has been discussed in the context of a repeater field with a limit of 1 item; afaik there is no way to do what you are describing
    1 point
  11. God bless you, I was going to write something that did this - you did it better than I would've! Also - will you be adding this to the Module library?
    1 point
  12. Hi and Welcome to the forums, Maybe this one helps:
    1 point
  13. just wanted to mention that there could be another option if somebody is not happy with an ajax solution: https://processwire.com/api/modules/lazy-cron/ not enough time to investigate further, but i wanted to put the reference here...
    1 point
  14. if you only want to process requests where both segments exits, then you would want to check for both. this is a simple example: if($input->urlSegment3) throw new Wire404Exception(); if($input->urlSegment1 == 'edit') { if (strlen($input->urlSegment2)) { // process the 2nd segment here } else { throw new Wire404Exception(); } } if($input->urlSegment1 == 'new') { // process request for new if (strlen($input->urlSegment2)) { throw new Wire404Exception(); } }
    1 point
  15. can you provide your template code for how you are dealing with the URL segments? Usually you would check each segment, and if the segment exists, you would sanitize it for further processing, and then take actions based on the validity of the segment.
    1 point
  16. Hi, I don't think this is a good way to do it either. Seems other CMSs get a more simple way. Gideon
    1 point
  17. Excellent tutorial. Not too verbose at all - I appreciated the detail and thoroughness. Good idea using the footnotes. The tutorial was really well structured, the way you worked through the essential steps in order and ended with optional enhancements. Thanks for a great read!
    1 point
  18. you'd need to take out the start=0, from your pages->find in order for the pagination to work, otherwise it will always show the items starting from page 1
    1 point
  19. Man I love the last part of "small tips". Those kind of things take me to the haute couture of module making :D.
    1 point
  20. Anyone can install it with a few clicks
    1 point
  21. No, doing this would only allow the exact URL segment 'category'. Instead, don't place any restrictions on the segment in the template settings and do your segment validation inside the 'news' template. Rather than rewrite or render anything from a category page you can handle all the output within your 'news' template. Here is an example from a recent project: $limit = 5; $news_selector = "template=news_item, post_date<=today, limit=$limit, sort=sort"; $categories = $pages(1139)->children(); $segment_1 = $sanitizer->pageName($input->urlSegment1, true); // URL segments are already sanitized as page names but not to lowercase if($segment_1) { $current_category = $categories->get("name=$segment_1"); if($current_category) { // the segment is a valid news category $news_selector .= ", news_category=$current_category"; $page_title = "$current_category->title news"; } else { // the segment is invalid so throw 404 throw new Wire404Exception(); } } $news_items = $pages->find($news_selector); $total_pages = ceil($news_items->getTotal() / $limit); The effect of this is that if there is a valid URL segment then only news items from that category are listed, but if there is no URL segment then all news items are listed.
    1 point
  22. @ethfun, thanks for the module I suggest you prefix the classes coming from the parent pages with "parents-" (or better "parent-" for the direct parent and "parents-" for grandparents). This is because a page name may start with a digit but CSS selectors don't like that. That is from the CSS2 spec - I can't lay my hands on the CSS3 equivalent right now but I believe it is still advisable to avoid classes starting with digits.
    1 point
  23. Just adding to what abdus and Macrura have said: you use URL segments to do this, but you don't need to hook page paths or render any different page. Your category pages can use a template with only a title field and with no corresponding template file - these category pages only exist for the purpose of being selected in a Page Reference field in your news article pages. In your 'news' template (the template of the parent page of the news articles) you check for a URL segment and if there is one you use that in a selector to match only news articles that have that category selected. You can do a kind of sanitizing of the URL segment by first checking if there is any page by that name using your category template or under your category parent - if there isn't then you throw a 404.
    1 point
  24. usually for areas like news, blog, events, the best practice is to check for the URL segments as mentioned by abdus. You can look at the blog module or blog profile to possibly see some functions for how to intercept the segment, and display the filtered posts.
    1 point
  25. You can use url segments to achieve this.
    1 point
  26. Between a lot of big, not-web-related projects at work, I could squeeze in having a little a fun with ProcessWire too. What was needed was a shop-like solution where employees can order lunch snacks from our local butcher. Previously, this was handled with hand-written lists in each production hall that would be forwarded over fax to the butchers, leading to all kinds of transliteration and pricing errors. Our Central Services department looked at different software packages for that, but none of them did exactly what they needed. ProcessWire to the rescue. In little more than two days, I got a fitting solution up and running: PW 3.0.52 The only two non-standard modules used are @adrian's AdminActions and my own DatetimeAdvanced Role based template access UIKit 3 with modals, flex layout, mobile-ready with hamburger menu on smaller devices Everything is a page Synchronisation of employee accounts from time management software (> 600) into PW (120 lines, runs twice a day) Mixed authentication (Windows Active Directory if user is available there, local password if not) Account balance system with manual deposits and automated checking / detuction / refunding for orders, complete transaction history visible for the user Article categories (page reference), product images (not used yet), simple product variants (1 level, text + price) Ordering contents of a shopping cart for a single day or multiple days ahead of time within (admin configurable) time constraints (order window for following day ends X hours before, holidays excluded, etc.) Delivery locations (buildings) changeable by users themselves Integrated favorites system Management area in frontend for balance bookings, managing articles, previewing orders Daily collected orders for the butchery are printed into PDF through fpdf with a tiny wrapper Product images option with thumbnails (currently not used) Small additions like price validity dates or saving and re-using shopping carts will be added over the next months The shop landing page with all relevant information: Articles are grouped by category and have dropdowns for variations (with optional price addition/discount): Editable shopping cart with option to order same selection for multiple days: Minimallistic product item editor:
    1 point
  27. Also here's a relevant post from the blog on why it's implemented. https://processwire.com/blog/posts/processwire-core-updates-2.5.27/#php-5.6-and-debuginfo
    1 point
  28. Take a look at the __debugInfo() method.
    1 point
  29. not sure if this is right, and I'm on mobile. Have you tried to add them to the field? After all pages are created, something like $page->pagetablefield->add($childpage);
    1 point
  30. Good work! Regarding best practises, the only suggestion I have is that the tutorial should be changed to use environment variables for the database connection. This has several benefits, for an example It would be very easy to launch a separate development site, which uses a different database, because all you need to change is the environment variable when launching the development web container You could easily use the same config.php as a template for new sites You don't have to store sensitive information in your version control The config.php becomes more cloud compatible (i.e. a twelve-factor app) Also since the MySQL-container is linked to the web-container, the config.php can directly use the environment variables set by Docker. An example config.php would be $config->dbHost = getenv("MYSQL_PORT_3306_TCP_ADDR"); $config->dbName = getenv("MYSQL_DBNAME"); $config->dbUser = getenv("MYSQL_DBUSER"); $config->dbPass = getenv("MYSQL_DBPASS"); $config->dbPort = getenv("MYSQL_PORT_3306_TCP_PORT"); Obviously launching the web container(s) would need to include these variables too, e.g. docker run -e "MYSQL_DBNAME=mypwdb" -e "MYSQL_DBUSER=mypwdbuser" -e "MYSQL_DBPASS=mypwdbpass" --name celedev-site -p 8088:80 --link database:mysql --volumes-from celedev-data -d php-5.6-pw-celedev Just my two cents
    1 point
  31. Yep, basically what Martijn said. Go to Setup -> Fields -> Add New Field Add a name and label for your field and change the Type dropdown to File Under the Details tab you will see allowed filetypes and PDF is in the list - alter the list to suit you Change Maximum Files Allowed to however many you want - perhaps 1 in this case? Save your changes Add to your template That's it really.
    1 point
  32. I prefer to bake them with integral flour and yellow sugar. My favorites have butter, almond or hazelnut, oat, cinnamon, and sometimes a bit of black pepper. I let them bake a lot until they get really crunchy. Hm, not sure if I ever tried those ingredients... are they tasty?
    1 point
×
×
  • Create New...