Jump to content

a-ok

Members
  • Posts

    812
  • Joined

  • Last visited

Everything posted by a-ok

  1. As the title suggests I am wanting to add custom options to InputfieldSelect via a hook. I have this in my ready.php $wire->addHookBefore('InputfieldSelect::render', function($event) { if ($event->object->name != 'work_detail_videos_image') return; $page = $event->arguments('page'); $items = array(); foreach($page->work_detail_images as $image) { $items[] = $image->name; } $event->object->addOptions($items); }); I think it's wrong, however. Mainly because the field is within a repeater? The repeater is set to non-AJAX. Any thoughts?
  2. Anyone? Still confused to why it's not working...
  3. It was this ??‍♂️ Much appreciated help here! P.S Do you know why we can't set a max-file size lower than 2mb?
  4. Maybe a combination of this and @Robin S‘s suggestion?
  5. I tried this just as you posted but no such luck... image seemed to upload no problem even though I set 2M and the image was 7M?
  6. Do you know if there is anything similar for InputfieldImage? It doesn't look like it even though it's an extension of InputfieldFile.
  7. Thanks for this, @Macrura This is fine... and then on my home.php template I included the following at the top before anything else: if ($input->urlSegment1) { $name = $sanitizer->pageName($input->urlSegment1); $brand = $pages->get("/brands/")->child("name=$name"); if ($brand->id) { return $brand->render(); } else { throw new Wire404Exception(); } } This seemed to work... best way of doing it?
  8. Sorry to bring this back up... over 2 years later... but I'm a little stuck. I'm wanting to run child pages (website.com/brands/this-is-a-brand/) from the root (website.com/this-is-a-brand/) but when using a hook or urlSegments I am getting nowhere with it. What's the best process to do this? Do I need to enable a urlSegment check on home.php and allow urlSegments? @Macrura included this and have added it to ready.php but I'm unsure of what's meant to happen? Any help?
  9. I'm curious to know what everyone's thoughts are on using ProcessWire to be able to create a sort of 'Pinterest' or 'Are.na' site with similar functionality but harnessing the front end API/capabilities of PW. Similar functionality would include: User account login/registering to access their account/boards Save images from the current site (almost like a wishlist... not external site images) to specific 'boards' and also allow user upload (from desktop) to these boards Allow for multiple 'boards' (categories if you will) Thoughts? Sorry if this is a bit vague... just putting out some feelers.
  10. Thanks for your reply @rafaoski – much appreciated. I guess if I wanted the client to update this the only way would be CMS fields, right? EDIT: I had a look at Functional Fields (and this is what I remembered reading about) but I cannot see the benefit of just creating a normal text field, especially if you have to create a field anyway? Probably missing the point entirely.
  11. I’m sure there was a PW Weekly or blog post recently about best practice for static word translations in your code for multi-language sites (for things like ‘Read more’ or ‘Submit’ etc) but I cannot find it anywhere... Have I made this up?
  12. Is there any way I can find out more about the error?
  13. It works on my dev server and locally so could it be that something isn't enabled? Thing is if I try to get a feed from say The Guardian, it works. I'm stuck.
  14. Thanks, Robin. Must be the forum. See screenshot of what I entered into the console too to check and still get the same error. Weird ?
  15. Not sure why it's showing that. This is my code which was working before it forced https (I changed http to https in the load). $imRss = $modules->get('MarkupLoadRSS'); $imRss->limit = 1; $imRss->cache = 3600; $imRss->load("https://insidemodernism.co.uk/feed/"); bd($imRss);
  16. Hi folks. Does this work over https? A few sites I was pulling the latest RSS feed from, since going to https, now no longer works. I've bar dumped it and it states: error protected => "Unable to load RSS feed at https://insidemodernism.co.uk/feed/: error protected => "Unable to load RSS feed at https://insidemodernism.co.uk/feed/: Any thoughts?
  17. Yes this worked perfectly. I overlooked thinking to use str_replace. Much appreciated!
  18. Apologies if this has been asked before but couldn't find anything... I have a simple tag system set up, which uses an overview template. At the top of my template is as follows: if ($input->get("tags")) { // If GET ?tags= exists... $currentTags = $input->get("tags"); $currentTags = $sanitizer->text($currentTags); $products->filter("stock_detail_tags.name=$currentTags"); // Filter products by the tags $pageTitle = str_replace('|', ' > ', $currentTags); if (!count($products)) throw new Wire404Exception(); // If no returned data then return 404 } The issue is my URL for if someone selects a furniture tag is /stock/?tags=furniture|mirrors which will return pages that have either the furniture or mirrors tag. What I need to do is amend this so it'll only return pages that have both furniture and mirrors tags. I understand what I need to do (use the AND selector) but I'm a little unsure in this setup whether I should be changing the URL or the code?
  19. Good to know I'm on the right track... and it's doing what I need ? I think I definitely need to learn more about having output formatting though... always confuses me.
  20. This looks like just the ticket and good to learn about this. Much appreciated. I'll give it a whirl and let you know how I get on.
  21. Upon further testing it doesn't look like you can inject styles using the str_replace without using Page::render, but when using Page::render you cannot check $user or $page->template so I think I'm at a bit of a loss...
  22. I'm wanting to add in some styles (to "hacky" hide the buttons on a RepeaterMatrix field) on pages using a specific template. I've done this a lot with adding new rows to repeaters etc and the message below appears but I cannot seem to get it to add in the <style></style> using string replace. Any thoughts? function eSubmissionStyles($event) { $page = $event->arguments(0); if ($page->template->name == 'events-detail') { // What's On detail $event->return = str_replace("</head>", "<style>html{background:red;}</style>\n</head>", $event->return); wire()->message('this message works above the above doesn't seem to do anything'); } } if ($user->hasRole('e-submission')) { // Ony required for 'e-submissions' //$wire->addHookAfter("Pages::save", null, "eSubmissionStyles"); // I've tried this as well to no avail $wire->addHookAfter("Page::render", null, "eSubmissionStyles"); }
  23. I'm guessing this does what I think it does? I ran into a problem where I needed to hide a field to a certain user role (and needed to remove it from 'guest') it then disappeared from the front end. I'm guessing this little toggle allows it still to work on the front end but hide it from the backend? If so this is a GOD SEND of a feature.
×
×
  • Create New...