• Content count

  • Joined

  • Last visited

Community Reputation

19 Good

About darrenc

  • Rank
    Jr. Member
  1. @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.
  2. <?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?
  3. 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.
  4. 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?
  5. 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!
  6. 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.
  7. Thanks Robin, I'm sort of confused why that mattered but you're right that I now have a proper multidimensional array... However now, upon upload, the image sizes get created but the upload thumbnail continues to hang in the "working" state http://imgur.com/a/ZkWco I can't save the page and obviously a reload dumps the images. Any thoughts? My code: // return empty array if not set $sizes = isset($this->config->imageSizes) ? $this->config->imageSizes : []; // loop through the sizes and create the images if (count($sizes)) { foreach ($sizes as $size) { $image->size($size["width"], $size["height"]); } }
  8. Somatonic made a module to make image variations, of a custom size, upon uploading them. https://gist.github.com/somatonic/5685631 It works great but it has values hardcoded into the code. $image->size(120,120); $image->size(1000,0); I thought that it might make sense to use the config.php to create a multidimensional array for my thumbnail sizes, that way I could reference them from the module as well as my template. // in config.php $config->imageSizes["foo"] = ["width" => 12, "height" => 34]; $config->imageSizes["bar"] = ["width" => 56, "height" => 78]; But back in my module, when I try to loop through $config->imageSizes or $this->config->imageSizes I seem to get absolutely nothing. I'm also not the best programmer so I'm having a hard time figuring out how I can debug something like this that only fires when an image gets uploaded - I tried wire("log")->save("debug", $myOutput) which could be not the best move. Any help appreciated - the goal is to have one reference set of sizes and then be able to refer to it in the module as well as my templates. Thanks!
  9. Ohhhh very interesting. Thank you very much Martijn. Great answer.
  10. Standard website lives at www.foobar.com and by default the template files are served up from /site/templates/ Can processwire be set up to serve requests from dev.foobar.com by pulling template files from another directory? /devsite/templates or /site/devtemplate/ ?
  11. And actually you really could just drive it all out of page reference fields. For example you could make the field:rating a page reference and add it to your website data structure. website data ​food​[see above] ratings​professional expert intermediate novice none Simply drive the reference from /website-data/ratings/ and then youll have some flexibility if you ever want to change the ratings and turn them to "stars" or assign them numeric values.
  12. teamjoe sally lawrence website data food fruitsapples bananas clementines vegetablesasparagus broccoli cauliflower meatbeef chicken pork Lets say you set up your processwire website like this. Everything in italics is merely website data as pages. team = template "team", and actual viewable page with a template file joe, sally, lawrence = template "employee" the rest = template "generic-data" On the employee template you could attach a repeater called "food_ratings". That repeater could have two fields, "food" and "rating". Field:rating would simply be numeric from 1-10, and field:food would be a "page reference" field. Now when you create or edit a new employee page, you have a repeater where you can attach the data of an arbitrarily chosen new food and then give it a rating value for how much that person likes it, eg: darrenfood_ratings1 = apple, 10 food_ratings2 = broccoli, 5 food_ratings3 = chicken, 9 Could something like this be a solution for you?
  13. Just to follow up to conclude the thread for someone who might search in the future, I've set it up in the following hierarchy: order order form Astep1 step2 step3 order form Bstep1 step2 step3 step4 step5 ​order form N​stepN "order" is the master page (and template) that handles everything via URL segments, and lots of error checking. All of the sub-structure is simply data and organization, no template files for any of the pages and they cannot be accessed directly via the front end. A/B testing is handled through a page-reference field in the order template which allows the client to pick one, or many, order forms to be tested. If there are multiple, a new user is silently assigned a random order form based on that field and stored in $session. Using urlSegments, if a user goes to /order/step2/ the proper page is shown based on that session variable which dictates whether the user should get "step2" of order form A or B. Beyond that all the tracking is handled via analytics JS using flags. Set by variables output by PHP, they reveal which path the user was on, and how far they got. eg: { path : 'order-form-a', distance : 'step4' } I think it's a good solution, so hopefully the design withstands the test of time. Thanks for the guidance!
  14. mr-fan, are you responding to the A/B testing aspect of it? "cliententry-[one|two]" being one process or another randomly given to the user when they visit?
  15. DaveP, yeah I've been looking at URL segments as a way to implement some A/B testing as well. I'll explore that more today since your suggestion seems so well received! netcarver, the form I'm dealing with involves doing calculations, and checking, and logic between steps, which I suppose could be all done via AJAX. Either way it's a bit more involved and that js won't solve my issues, thanks though.