Jump to content

Robin S

Members
  • Posts

    5,039
  • Joined

  • Days Won

    340

Everything posted by Robin S

  1. I'm looking for suggestions of dummy text generators. Some things on my wishlist: Not the usual cod-latin "lorem ipsum" - you'd be surprised how many people out there have no idea that this is dummy text ("What's with all the foreign words? I want an English website"). Uses actual English words, but such that it is obviously nonsense text to be replaced. Nothing that is going to tread on any toes (e.g. I can imagine some clients not seeing the humour in corporate ipsum). I really liked the generator that Ryan used in the blog profile (it had a great "fairy tale" option) but unfortunately it has folded: http://duckisland.com/GreekMachine.php I have done some Googling BTW, just haven't found anything ideal.
  2. Is "freeActs" an integer field? If so maybe you need to check this setting: I cropped it out of the screenshot but read the setting description for a good explanation of what this setting is for.
  3. I'm confused by this - didn't you say that the maximum number of products you are currently listing is 37? 245 pages is more pages than you want to be loading without a limit. If you are later filtering these 245 pages down to 37 or whatever you should try and rework it so you are getting only the 37 in the initial $pages->find().
  4. The solution from @abdus works well - you just need to change... $img = $page->randomImages[$page->randomIndex]; ...to... $img = $page->randomImages->eq($page->randomIndex); ...because Pageimages are indexed by basename not integer. This must be the result of some efficiency optimising in Hanna Code. To get around this, just add some attribute to each tag - you don't need to use this attribute anywhere in your tag code. So lets say the attribute is called "seed" (just so it looks kinda legit to the user - this attribute is not actually used to seed anything): [[random_image seed="546458"]] ...some content... [[random_image seed="afdasfd"]] So this attribute's value can be anything so long as it's not the same as another tag on the same page.
  5. You mean the extra backslashes? Those are to escape the forward slashes. Read more here: https://stackoverflow.com/questions/10210338/json-encode-escaping-forward-slashes/
  6. My gut feeling is that the Page Reference fields, repeaters, foreach nesting is not what is causing this slowness. For a listing of only 37 product pages there should not be that much of a delay. (How long is "abysmally slow", by the way?) I'm doing similar things for with page-per-image setups (although with PageTable rather than repeater) with much larger numbers of pages and there isn't a significant impact on speed. And for pages in the ProCache cache there should be no impact whatsoever. So I think you have some other issue going on. Not sure what though, sorry. If you're developing locally, try testing the site on a remote server and see if you experience the same slowness. Or vice-versa if you are developing remotely. Also: start commenting/cutting out blocks of your template code to try and isolate if one area is responsible.
  7. Welcome to the forums @Henner7, The link @abdus gave is actually for bug reports. Feature requests go here: https://github.com/processwire/processwire-requests/issues There is already a request to remove the default truncation: https://github.com/processwire/processwire-requests/issues/83 Besides the solution from BitPoet that you'll find in the feature request, you can disable truncation for all File inputfields by adding a hook in /site/ready.php: $wire->addHookBefore('InputfieldFile::render', function(HookEvent $event) { $inputfield = $event->object; $inputfield->noShortName = true; });
  8. Thanks for the feedback @alxndre. The module is about better efficiency for the "Add Template" workflow, and I don't think sorting the page list is related to that. I'd like to keep this module fairly focused rather than becoming a collection of general admin tweaks (we already have a great module for that). I agree with Soma's request though. He says his solution is a "dirty hook" but it actually looks very clean to me. I don't think I could come up with anything cleaner so I suggest sticking with Soma's solution. It doesn't need to be added in a module now that we have /site/ready.php.
  9. Limiting and paginating would be sensible too. Even if the list is currently not very long, any time you list pages that a client may add to (I assume the client can add new products) you should limit and paginate because you don't know how many pages this may ultimately grow to.
  10. Instead of the hook, wouldn't it be better to set this as the "Alternate template filename" only on the templates you need it for?
  11. If you mean PW in general, then... Add Material Icons: yes Replace FA with Material icons: no While that long list of Material Icons looks nice at first (and I use them often) there is a heap of essential things missing. A couple of random examples: Facebook, external link.
  12. I thought all the bundled actions were enabled for superuser by default on install, but now I see that superuser is preselected for all the actions but this doesn't actually take effect until you save the module config. Maybe that is intentional in Admin Actions, but in general I think that is something it's better to avoid. Users might navigate away without realising they need to save to confirm the settings on screen. And even if they later return to the module config, there is nothing to indicate that the settings they see on screen are not actually live. It can be a problem for the module dev too if you are expecting those default config values that show on screen to actually be available in the module. It's caught me out a few times in my own modules - I've learned now that a better approach is to define the config defaults in the construct() method so that the config that users see is what is actually in effect, right from the moment of install. Anyway, I see where you're coming from regarding the activation of actions, although personally I don't see any downside to having all the actions active and listed on the Admin Actions page (for superusers) so they can be explored. It's the step of adding actions to the menu where I would be limiting it to just regularly-used actions.
  13. Not sure why you are seeing that. What you should see is an exception message that explains things pretty well: IDs are the way to go for that sort of selector, so I would stick to what you have changed to rather than install PagePaths. Edit: it just occurred to me that you may not be seeing the exception if do not have debug mode enabled. In /site/config.php: $config->debug = true; You should enable debug mode while you are developing a site and then disable debug mode when the site goes to production.
  14. Nice. How about some radios for more focused searches? API reference - site:processwire.com/api/ Forums - site:processwire.com/talk/ Blog - site:processwire.com/blog/ I have these as keyword searches in my browser and they get a lot of use. (TBH, it's so easy to Ctrl+L focus the browser address bar and do a keyword search that I'm not likely to give the Tracy feature much use, but maybe some will prefer the Tracy option).
  15. Hi @adrian, a few ideas for tweaks to AdminActions... How about adding a $title option inside the action class? To specify a title rather than deriving it from the camel-case in the action class name. It doesn't look quite right if there is a capitalised acronym in the class name. Maybe new actions should be automatically enabled for the superuser role? To save having to visit the module config and enable each manually. The "Actions" tooltip appears when hovering any part of actions list in the module config (it comes from the title attribute on the inputfield wrapper). This is a bit distracting so maybe remove that?
  16. protected function defineOptions() { return array( array( 'name' => 'csv_upload', 'label' => 'CSV upload', 'description' => 'Upload a CSV file.', 'type' => 'file', 'extensions' => 'csv txt', 'overwrite' => true, 'maxFiles' => 1, 'required' => true, ) ); } protected function executeAction($options) { // If there was a file uploaded (Pagefiles object) if(count($options['csv_upload'])) { // Get the file (Pagefile object) $file = $options['csv_upload']->first(); // Parse the CSV data $handle = fopen($file->filename, 'r'); $count = 0; while(($row = fgetcsv($handle)) !== false) { $count++; // Process each $row // ... } fclose($handle); // Delete the uploaded CSV file (or else you will get an error next time you upload) unlink($file->filename); $this->successMessage = "$count CSV rows were processed."; return true; } else { $this->failureMessage = 'Please upload a CSV file'; return false; } }
  17. This module corrects a few things that I find awkward about the "Add New Template" workflow in the PW admin. I opened a wishlist topic a while back because it would good to resolve some of these things in the core, but this module is a stopgap for now. Originally I was going to share these as a few standalone hooks, but decided to bundle them together in a configurable module instead. Add Template Enhancements A module for ProcessWire CMS/CMF. Adds some efficiency enhancements when adding or cloning templates via admin. Features Derive label from name when new template added: if you like to give each of your templates a label then this feature can save some time. The label can be added automatically when templates are added in admin, in admin/API, or not at all. There are options for underscore/hyphen replacement and capitalisation of the label. Edit template after add: when adding only a single template, the template is automatically opened for editing after it is added. Copy field contexts when cloning: this copies the field contexts (a.k.a. overrides such as column width, label and description) from the source template to the new template when using the "Duplicate/clone this template?" feature on the Advanced tab. Copy field contexts when duplicating fields: this copies the field contexts if you select the "Duplicate fields used by another template" option when adding a new template. Usage Install the Add Template Enhancements module. Configure the module settings according to what suits you. https://github.com/Toutouwai/AddTemplateEnhancements https://modules.processwire.com/modules/add-template-enhancements/
  18. You'd also want to think about memory usage/limits. If someone uploads a 10000-pixel-wide image and you go to resize it for use in your template you could run out of memory. This was one of the reasons for introducing the client-side image resizing which is linked to the max-width/max-height settings.
  19. Cool stuff! But in the example you would definitely want that template check at the top of the hook (or check the current process with $this->process) or you will get an error when creating or editing a user (no Settings tab exists).
  20. I think this default behaviour is totally wrong - $config->adminEmail should not be used as the fallback "from" address by WireMail. I opened a LoginRegister issue and core feature request.
  21. One more option (and to state the obvious): you can simply upload ads.txt to the site root and then access it at www.xxx.com/ads.txt like you would expect.
  22. You need to supply a Page object as an argument to Pageimages(). For example: $page->carouselImages = new \ProcessWire\Pageimages($page); Seems like an unusual way to build a carousel though - are you using some kind of template/view separation? If not, you don't need to add the carousel images as a property of $page - you can just get your carousel pages and build the carousel markup from them directly. $carouselPages = $pages->get("name=categories")->children("headerImage!=''"); foreach($carouselPages as $carouselPage) { // output your carousel markup using $carouselPage->headerImage }
  23. Yeah, but it's a little bit trickier than what you have shown. $pagesList= $pages->get("/"); foreach($pagesList as $page){ } If you do this, $pagesList is just the Home page by itself - it isn't a PageArray you can loop over to get all the pages in your site. For a full listing of pages you actually need to use a recursive function like Ryan's example here: Just wanted to point this out in case a beginner actually tried to use your example.
  24. @monchu, thanks for the reply. It's not quite what I'm asking about - it's the default sort order I'm interested in and why a new page would be inserted in the middle of existing pages. I did manage to figure some stuff out... Firstly, it seems the 404 page, Admin and Trash are always sorted last. There's no changing that, which is fine. Also, looking at the "sort" column of the "pages" table in the DB it looks like there were gaps in the sequence of sort values of pages under Home. Because of those gaps and also the fact that some of the pages that are part of my site profile happened to have high sort values, new pages were being inserted above them in the tree. So I fixed the gaps with... $home = $pages->get('/'); $pages->sort($home, true); // re-build sort values for children of $home, removing duplicates and gaps ...and then I manually gave high sort values to any pages that I want to keep at the bottom of the tree (but still above 404, Admin, etc, as per the above)... $p = $pages(1016); // the Form Builder page $pages->sort($p, 99); // set the sort value to a high number Now new pages are going just where I want them.
  25. All good now, thanks.
×
×
  • Create New...