Jump to content


  • Posts

  • Joined

  • Last visited

darrenc's Achievements

Jr. Member

Jr. Member (3/6)




Community Answers

  1. Okay fair enough I haven't tested this yet either but lets say it works... i would presumably get the same reference doing it the longer way: foreach ($image->getVariations() as $variation) { if ($variation->width == 201) $image->removeVariations($variation); // nope if i have $variation as the reference to the exact same file, how do i remove it from the variations-stack for the image?
  2. Is there a way to delete a specific variation of an image without simply nuking every single variation? I've been working with processwire for a while and I'm surprised this isn't possible given the things you can do with different arrays of PW objects. Here's what I've tried: $image->size(200, 200); $image->size(201, 201); $image->size(202, 202); $image->size(203, 203); $image->removeVariations("width=201"); // nope $image->getVariations()->find("width=201"); // nope $image->getVariations()->get("width=201"); // nope foreach ($image->getVariations() as $variation) { if ($variation->width == 201) $image->removeVariations($variation); // nope if ($variation->width == 201) $variations->delete($variation); // nope if ($variation->width == 201) $image->delete($variation); // nope if ($variation->width == 201) $variations->remove($variation); // nope if ($variation->width == 201) $image->remove($variation); // nope }
  3. I understand the desire to cut down on the core size especially when the profiles are just implementations of the same thing to help beginners. However I think both beginners and pros could benefit from having the installer simply accept a zip file of the profile they want to install, and rather than providing instructions on what one has to do to get the profile unzipped and named in order to install correctly... simply let the installer handle it. Reduce that screen to two options: Start with a blank profile Upload an existing profile Perhaps two buttons, and the upload your own button reveals some more instructions: a link to the starter examples (which provide zip downloads), and an explanation about how it accepts exported profiles, and a file input. Providing the file and clicking next should be enough to have the installer unzip and ready the profile for installation - thus simplifying this screen and making it less intimidating for beginners, easier for people who have a starter theme downloaded in zip, and faster for people who use their own. Possible?
  4. To echo what @cstevensjr @dragan are experiencing, I get the same issue when trying to install the module via classname. I opened a github issue about it. However, I was able to install successfully by using the zip file link and providing the github repo master.zip url https://github.com/blynx/MarkupProcesswirePhotoswipe/archive/master.zip Hope this works for you guys too. Thanks @blynx!
  5. ahhhhhhhhhhhhhhhhhhhhh great! thank you kindly @adrian
  6. lets say, in _main.php I have some placeholder regions for content/sidebar <div id="content">foo</div> <div id="sidebar">bar</div> in my home.php template, maybe i don't want the sidebar div at all. But when I put in the intentionally blank code <region id="sidebar"></region> I simply make my sidebar div blank, it doesn't remove it. Q: Is there a slick way to simply nuke that div#sidebar entirely from markup?
  7. In my map I want to turn the clustering off. What's the simplest way?
  8. I'm trying to understand how I could have users log in as "members", provide them with a customized experience, but still serve them cached pages? For example let's say I have 3 roles Guest Member SuperUser And let's say I have a NavBar type component that has a menu. Plus it has "log in!" if guest, or "logged in as Mike Smith" I would want guests to see a cached site with guest-only page access. Members should also see cached pages, but their menu may have access to members-only pages or fields or information. Furthermore they might have a "logged in as Mike Smith" element. SuperUsers can stay uncached. How does one go about creating that cache so that visitors aren't constantly re-creating the menu? Or that when "Sally Baker" logs in, she doesn't see a homepage that is cached for "Mike Smith" with all his elements? Thank you in advance for any replies.
  9. frequently i do something like the following expanded simple version.... foreach ($foos as $foo) { // always a title & link $title = " <h1 class='foo__title'> <a href='{$foo->url}'> {$foo->title} </a> </h1> "; // sometimes a headline $headline = NULL; if ($page->headline){ $headline = " <h2 class='page__headline'> {$page->headline} </h2> "; } echo " <div class='foo'> $title $headline </div> "; } the short take away is that i... know certain fields will exist, and i want to wrap them in specific tags/classes have fields that might exist, and i want to wrap them in specific tags/classes or output nothing silently want to wrap all of the output Probably due to inexperience, I haven't found a slick way to simplify this pattern for myself. Using a function and arguments seems very messy to me because it can get complicated to maintain as pieces need to change. maybe I just write crappy functions. Do you guys have a very maintainable way to output a fields value, always wrapped in specific tag/class, but only if it exists?
  10. @abdus that's an approach i'm not at all familiar with, thanks very much i'll experiment with it. @fbg13 interesting, I wonder why that is done.
  11. <?php namespace ProcessWire; class Foo {}; $foo = new Foo; $foo->message = "hello world"; function print_foo() { global $foo; print_r($foo); } print_r($foo); // success print_foo(); // nothing ?> In any template file, or init, the above code doesn't pull $foo into the function's local scope. It seems to not exist even though I'd fully expect it to be there. Does anyone have insight into why this happens or how I should be approaching it?
  12. OHHHHHHHHHHHhhhhhhhhhhhhhhhhhh. God, I feel dumb but honestly I was totally perplexed by that. Thank you so much LMD. I will try it out and see.
  13. What I did edit the default 'body' field (textarea, ckeditor) field > body > input: "enable ACF" checked "yes" by default field > body > input: "extra allowed content" ... The instructions indicate "Example: img[alt,!src,width,height]" in order to enable a tag with attributes you want to allow through the filtering. a[class] I wrote the above expecting that now i would be able to class my a tags in the editor, maybe make one a "button" style or whatever. However, this doesn't actually work as it seems Extra Allowed Content doesn't actually do what it indicates. I've tried a dozen different variations and after googling here and seeing some responses in other threads, I think this should be addressed. The box is a nice way to enable a few attributes the user might want to allow for clients or themselves, I don't see why one would require making a module or going above and beyond the tools and text areas already provided in order to simply allow a few attributes. I could turn ACF Off entirely, but that doesn't really address the problem: I want to filter the input for clients but still configure some tweaks that I deem would enhance and not break the site. Simply: it's there, it's nice to have, should work right, but it doesn't seem to. Help?
  14. Is it possible to make a page field, that outputs options based on what a user has selected in a previous page field? Template data setup house (template) title (text) body (textarea) neighborhood (page field) neighborhood (template) title (text) Obviously it's set up with lots of neighborhood pages, and if you create a house you get a dropdown of those neighborhoods which you can select. What I want to do featured_neighborhood (template) title (text) body (textarea) neighborhood (page field) homes_in_neighborhood (page field) The goal would be for the user to create a new featured neighborhood, choose the neighborhood reference, and then homes_in_neighborhood would be a selection dynamically created from whatever neighborhood that is. Is this possible in PW? Thanks in advance!
  15. Thanks so much Robin, that definitely does work for me as well. I wish I understood the "why" of this a bit better (the array weirdness, and why ready.php worked differently from the module when not hard-coded), but I guess I'll plow ahead and return to this later. Thanks again for your help.
  • Create New...