Jump to content

Jan Romero

Members
  • Posts

    612
  • Joined

  • Last visited

  • Days Won

    15

Jan Romero last won the day on July 24 2023

Jan Romero had the most liked content!

1 Follower

Profile Information

  • Gender
    Not Telling
  • Location
    Germany

Recent Profile Visitors

15,756 profile views

Jan Romero's Achievements

Hero Member

Hero Member (6/6)

897

Reputation

26

Community Answers

  1. Hi, I tried to reproduce this without success (3.0.208 dev). Can you share more about your setup?
  2. This helped me give in to my nagging coworkers and sign up for ChatGPT, but I can’t seem to get it to answer this question properly? May I ask what your prompt was, @Jonathan Lahijani? Also, what’s causing problems with calling ready() explicitly?
  3. Looking good, however I can’t access it from Germany (connection times out) :O
  4. It’s handled, but I wasn’t able to send a 200 status unless allowing the $ in .htaccess. I don’t know what’s going on there, I imagine it’s overridden by Apache after PW is done. Other status codes worked for me, though. Only 200 always turned into 404.
  5. I tried to replicate this problem and it turns out there are some characters you can add to $config->pageNameWhitelist and .htaccess all you want, this blacklist in the core won’t have it: https://github.com/processwire/processwire/blob/master/wire/core/Sanitizer.php#L911 Dollar signs are FORBIDDEN!!!! However, don’t despair yet, you’re never more than a finite amount of disgusting hacks away from success: wire()->addHookBefore('ProcessPageView::pageNotFound', function(HookEvent $event) { if (stripos($_SERVER['REQUEST_URI'], '/concepts/') === 0) { //serve file } }); This needs to go into init.php and runs whenever PW would otherwise 404, that is, it can’t find a page or url segments or url hooks for the requested path. Some things will not work as expected in this hook. For example input() will not be populated. To make the $ work you’ll need to update your .htaccess, though. For example you can just add the $ to the default rewrite condition: # PW-PAGENAME # ----------------------------------------------------------------------------------------------- # 16A. Ensure that the URL follows the name-format specification required by PW # See also directive 16b below, you should choose and use either 16a or 16b. # ----------------------------------------------------------------------------------------------- RewriteCond %{REQUEST_URI} "^/~?[-_.a-zA-Z0-9/\$]*$" # ----------------------------------------------------------------------------------------------- # 16B. Alternative name-format specification for UTF8 page name support. (O) # If used, comment out section 16a above and uncomment the directive below. If you have updated # your $config->pageNameWhitelist make the characters below consistent with that. # ----------------------------------------------------------------------------------------------- # RewriteCond %{REQUEST_URI} "^/~?[-_./a-zA-Z0-9æåäßöüđжхцчшщюяàáâèéëêěìíïîõòóôøùúûůñçčćďĺľńňŕřšťýžабвгдеёзийклмнопрстуфыэęąśłżź]*$" Or use the other one below and add it there. Or do whatever is applicable for nginx? Not ideal but still better than messing with the core, I guess.
  6. If you want to modify the Module you could replace the original switch case in FieldtypeTable.module with this: case 'text': $maxLength = empty($col['settings']['maxLength']) ? 2048 : (int) $col['settings']['maxLength']; $stripTags = empty($col['settings']['stripTags']) ? true : ($col['settings']['stripTags'] === 'false' ? false : true); $v = strlen("$v") ? $sanitizer->text($v, array('maxLength' => $maxLength, 'stripTags' => $stripTags)) : null; break; That will allow you to specify stripTags=false on text colums.
  7. Unfortunately I believe this is hardcoded behaviour (see _sanitizeValue() in FieldtypeTable.module). As you noticed, it doesn’t strip tags from textareas, so maybe switch to that? It should be quick work to add this as a per-column option like maxLength. Perhaps worth suggesting it to Ryan in the ProFields forum?
  8. Btw, it should be possible to create a new page with a string template name using $this->pages->newPage() https://processwire.com/api/ref/pages/new-page/
  9. You can change the dpi in Document -> Resize Document by unchecking “Resample”, i.e. you’re just changing how big the image should appear on physical media but not its pixel dimensions: For example here’s a 300px by 300px picture of a salad. Both images are exactly the same, but if you import them into a DTP software like Affinity Publisher, InDesign or Scribus, by default one will be 8cm (96 dpi) and one will be 2.5cm (300 dpi). That is to say you’re correct and dpi don’t matter in terms of file size or pixel resolution on the web.
  10. Yes, that is the way. What are the contents of your DefaultPage.php file? https://processwire.com/blog/posts/pw-3.0.152/#new-ability-to-specify-custom-page-classes If you just want to add a method or property you can also use hooks for that: https://processwire.com/docs/modules/hooks/#how-can-i-add-a-new-method-via-a-hook
  11. @gnarly Thanks, I added it to the post 🙂 Welcome to the forums!
  12. I suspect this shouldn’t be too hard to implement naively, but it’s probably non-trivial to get all the configurable bells and whistles to work that image fields support (like client side resizing for example). I think you can grab images from the clipboard as blobs by listening to the paste event and filtering by type pretty easily. You’d have to figure out which image field to use, since a page could have multiple, and how to interface with it. I agree CTRL+Ving images is delightful and a desirable feature to have! Personally I don’t like WYSIWYG editors, so a cool feature would be the ability to paste pics into a Markdown textarea and have it upload it and generate the code automatically, like we see on Github.
  13. ProcessWire is particular about the difference between saving pages and saving individual fields. In this case, only Pages::save and Pages::delete trigger the hook: https://github.com/processwire/processwire/blob/master/wire/modules/PageRender.module#L74. I agree this difference is pretty underdocumented. You can probably hook up your desired behaviour somewhat like this in ready.php: $this->addHookAfter("Pages::saveField", function(HookEvent $event) { modules()->get('PageRender')->clearCacheFile($event); }); I haven’t tested it but the relevant hook arguments should be the same, i. e. the Page is argument 0, so it might work? There is also Pages::savedPageOrField for when you want to make your own hooks trigger regardless of how the page was modified.
  14. Try checking them since they DISable appended files. Also check your config file for “appendTemplateFile”: https://processwire.com/api/ref/config/#pwapi-methods-template-files
×
×
  • Create New...