Jump to content

froot

Members
  • Posts

    721
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by froot

  1. yes, the second issue is fixed, thanks. in Pageimage.php it says: protected function ___install($filename) { parent::___install($filename); if(!$this->width()) { parent::unlink(); throw new WireException($this->_('Unable to install invalid image')); } } Not sure, what ->width() does, might the images be too small?
  2. I'm having new issues with this. I have 6 folders in the site/assets/cache/AdminActions/ When I run the code discussed above, it throws a (I'm paraphrasing cause I'm translating): Error: Exception: Invalid image, cannot be installed (in wire/core/Pageimage.php line 1644) #0 wire/core/Wire.php (397): Pageimage->___install('/Applications/M...') #1 wire/core/WireHooks.php (823): Wire->_callMethod('___install', Array) #2 wire/core/Wire.php (465): WireHooks->runHooks(Object(Pageimage), 'install', Array) #3 wire/core/Pagefile.php (183): Wire->__call('install', Array) #4 wire/core/Pagefile.php (134): Pagefile->setFilename('/Applications/M...') #5 wire/core/Pageimage.php (166): Pagefile->__construct(Object(Pageimages), '/Applications/M...') #6 /wire/co And also then it deletes the folder (although I clearly put 'deleteFolder' => 'false', The images are all .jpg and between 30KB and 1MB in size. Any ideas why that could be?
  3. I made some progress with this, but I have some basic questions, because of some basic obstacles. Since the module I'm trying to build makes an AJAX-request, how can I call the file? Obviously I want to put the ajax-called file inside the modules/EventsCalendar/ folder, and not inside the root folder. My .js does the following at the moment which doesn't work for obvious reasons (forbidden): pullEvents.open("GET", "../site/modules/EventsCalendar/_loadevents.php?m="+m+"&y="+y+"&d="+d+"&view="+view, true); Also, I need to know how to include a javascript in that module. It's required for at least two of the class's functions. Is there a way to not require the user to add the <script type="text/javascript" src="/path/to/js/file/"></script> manually? How about css, how can I include that automatically? Ideally I want to put .php, .js and .css files inside the module's-folder and everything gets included with no further ado from the user. The user would just need to call the methods inside their markup, add some additional css if needed and that's it. Many thanks for help.
  4. thanks, I just saw this now and I'm sure it works cause I found the issue. OK just so to clarify… A is this one: include_once ('_organizer.php'); B is this one: include_once ('site/templates/_organizer.php'); The field itself is set to output Y-m-d which doesn't work with strtotime($item->date_start). A doesn't work, but because B is loaded over ajax and/or because it makes a detour over the root folder, it ignores that output format, outputs the unix timestamp instead and works fine. If I remove the strtotime, A works fine cause the value is formatted anyway but it conflicts with the strftime of B. Very confusing. So when I removed the output format for the field altogether it works. All good now, thanks for the input.
  5. I came across a weird issue with date output and I would appreciate if you could thought-shower with me so I can find the root of the problem. So I have a function that returns the content of a datetime-field. I use this function on two different templates, and used to include it on each of these templates seperately. But then in the process of tidying up the code I put that function on a separate php file in order to just include it on the mentioned templates, so I don't have to apply changes twice in the future, you know the drill. Long story short, when in the code it says: <?=strftime('%A, %e. %B %Y', $item->date_start)?> // cause it's german :D it returns the correct date on one template but on the other I get a: PHP Notice: A non well formed numeric value encountered in… and of course the good old 1. January 1970 with the exact same code! When I change it to <?=strftime('%A, %e. %B %Y', strtotime($item->date_start))?> It fixes the issue for that template but then it shows up on the other… So strange! I might add that the way these two templates include the script differ a bit. include_once ('_organizer.php'); and include_once ('site/templates/_organizer.php'); // this template is in the root folder because it is loaded via ajax Any ideas?
  6. Hi friends, just 7 months ago, I was "just" a designer and a rather semi-developer, still struggling with WordPress sites and more often than not delegating that work to pros. ProcessWire really helped me realising that it's not that hard after all (well it's still hard but it's doable) and you learn a lot just by doing it which has to be true for all developers anyway. So I started coding myself, I might also have to thank the 2020 pandemic to help me focus a bit more than usual, I created a bunch of websites using PW already – one of which I can't wait to put on showcases but it's still not live yet. That is one big personal milestone for me. The next milestone would be to give something back, and so I'd like to take on contributing some code I wrote, namely a event calendar for anyone to use. It's my first attempt doing this so please don't eat me alive. It's not a PW module yet (that's the plan however) just a git but I'm positive it will be useful once it works – well it works but it still needs more work – because if I had found a module that came close I wouldn't have started coding it myself :D With that, I will appreciate all input, be it how to improve the .js (probably especially), or the templates, or guidance how to proceed turning this into a PW-module, and of course, in that last process, no pun intended, suggestions to make it more versatile for different needs. git: github.com/bbblgmsp/ProcessEventCalendar demo: http://foobar.roofaccess.org/events/ Thank you!
  7. I get a very similar issue (repeatedly) SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '4612-0' for key 'PRIMARY' (4612 being the highest page-id, I think) I get the above error message (just 4612-0, 4612-1, 4612-16, … would vary like that) a couple of times when uploading multiple images to an images-field when I upload multiple images at once. It happens on every PW-installation I run on easyname.com webhosting so I doubt it has to do with any modules because the website-installations are quite different and even on the simplest of them it still happens (no hooks or ->save() commands in my php code). Doesn't happen on local though for the same websites and databases. And unfo I don't have any other webhost to compare it with. I talked to the host, they advised me to address ProcessWire. I guess it has to be some basic database structure configurations but it's beyond me and I'm hesitant to mess with it. Might it have to do with the incremental number? Do I need to reset it? How do I? Why is in in conflict? I very much appreciate any help!
  8. @daniel_puehringer I'm facing the same problem, what did resolve this issue for you, may I see your .htaccess file?
  9. @rolisx facing the same problem, how did this end in your case?
  10. thanks so much! It works like a charm now. I did notice the (int) but didn't think to much about it. The problem is my knowledge is a bit all over the place, learning by doing, you know. And I also did try with $fields->get('images'); // some string conversion error or whatever but not with $fields->get('images')->id; // this was the last piece of the puzzle Anyways, thanks again, great module/module-action. I won't even suggest to turn this requirement here into a separate action, I think it's just too simple?
  11. true, now that error is gone, thanks! And I'm four lines further in ? Call to a member function add() on null 78: $destinationPage->$fieldName->add($item->getPathname()); The field "images" is clearly on the template though…
  12. I'm on localhost so it must be '/Applications/MAMP/htdocs/example.com/site/assets/cache/AdminActions/'.$np->id.'/'; // returns e.g. /Applications/MAMP/htdocs/example.com/site/assets/cache/AdminActions/4075/ I wish you were right, but the error persists
  13. that might explain why the folder is not there, cause, you know, haven't written any so far. I tried with $modules->get("ProcessAdminActions")->FtpFilesToPage($options); apparently this is allowed, you can access the module's method via API, however now I get RuntimeException Directory name must not be empty. 74: $dir = new \DirectoryIterator($sourceFolder); How is that possible? neither 'sourcefolder' => $urls->cache.'AdminActions/'.$np->id.'/', nor 'sourcefolder' => "/assets/cache/AdminActions/$np->id/", work but the folders are clearly there and not empty.
  14. hm, a little bit confused now. the "actions" folder was and is in site/modules/ProcessAdminActions/. I guess you mean that one when you say "AdminActions" folder and also not in /templates/ ? And I also guess you don't mean the actual /wire/core/ folder. Otherwise I'm more confused. I thought I could do something like $import = $modules->get("FtpFilesToPage"); or $import = $modules->get("ProcessAdminActions"); and then proceed with my foreach (as described above) $import->executeAction($options); but apparently it's not that easy.
  15. it says Call to undefined function ProcessWire\executeAction() Maybe a dumb question – do I need to copy paste the entire mentioned code you put as a reference? I assumed, since the module is installed, that the function is now in the namespace somehow. Thanks for help!
  16. I will try today, I have some concerns with 'field' => 'images', wondering if that's specific enough.
  17. @adrian I'm trying to add in batch the images from separate folders to separate corresponding pages. Judging from the action code that is viewable in the module's settings, I reckon this might work… $newpages; // array of pages to add the images to foreach ($newpages as $np) : $options = array( 'sourcefolder' => "/assets/cache/AdminActions/$np->id/", 'field' => 'images', 'destinationPage' => $np, 'deleteFolder' => 'false', ) executeAction($options); endforeach; What do you think?
  18. any chance we could test ProMailer before buying it?
  19. OK got it working now, I should always never forget that even though it's just one item, it's still inside an array. thanks
  20. so I have a Profields Table on a sibling's page, trying to access it from its sibling's page (DUH!) which is $page now, cause that's where I am right now. I do $toc = $page->siblings("template=tableofcontents")->tableofcontents_table; $toc->render(); or $toc = $page->siblings("template=tableofcontents"); $toc = $toc->tableofcontents_table; $toc->render(); but it just won't work because Call to a member function render() on null The table clearly is there and clearly is a sibling and its template is as stated and the table also. Please help me quick, about to throw the computer out the window, thank you.
  21. OK I got it working now, a little workaround made it happen it's acceptable… if (count($item->images) > 0) : $output .= '<img src="'.$item->images->first->size(450, 250, $options)->url.'"/>'; else : $defaultID = $fields->images->defaultValuePage; $output .= '<img src="'.$pages->get("id=$defaultID")->images->first->size(450, 250, $options)->url.'"/>'; endif; Also needed to be careful about the if conditions to avoid having ->size() be called on a NULL object. Hope this helps someone in the future… cheers
  22. it's working fine. even got the cropping work now. There's no access problem to the real images, just cannot access the default images. I could save the default images in another folder on root level, crop them without the API etc. but I'm not sure this is the easiest way. Any ideas?
  23. I have a related question I believe. I had a AJAX working fine, the markup of which is pretty much identical to what is initially loaded normally – except for the variables's values of course – and the AJAX loaded content replaces that. The php file that is loaded via AJAX sits in the folder above /site/. Now I started to use default images for the images fields and it doesn't work anymore. Default image, just to clarify, I set by creating a dummy page with the same template with the same image field. This works for the normally loaded content, but the AJAX call seems to fail to call functions like size() on the images: Call to a member function size() on bool When I remove the size()-function, the image is there, just not cropped. And also it fails to access the default value for the image fields. Forbidden You don't have permission to access the/path/to/site/assets/files/1234/ Any ideas?
  24. any more advice here? This is my archnemesis, I can't get it to work, I tried in so many different ways. Also, while we're at it, never sure how to escape with selectors… for example if I predefine selectors as $selector = "(events.name~%=$q, events.location~%=$q)"; $limit = "limit=24"; and I then include that to select with either… $items = $page->find("$selector, $limit"); $items = $page->find("$selector", "$limit"); $items = $page->find('$selector, $limit'); $items = $page->find('$selector', '$limit'); $items = $page->find($selector, $limit); or should I do… $selector = "events.name~%=$q, events.location~%=$q"; $limit = "limit=24"; and then either… $items = $page->find("($selector), $limit"); $items = $page->find("($selector)", "$limit"); $items = $page->find('($selector), $limit'); $items = $page->find('($selector)', '$limit'); $items = $page->find(($selector), $limit); what about without variables… $items = $page->find("events.name^=a, $limit"); $items = $page->find("events.name^=a", "$limit"); $items = $page->find('events.name^=a, $limit'); $items = $page->find('events.name^=a', '$limit'); $items = $page->find('events.name^=a', $limit);
  25. why shouldn't I overwrite the title? If I shouldn't and consequently won't, then there's no need for any mentioned work-around-solutions after all. Using the full title (i.e. parents-title/page-title) for the products and the actual title (here short title) for breadcrumbs and admin backend is what I need. Composing the breadcrumbs on the _main.php won't work for me. I was able to accomplish what I need by including _breadcrumbs.php on _init.php. On _breadcrumbs.php I compose the breadcrumb-markup making use of the ->shorttitle and ->fulltitle hooks I created on _init.php, and store this markup in a $breadcrumbs variable. On _main.php I output this variable and done. However, now I'm in doubt again because… What's the concern? It seems to work fine…
×
×
  • Create New...