Jump to content

Jan Romero

  • Posts

  • Joined

  • Last visited

  • Days Won


Jan Romero last won the day on May 8

Jan Romero had the most liked content!

1 Follower

Profile Information

  • Gender
    Not Telling
  • Location

Recent Profile Visitors

15,082 profile views

Jan Romero's Achievements

Hero Member

Hero Member (6/6)




Community Answers

  1. Robin’s suggestion of using a custom page class should work for that, just override get(): <?php namespace ProcessWire; class DefaultPage extends Page { private $cache = [ 'title' => 'look at me. i’m the title now.' ]; public function get($key) { return $this->cache[$key] ?? parent::get($key); } } IRL you may want to add logic dealing with output formatting and what not, but that should be a complete working example. Unfortunately get() is not hookable, so I don’t believe this can be accomplished in a module. That said, have you investigated other avenues? Why not cache the whole markup and be done with it?
  2. Maybe you can hook Fieldtype::loadPageField()? https://github.com/processwire/processwire/blob/6ff498f503db118d5b6c190b35bd937b38b80a77/wire/core/Fieldtype.php#L1108
  3. There is a setting for url fields to allow or disallow quotation marks. I’m pretty sure it defaults to disallowing them. Have you checked that?
  4. I see. I suppose the easiest way would be to just nest a single array in $vars and only ever use that. A more generic solution could involve hooking before TemplateFile::render: https://github.com/processwire/processwire/blob/6ff498f503db118d5b6c190b35bd937b38b80a77/wire/core/TemplateFile.php#L305 You could add something like $this->addHookBefore('TemplateFile::render', function(HookEvent $e) { $tpl = $e->object; $tpl->data('passedVars', array_diff_key($tpl->getArray(), wire()->fuel->getArray())); }); That should make the passed variables available as usual and additionally inside an array called $passedVars. I don’t think you’re going to get around the whole array_diff_key business at that point, unfortunately? The way passing vars to a file works in the core seems to immediately conflate those vars with the general globals. It happens even before render() is called, for instance here: https://github.com/processwire/processwire/blob/6ff498f503db118d5b6c190b35bd937b38b80a77/wire/core/WireFileTools.php#L1478.
  5. It’s not going to be in $vars. Instead, every key of the dictionary becomes a global variable, so psy’s example would introduce the variables $items, $homepage and $category to your template file.
  6. It’s only in the /wire/ directory so you can do your own thing in /site/.
  7. Hi @mackpatrick, welcome to the PW forums! Profields Table supports files and images since August 2022/version 23:
  8. https://news.ycombinator.com/item?id=35659963 which one of you is this? 😉
  9. Unfortunately I have nothing to contribute, but I tested your exact code on a PW 3.0.183 installation of mine and it worked as expected, so maybe the problem lies somewhere else?
  10. @zoeck you’re right, disregard everything I’ve said in this thread. It appears I have bought too many ProFields for myself 😅
  11. Yeah, but you can only renew for that price continuously. If you let the year elapse you have to pay full price to get another year, although I believe Ryan has made individual exceptions to this. At least that’s my understanding. IIRC the renew button is only there during the support period.
  12. No, afaik that’s the way. I think it’s a fair enough deal. It definitely is for commercial use while still being somewhat affordable even for hobbyists. I mean, it’s a lifetime license for unlimited sites and the ProFields are awesome, you can’t go wrong with that. You can also get the “subscription” where you pay a heavily discounted yearly renewal. Or you could try asking Ryan nicely 😉
  13. Sounds like a reasonable question, but seeing as it’s in the wrong forum, provides no details whatsoever, contains a commercial link and is the user’s only post, i’m inclined to take this for spam??? If you genuinely need help, please at least describe the structure of your page tree and what you’ve tried so far, @Freture. A general solution that lists all parents of the current page can be found on processwire.recipies: https://processwire.recipes/recipes/typical-breadcrumbs-example/
  14. Go to Modules -> Configure -> AdminThemeUiKit. There will be a section called “Masthead + navigation” which you can click to open. Then under “User navigation label format”, where it currently says “{Name}”, enter “{title}” instead. Or any other valid template string you like, obviously. The field pretty much tells you what to do. Of course this only works if your user template has fields for the things you want to display. As you will notice, other admin themes have their own settings, so if you allow users to change themes, you’ll probably want to make equivalent changes to all of them. However, AdminThemeReno doesn’t use the same template string system and AdminThemeDefault has no setting for this at all.
  15. Long time no WillyC! Also, I agree.
  • Create New...