Jump to content

psy

Members
  • Posts

    718
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by psy

  1. I've used this code on another site (same web host) and it all works fine. When a visitor lands on a page and they're not logged, the page name/path/url/httpUrl (tried them all) is saved to a session var. Code in _init.php is: $loginPage = pages( 1085); if(!$user->isLoggedin() && $page->id != $loginPage->id) { // not for login page $session->set('returnPage', $page->path); // results in /http404/ stored in session var // $session->set('returnPage', '/rants/'); // works fine $session->redirect($loginPage->url); } Code in the LoginRegister template: if($user->isLoggedin() && !$input->get('profile') && !$input->get('logout')) { // login and go back to the previous page or go to the home page $goToUrl = $session->get('returnPage') ? $session->get('returnPage') : '/'; var_dump($session->getAll()); die; $session->redirect($goToUrl); } else { // let the LoginRegister module have control $content = $modules->get('LoginRegister')->execute(); } This var_dump shows that the returnPage session variable is stored as the path to the 404 error page ["returnPage"]=> string(9) "/http404/" I also tried $page->id with the resulting var (int) 27 which is the 404 Page id. Also tried namespace in the session var... It all worked fine when I manually typed in a valid page path, ie only weirdness when I used the $page var. Any help to explain why this is happening and how to fix greatly appreciated. tia
  2. psy

    Site patterns

    @rajo forgot to mention in my post above... welcome back to ProcessWire
  3. psy

    Site patterns

    You could look at @kongondo's Blog Module http://modules.processwire.com/modules/process-blog/ for your News site and this thread may give you some ideas on how to cut down front end development time
  4. There are loads of favicon generators. I generally use https://www.favicon-generator.org/ then point the link href to the appropriate directory & file
  5. Maybe make the form action '/' and then specify the actual URL in the js code rather than pulling it from the form?
  6. @Macrura Agree 100%. I view Canvas as an extended Bootstrap toolkit - use the bits I want, disregard the rest and add my own custom code without having to reinvent the wheel when I need a particular feature. It in no way limits my options for original design while saving me time & money on FE development. Anyway, works for me and each to their own
  7. For those interested in what's possible with the Canvas template suite & PW, below are a few examples. PS: all recommendations in the Showcase posts actioned and I'm NOT a themeforest affiliate. These HTML templates simply make my front-end-dev work easier. https://flywithmehorses.com.au/ - also in the PW Showcase forum at https://www.goldcoastholistichealth.com.au/ and another biz owned by the same client, https://www.goldcoastosteopathy.com.au/ - this one uses @kongondo 's blog module https://beautifulhumanway.com/ - also in the PW Showcase forum at
  8. @gmclelland Thanks for the feedback . This was my first module, dipping my toe in so to speak. I found the whole schema thing confusing and the module could definitely do with an update. Have taken your suggestions on board - plus a few other things I've learnt about json-ld schemas in the interim - and hope to release an update in the new year
  9. May or may not help... was getting a similar, but not quite the same, error after adding a single auto-load module. Forgot that bit and tried to load it again in a template with a local variable, eg: $mymodule = $modules->get('myModule'); Ambiguous error was: Error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in /home/xxx/xxx/wire/core/Selectors.php line 378) TracyDebugger's error description was no more helpful than the PW logs. While the error message was correct, it didn't truly reflect the cause of the problem. Only by disabling modules (in my case easier cos all worked before adding this particular module), and screening template code, was I able to resolve the problem. Solution for me was to access module's methods as static functions, eg "myModule::someFunction()" in the template. Key difference between 2.x & 3.x is namespaces. Is there a function used by index.php line 64 in your template (or _init.php or ready.php) that needs a namespace (or \)?
  10. @LAPS I haven't used conditional hooks. Instead, I'd have written it as: wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments('page'); if ($page->template != 'user') return; $page->of(false); $page->title = $page->last_name . " " . $page->first_name; $event->return = $page; });
  11. @LAPS just noticed you have Page('template=user')::saveReady. Try changing it to Pages('template=user')::saveReady - ie Pages, not Page
  12. @LAPS hrmm... here is a similar hook that I use and it works fine: /***** Ensure the $page->seo->title field is not empty */ wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); $t = wire()->templates->get($page->template); if($t->hasField("seo_title") && !$page->seo_title) { $title = $page->get('headline|title'); $page->of(false); $page->seo_title = $title; $event->return = $page; } });
  13. Did you try turning off formatting before changing the page field data? wire()->addHookAfter('Page(template=user)::saveReady', function($event) { $page = $event->arguments('page'); $page->of(false); $page->title = $page->last_name . " " . $page->first_name; $event->return = $page; });
  14. @heldercervantes Oops... shared your great blog post on FaceBook and concerned it may have gone viral
  15. @tpr Thank you for this great module. Note to self: When your site is doing something fabulous and you can't remember for the life of you how you did it, check AOS first
  16. I've used https://themeforest.net/item/canvas-the-multipurpose-html5-template/9228123?s_rank=1 for a number of sites and found it covers most of my front end requirements. It has a heap of page templates that are easy to convert to PW templates and individualise for client site looks.
  17. @horst thanks for that tip. Love that I learn something new about PW's inbuilt power everyday
  18. Should also add... if you decide to change the abcd page URL, you should also consider redirecting any backlinks pointing to the old URL to the new one. Module comes to mind but have no idea if it works with PW 2.3
  19. Don't be put off by what your competitors are doing. They can be wrong. Google gives lower ratings to pages that it sees as lower down the page tree... eg page abcd in the tree abcd.com.au/all/about/abcd would rate lower (probably 40%) than page all-about-abcd in url abcd.com.au/all-about-abcd (probably 80% as it's one page off the root) Google is also smart enough to recognise hyphens in URLs as spaces. The only suggestion I would make would be to rename the URL to abcd-is-about - that way abcd is up front Hope this helps
  20. @horst Google is Google... not %100 certain but strongly suspect G adds meta to jpgs it optimizes and so gives higher scores even if the original was fully optimized first. Even so, still regularly getting GSPI scores on mobile 75%+ and desktop 90%+ with PW, Procache etc and with careful coding so no errors on https://validator.w3.org/ . Can only do what I can do. I use the PW site results as comparisons to WordPress site performances to show my clients that PW is the way to go. For me, it's not about getting upset with G, it's more about proving how well PW performs
  21. Like you, I've tried lots of different compression techniques. Seems Google only likes its own compressed files. What I do to get the scores up... 1. Run the test then download the zip containing the compressed images generated by Google Page Speed Insights and expand the file 2. Upload the images to the assets/files/[page#] directory and overwrite the images generated by PW 3. Run GPSI again and your score will soar It's not a long-term answer but helpful in development.
  22. @szabesz yes but stranger things happen on the web! The original PDF's are 'print-ready' so not web optimised and Robin S didn't say how they were 'adapted' to responsive web docs. Just putting an idea out there as an alternative to developing and maintaining a separate app... can all be done within PW.
  23. Had a similar challenge, ie client needed access to PW generated documents when there was no internet access. My solution was to convert the PW pages to PDF and save them to a DropBox folder that synched with their mobile devices. There are many roads up the mountain
  24. Lovely site and unbelievably fast. How did you do that?
  25. Hey @heldercervantes Very nice. I want to go there! Chrome Developer inspector reported: The fontello css was missing on other pages too and guessing I didn't get to see the full beauty of the site due to the missing font?
×
×
  • Create New...