Jump to content

Sandy

Members
  • Posts

    16
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Sandy's Achievements

Jr. Member

Jr. Member (3/6)

5

Reputation

  1. Thanks Jan. Yes, I've also got roughly the same code running successfully on another site, so it must be a setting somewhere. Any ideas where to look for something that could interfere with a hook like that?
  2. FYI, it's writing the message just fine when the code's placed outside the hook, so ready.php is working as expected.
  3. Hi - Any idea why this isn't working?... I want to render a message on the login screen, so added a hook to the /site/ready.php file: <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); $this->addHookBefore('ProcessLogin::execute', function(HookEvent $event) { echo "Test Message"; }); Any idea why it's not rendering anything? I copied the code straight from here: https://processwire.com/api/ref/process-login/execute/ Thanks
  4. I think you're right about it being a cache issue. I'll circle back to this once the site is in production and I have a bit of time. I'll post back here in case it helps someone else.
  5. Yes, I tried deleting the cache. The code is just in an include file (not a PW template)...I should have mentioned that earlier.
  6. Yes, the code in the first post was copied directly from the source in the two browsers. The full set of nav links are completely missing. I haven't been able to track down any JS or browser plugins which could have removed the HTML elements. I disabled all JS, ad-blockers etc. to see if it made any difference. Really stumped by this. I can't believe it could be PHP altering the output. Think it's much more likely a browser and/or user error, but I just can't track the damn thing down. Anyway, I've hard-coded them for now, and luckily the nav pages are unlikely to change. I'll just have to circle back to it once the project's finished for my own sanity!
  7. Given up and decided to hard code them. I'll try and fix it later.
  8. Also tried... Restarting my local server Restarting my machine Pushing the site to a remote PW install No joy.
  9. Thanks Bernhard. I've tried: Hard browser reloads Cleared caches Swapping the if and else code Checked all closing tags and quotes Disabled Javascript files Disabled font loading Exactly the same result: Links display as they should be in Firefox, but don't appear in the source code of Chrome or Safari.
  10. This is a really odd one...I have a bit of code looping through the home page's children and outputting navbar links: <?php foreach ($homePage->children() as $child) { $childTemplate = $child->template; // check if nav item matches this page and mark as current if (($child->id == $page->id) && ($page->template != 'plan-a-visit')) { $ariaCurrent = " aria-current='page'"; } else { $ariaCurrent = ""; } if ($childTemplate != 'plan-a-visit') { if (!empty($child->page_tags)) { $tags = explode(' ', $child->page_tags); if (in_array("navbar", $tags)) { echo " <a href='{$child->url}' class='navlink text-sm font-normal text-grey border-b-2 border-transparent hover:text-grey-search hover:border-b-2 hover:border-transparent py-2'{$ariaCurrent}>{$child->title}</a> "; } } } else { echo " <a href='{$child->url}' class='btn'{$ariaCurrent}>{$child->title}</a> "; } } ?> This works fine in Firefox (Mac, v98.0.2) and produces the following source code: <nav class="md:flex items-center md:justify-items-end space-x-4 md:space-x-5 lg:space-x-10"> <a href="/calendar/" class="navlink text-sm font-normal text-grey border-b-2 border-transparent hover:text-grey-search hover:border-b-2 hover:border-transparent py-2" aria-current="page">Calendar</a> <a href="/resources/" class="navlink text-sm font-normal text-grey border-b-2 border-transparent hover:text-grey-search hover:border-b-2 hover:border-transparent py-2">Resources</a> <a href="/donate/" class="navlink text-sm font-normal text-grey border-b-2 border-transparent hover:text-grey-search hover:border-b-2 hover:border-transparent py-2">Donate</a> <a href="/contact/" class="navlink text-sm font-normal text-grey border-b-2 border-transparent hover:text-grey-search hover:border-b-2 hover:border-transparent py-2">Contact</a> <a href="/plan-a-visit/" class="btn">Plan a Visit</a> </nav> But in Chrome and Safari, it doesn't output any of the first links (marked in bold above), only the one generated in the else statement at the end. I can't figure out how PW can apparently be sending different source code to different browsers. Any ideas? I'm running ProcessWire 3.0.184. Thanks
×
×
  • Create New...