Jump to content

Robin S

Members
  • Posts

    5,008
  • Joined

  • Days Won

    333

Everything posted by Robin S

  1. 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.
  2. 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).
  3. 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.
  4. 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.
  5. 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 }
  6. 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.
  7. @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.
  8. All good now, thanks.
  9. @adrian, I'm seeing an error in the back-end AJAX bar after I save a page. Tracy v4.6.4
  10. I like
  11. I have just created a new page "Sponsors" under "Home": My question is, how does PW decide that it is going to place this new page between "Form Builder" and "Page Not Found"? Why not at the top or bottom of the existing pages? When I created "Monitoring" and "Groups" the situation was the same and I sorted them manually. This has been bugging me for a while, and I can't see what the rhyme or reason is. First thought was that "pages with system templates get sorted last", but that doesn't hold up because Form Builder uses a system template and Page Not Found does not. Edit: in case it's relevant, the "Tools", "Instructions" and "Form Builder" pages are pre-existing pages that are included in my custom site profile.
  12. Working perfectly, thanks.
  13. Wow, bumper update! Aside: I wonder which PW module has the highest version number? Tracy must be leading the field in terms of number of releases in any case. The Snippets panel is great - just what I was hoping for. Really handy having the keyboard shortcuts for run, and it's neat how the Run button gets focused after loading a snippet too. One thing though: would it possible to allow a namespace declaration inside snippets? I need that for IDE code completion but when I include it I get... Maybe Tracy could strip out any namespace declaration on the first line when it runs the snippet?
  14. Great post @Sephiroth! But this part... I'm not seeing how that code could be used to create a sitemap.
  15. @jannisl, @formulate, I can't reproduce the issue here (maybe it depends on what you have set in "HTML Options" on the Details tab of the CKEditor field settings), but if you are able to work out the steps for reproducing the problem could you please file a GitHub issue so it can be fixed in the core?
  16. Hi @adrian, Is it possible to include a File field in an action for this module? What I have in mind is uploading a CSV that is then parsed and used as data in the action. I saw that the Create Users action has a textarea field where you can paste data in CSV format so that is one alternative, but sometimes I think it would be easier to upload an existing CSV file. Ryan's ImportPagesCSV module makes use of a File field so I guess there is a way to use files temporarily in a Process module (I haven't looked into how). If Admin Actions doesn't already support this would you consider adding it? Also, I noticed a couple of issues while exploring the module. On install I get a PHP notice: And when I attempt to open the "Ftp Files To Page" action I get an error:
  17. That line that you weren't sure about is preventing the adding or removing of columns from the Users lister. I think you should be able to remove the else{} part because if there are no columns specified in the AOS config then you don't need to do anything to the Lister columns. Also, it would be a little more efficient not to even hook ProcessPageLister::execute when both column AsmSelects are empty in the AOS config... if ( in_array($subModule, $enabledSubmodules) && (!isset($_SERVER['HTTP_REFERER']) || strpos($_SERVER['HTTP_REFERER'], '?bookmark=') === false) && // No need for hook if no tweaks in config (!empty(self::$configData['ListerTweaks_find']) || !empty(self::$configData['ListerTweaks_users'])) ) { // ...
  18. You don't need to edit each template, and I don't think the permissions system is that hard once you understand that permissions can be inherited. Suppose you want your editor role to be able to edit, add and create children for all templates. You just edit the Home template, grant all the permissions to the editor role, and allow those permissions to be inherited. Now this applies to all pages using all templates, unless for a particular template you choose to "manage view and edit access permissions for pages using this template" and deliberately override the inherited permissions. I don't think it's right that the guest role doesn't need to be displayed anywhere. Revoking view access for the guest role in the template settings is how a page may be restricted to authorised roles only.
  19. Sure, this is done in v0.0.2 If you know of a Javascript library that can generate those sorts of passwords while still satisfying password field settings I'd be happy to integrate it. But I think memorising passwords is only a short hop away from reusing passwords, which is asking for trouble.
  20. Any of those options would be fine with me - personally I don't mind if it's not configurable and is just /site/templates/snippets/, but I suppose some might already be using a "snippets" folder for something like partials in which case they might want a configurable option.
  21. It looks fantastic, thanks! Could the shortcut keys for Run and Clear work here like they do in Console?
  22. Password Generator Adds a password generator to InputfieldPassword. Usage Install the Password Generator module. Now any InputfieldPassword has a password generation feature. The settings for the generator are taken automatically from the settings* of the password field. *Settings not supported by the generator: Complexify: but generated passwords should still satisfy complexify settings in the recommended range. Banned words: but the generated passwords are random strings so actual words are unlikely to occur. https://modules.processwire.com/modules/password-generator/ https://github.com/Toutouwai/PasswordGenerator
  23. Thanks for the reminder about this. I think I have two different kinds of things I would potentially use snippets for instead of what I do currently (which is just temporarily bung some code into a template file). Occasional API tasks for use in actual projects. AdminActions is probably ideal for this so I should give that module some proper attention. Exploring/debugging issues, often ones that are raised by others here in the forums. The latter is where Tracy is probably the best solution, because it's so handy to have $page available in the snippet code and often the explorations are disposable after a short while once the issue is resolved. I for one would love that, if it's not too much work to add (hopefully much of it could come from what you've already developed for console). Thanks for listening to my ideas, and the suggestions.
  24. More thoughts... If I'm a person that prefers to edit my snippets in my code editor rather than the console window, and I have made changes to the current snippet using my editor that are not yet reflected in Console (because I haven't clicked "reload" or whatever), then when I do "Run" I would want my newer file version to execute rather than the older snippet visible in Console. Maybe when "Run" is triggered, Tracy could see if the file is newer than the last Console edit and if so run the file version and reload the snippet. This is getting complicated, right? Where I'm coming from is, I'm not worried about the code in Console and I don't even need to see it because I think I would always work with my snippet in my IDE. I'm just dreaming of a handy interface to run my snippets via the frontend. So maybe I need to explore this as a separate module, because Console already has a lot of happy users who like to write/edit/see their snippet in Console and perhaps my idea would be more disruptive than useful to them.
×
×
  • Create New...