Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

88 Excellent

About a-ok

  • Rank
    Hero Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

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

  1. Ah thanks @teppo I didn't manage to find this. Much appreciated. @adrian Thanks also! And yeah 🙄
  2. I was using MAMP for local development for years and Tracy never had any issues. I've recently just switched to using Laravel Valet with the custom driver and all seems okay but when I enable Tracy I get the following error. When I disable Tracey and debug `$_SERVER['REQUEST_URI']` it returns false. Any thoughts on how I can continue to use Tracy (which is so brilliant useful) when using Laravel Valet? Thanks!
  3. Hi folks, I've been moving away from a local set up of MAMP to Laravel Valet, which all seems okay. I'm using the PW driver too. I'm assuming that's working ok? Only issue I seem to have is with two modules: Field: Fieldtype 'FieldtypeRepeaterMatrix' does not exist Field: Fieldtype 'FieldtypeFieldsetGroup' does not exist These were installed and in use on my previous set up (MAMP) and the files are all there in the site/modules/ folder but for some reason they're not getting picked up? I've tried refreshing the modules as well as clearing the compiled files but no luck. Any immediate thoughts? Thanks!
  4. Bump? Still unsure of how best to fix this...
  5. I am not sure either. This helped me loads! Thanks!
  6. I believe the error was in fact the use of `->not()` as I was supply a PageArray to remove and not a selector? I simply changed this to the below which seems to have the same effect without the error? foreach ($results as $result) { if ($result->template->name == 'repeater_modulesA' && ($result->getForPage()->is('unpublished') || $result->getForPage()->is('trash'))) { $results->remove($result); } }
  7. I'm using the selector operator %= when returning search results: $searchQuery = $sanitizer->text($input->get->q); $searchQuery = $sanitizer->selectorValue($searchQuery); $input->whitelist('q', $searchQuery); $fieldsToSearch = 'title|text|textA|textarea|projectsCategories.title|projectsClients.title|aboutPressCategories.title|aboutPressClients.title'; $templatesToSearch = 'projectsSingle|shopSingle|typeSingle|typeCustomSingle|typeCustomSingleB|aboutPressSingle|repeater_modulesA'; $results = $pages->find("$fieldsToSearch%=$searchQuery, template=$templatesToSearch, sort=sort, check_access=0"); However, I'm getting an error: ProcessWire\WireException Unknown Selector operator: -- was your selector value properly escaped? field=, value=, selector: If I change the operator from %= to = then no error is returned but obviously this isn't the ideal operator for what I'm doing. However, to create even more mystery, this error seems only to be returned when using certain words. For example 'house' will return the error but 'houses' won't. So now I'm thinking the error is actually not related to the above but actually to what follows... $resultsToRemove = new PageArray(); foreach ($results as $result) { if ($result->template->name == 'repeater_modulesA' && ($result->getForPage()->is('unpublished') || $result->getForPage()->is('trash'))) { $resultsToRemove->add($result); } } if (count($resultsToRemove)) $results = $results->not($resultsToRemove); $resultCount = count($results); This part is required as I am searching repeater templates using check_access=0 but obviously don't want unpublished repeater rows or trashed repeaters to be returned so I need to do a little check. I think this is maybe where it's breaking but can't know for sure. I'm also unsure why it would break for the search query 'house' but not 'houses'? If I can provide any more info to help me resolve this I can do... just a bit stumped.
  8. a-ok


    Is it possible to assign a PDF filename via a hook? I want to assign a different filename (custom, not using {page.id} etc) for different pages.
  9. @kongondo Thanks! Using vanilla/alpine/react sort of thing but yeah principle should be the same 🙂 Okay great. Will be in touch if I have any more questions but super appreciate the help/advice.
  10. @kongondo This is super interesting. My set up in PW is the following: Works Categories Artworks Digital Painting Books Editions Work Work Work Activities Categories Events Reading Talks Workshops Exhibitions Curated Group Solo Publications Anthologisations Books Editing Essays Activity Activity Activity And what I'm wanting to do on the front end (with JS) is when the user clicks 'Works' then it shows the first category level ('Artworks', 'Books', 'Editions'), then if the user clicks 'Artworks' it would show 'Digital' and 'Painting' while keeping the previous 'parents' active. I'll figure out the JS somehow for the menu but I'm guessing your method (which I think is a super smart way of doing it) would structurally allow for this sort of functionality?
  11. I realise this post is SUPER old but I'm after something similar that outputs/builds an array, rather than markup. Something like... menu => array( main => array( 1023 => array( id => 1023 title => 'Menu item 1', children => null ), 1024 => array( id => 1024 title => 'Menu item 1', children => array( 3000 => array( id => 3000 title => 'Child menu item 1', children => null ), 3001 => array( id => 3001 title => 'Child menu item 2', children => null ) ) ), 1024 => array( id => 1024 title => 'Menu item 1', children => array( 3000 => array( id => 3000 title => 'Child menu item 1', children => array( 4001 => array( id => 4001 title => 'Child menu item 2', children => null ), 4002 => array( id => 4002 title => 'Child menu item 2', children => null ) ) ), 3001 => array( id => 3001 title => 'Child menu item 2', children => null ) ) ) ) )
  12. I'm attempting to build a dynamic filtering menu. I have two main templates ('activities' and 'works') and these all share the same children template 'singleA'. Work - Work a (singleA) - Work b (singleA) Activities - Activity a (singleA) - Activity b (singleA) Within each (singleA) template you can tag it with as many keywords as you wish. These keywords all share the same template 'keyword' and can have infinite children. Keywords - Event (keyword) - Talk (keyword) - Exhibition (keyword) - Solo (keyword) - Group (keyword) What I am wanting to achieve is when a user clicks on 'Work' in a menu, it'll show all the keywords with a depth of 1 that have 'works' (singleA) tagged. Then, when the user clicks the keyword 'Exhibition', for example, it'll show all the keywords, with a depth of 2 etc. I'm using @Robin S's `Connect Page Fields` for this. All the data is set up it's just I'm getting stuck trying to work out how dynamically build this as the depths could be 1, 2, 3 or 40 (unlikely but still keen to keep it dynamic). Any thoughts? $menuPages = $pages->find("template=activities|works"); foreach ($menuPages as $menuPage) { $keywordsAll = $pages->find("template=keyword, singles.parent=$menuPage"); foreach ($keywordsAll as $keyword) { } }
  13. Thanks @MoritzLost for the reply! The token is simply one token for the whole API that expires every 60 days. If you refresh the token, before it expires, it gives you a new token, otherwise you have to go through the pain in the ass Facebook OG process setting up a token again. The initI’ll token, which I get manually, has to be set first and after 30 days (to give the 60 days expiry some cushion!) it should run the refresh call and replace it. And so forth. I guess I could just set up the cache with the init API manually, without it being programmatic, and then just run the usual expiry test but I thought it would be nice to have it work from the get go. Also I guess another issue is when it expires it needs to run the refresh call with the token that’s due to expire but at that point it will have already expired in the cache and therefore not exist...
  14. Hmm I just tested this and it removes it after it's expired so null regardless.
  15. Regarding the `$cache` API I need to check whether the cache requested has either expired OR doesn't exist. Normally I just do this usual check which creates the cache if the get method returns null or doesn't exist: $result = wire('cache')->get('instagramFeed', 3600); if (!$result) { $result = $instagramHttp->getJSON($instagramBase); wire('cache')->save('instagramFeed', $result, 3600); // Expire every hour } I need to store an access token in the cache also, which expires every month. However, I need to do a check whether the cache is expired (and run a query to fetch and store a new one) OR if it simply didn't exist (which in theory would only be called once to initiate the cache) which would populate it with a static token. I read this in the docs: Am I right in thinking if I call `wire('cache')->get('instagramFeed', 3600);` and the cache exists but is expired it wouldn't return null but rather an empty string? But if the cache doesn't exist then it returns null? And therefore I could do a check like so? $instagramHttp = new WireHttp(); $instagramAccessToken = wire('cache')->get('instagramAccessToken', WireCache::expireMonthly); if (!$instagramAccessToken) { // null = doesn't exist = use static token $instagramAccessToken = '123456789010'; } else { // 'blank' assumed expired $instagramAccessToken = $instagramHttp->getJSON("https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=$instagramAccessToken") }
  • Create New...