-
Posts
4,928 -
Joined
-
Days Won
321
Everything posted by Robin S
-
Moving page parent via API resulting in Redirect Error on front end
Robin S replied to NikNak's topic in General Support
Try in incognito mode to make sure your browser is not caching old redirects. You could also use the "What other URLs redirect to this page?" section (introduced in PW 3.0.118) and/or the modules below to look for any circular redirects (if such a thing is possible with Page Path History). This second module needs the PagePaths module installed and also needs a variable name fixed as per a reply in the support topic. -
Sure, I will keep an eye on the core and merge your PR as soon as Ryan adds support for it. It's actually not that much more comprehensive. ? The only additions are the macronised vowels (āēīōū), which is something I wanted for my New Zealand context because they are used in Maori. The difference is that the list includes uppercase versions of the characters. I simply took the character list from InputfieldPageName, added the macronised vowels, and ran it through mb_strtoupper(). Adding uppercase characters to InputfieldPageName wouldn't make sense because page names are forced to lowercase. I had in mind that this sanitizer could be used for broader purposes besides converting characters to ASCII. Using the character replacements from InputfieldPageName seemed like a good starting point (particularly given the question that gave rise to the module) but a person could configure all kinds of replacements to suit their needs. There could well be cases where these substitutions would not be wanted in InputfieldPageName.
- 8 replies
-
- 2
-
- transliterate
- module
-
(and 1 more)
Tagged with:
-
Replacing non-latin characters in string with Sanitizer::translate
Robin S replied to j__'s topic in API & Templates
These settings probably wouldn't be ideal for the purpose because they only account for lowercase replacements (page names must be lowercase). But it seemed like a good candidate for a new sanitizer method so I made a module where you can define character replacements in the config: -
A community member raised a question and I thought a new sanitizer method for the purpose would be useful, hence... Sanitizer Transliterate Adds a transliterate method to $sanitizer that performs character replacements as defined in the module config. The default character replacements are based on the defaults from InputfieldPageName, but with uppercase characters included too. Usage Install the Sanitizer Transliterate module. Customise the character replacements in the module config as needed. Use the sanitizer on strings like so: $transliterated_string = $sanitizer->transliterate($string); https://github.com/Toutouwai/SanitizerTransliterate https://modules.processwire.com/modules/sanitizer-transliterate/
- 8 replies
-
- 13
-
- transliterate
- module
-
(and 1 more)
Tagged with:
-
Another way this could be done is via the following "Selector string" for "Selectable pages" for the Categories field: template=category, has_parent=page.rootParent
-
ImageSizerOptions doesn't seem to work for gamma
Robin S replied to Margie's topic in General Support
I was able to see a difference with defaultGamma set to 0.5 versus 4. 0.5 4 But only for ImageSizerEngineGD (the PW default sizer engine). I don't see defaultGamma used anywhere inside ImageSizerEngineImagick. Maybe @horst can confirm if defaultGamma applies to ImageSizerEngineImagick or not. -
FieldtypeDatetimeAdvanced - subfield selectors for date/time
Robin S replied to BitPoet's topic in Module/Plugin Development
@BitPoet, in case it helps, it seems that the relevant difference between a standard DateTime field and DateTimeAdvanced is that the standard field passes this test in Fieldtype.php for new pages... // if the value is the same as the default, then remove the field from the database because it's redundant if($value === $this->getBlankValue($page, $field)) return $this->deletePageField($page, $field); ...but DateTimeAdvanced does not, resulting in an empty datetime value being stored in the DB. -
FieldtypeDatetimeAdvanced - subfield selectors for date/time
Robin S replied to BitPoet's topic in Module/Plugin Development
@BitPoet, thanks for the update, but sorry to report the issue with "default to today" remains for me with new pages. I tested with the dev branch of the module. Edit: I've just noticed that it doesn't make a difference if "default to today" is selected for the field - the issue occurs regardless. Not sure if this was always the case and I just failed to check this when I originally reported it. Database: -
Alternative image not detected on production server? :(
Robin S replied to Xonox's topic in General Support
Related? -
Awesome, I think that's a great plan. ?
-
ImageSizerOptions doesn't seem to work for gamma
Robin S replied to Margie's topic in General Support
Hi Margaret, Maybe you could attach or link to one of the original images that is exhibiting the problem to see if anyone else can reproduce the issue? -
If you have a large number of images in the gallery it would be better not to load all the pages into memory only to display a portion of them with slice(). Better to use start and limit in your selector to get only the pages you will display. You could adapt the example given here:
-
Works for me too, but would depend on what $config->urls->root is (e.g. if developing in a subfolder?) If it's just MSN you are concerned about the simplest thing is to use the features built into MSN for just this purpose. Either then "xitem_tpl" option or a "getItemString" hook: // MSN hook for external_link template $nav->addHookAfter('getItemString', function($event) { $child = $event->arguments('page'); if($child->template == 'external_link') { $event->return = "<a href='{$child->link_url}' target='_blank'>$child->title</a>"; } });
-
Did you copy the .htaccess file? Does your server support mod_rewrite? It's a good idea when considering moving to new environment to first run the PW installer as this will check to see if the environment is compatible. If all good you can delete the installation and copy over your existing files and DB. Also see this: https://processwire.com/docs/start/install/troubleshooting/#the-homepage-works-but-nothing-else-does
-
[SOLVED] Relative time multilanguage in page Lister
Robin S replied to elabx's topic in Multi-Language Support
The relative dates will come via WireDateTime::relativeTimeStr(). -
InputfieldFieldset inside a InputfieldFieldset and how find pages
Robin S replied to bluellyr's topic in API & Templates
I can reproduce. Seems like a bug. Issue here: https://github.com/processwire/processwire-issues/issues/826 -
I'm not sure what's going wrong in your module, but maybe it helps you to look at this proof of concept module which adds a config field named "Animal" to every field and allows setting the field in template context. ExtraFieldConfig.module <?php namespace ProcessWire; /** * * ExtraFieldConfig * * @author Robin Sallis * * ProcessWire 3.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class ExtraFieldConfig extends WireData implements Module { /** * Module information */ public static function getModuleInfo() { return array( 'title' => 'Extra Field Config', 'summary' => 'Test module for adding and extra config field to Fieldtype config.', 'version' => '0.1.0', 'author' => 'Robin Sallis', 'autoload' => true, 'requires' => 'ProcessWire>=3.0.0', ); } /** * Ready */ public function ready() { $this->addHookAfter('Fieldtype::getConfigInputfields', $this, 'addConfigField'); $this->addHookAfter('Fieldtype::getConfigAllowContext', $this, 'allowContext'); } /** * Add config field * * @param HookEvent $event */ protected function addConfigField(HookEvent $event) { $field = $event->arguments(0); $wrapper = $event->return; /* @var InputfieldText $f */ $f = $this->wire('modules')->InputfieldText; $f_name = 'animal'; $f->name = $f_name; $f->label = $this->_('Animal'); $f->value = $field->$f_name; $wrapper->add($f); } /** * Allow setting config field in template context * * @param HookEvent $event */ protected function allowContext(HookEvent $event) { $allowed = $event->return; $allowed[] = 'animal'; $event->return = $allowed; } }
-
Install problems (admin login under OpenBsd)
Robin S replied to fmgoodman's topic in Getting Started
@fmgoodman, you could experiment with different values for $config->sessionFingerprint (add the line to /site/config.php) to try and track down the issue. See the $config docs and the code comments for Session::getFingerprint(). -
If the page you are loading in the iframe is on the same domain as your site you can get the title by finding it within jQuery contents() - google it for details. If the page is not on the same domain then you cannot get the iframe contents (and therefore the title) via Javascript. You could get the page contents via PHP (e.g. PW WireHttp) and use DOMDocument or similar to find the title, but the simplest thing might be to use an external API like http://textance.herokuapp.com/index.html Would be smart to cache the title for a while with WireCache.
- 7 replies
-
- 4
-
- X-Frame-Options
- SAMEORIGIN
-
(and 2 more)
Tagged with:
-
selectors Start operator ignored if limit is not set
Robin S replied to schwarzdesign's topic in General Support
You would need to exclude by ID withing the children selector or else the first page of $news_archive would be an unequal quantity (or empty depending on the value of feed_count_full) because pages would be filtered out after they are found. $news_archive = $page->children("template=news, id!=$news_full, limit=50"); If all of the results are appearing on the same page (no pagination is used) then you can achieve it without needing a second DB query... $news = $page->children("template=news"); $news_full = $news->slice(0, $page->feed_count_full); $news_archive = $news->slice($page->feed_count_full); -
@bluellyr, your screenshot shows a modal. Make sure you do not have the Tracy debug bar disabled for modals in the module config: @adrian, I wonder if it would be better to not have Tracy disabled for modals by default, and people can disable it if they are finding the debug bar annoying. And perhaps spell it out that no debug bar = errors if you try and use a dump method.
-
Both of these are the same and they work like this: $files->send($page->file->filename); And you can force the download for file types that might otherwise open in the browser like this: $files->send($page->file->filename, ['forceDownload' => true]);
-
Files field returning null unless I use getUnformatted
Robin S replied to adrian's topic in General Support
Without steps to reproduce I doubt Ryan could/would do anything about it. Might be best to wait until you notice it again in a situation where Custom Upload Names is not involved and raise an issue then. I do think it's odd that the formatted/unformatted value should be different with regard to temp files - I'll open an issue for this. Edit: issue is here. -
You haven't said what method you are hooking, but it sounds like if the page is not yet saved the logical thing would be to either hook after Pages::saved or else to save the page within your hook before you try and get the images from it.