Jump to content

froot

Members
  • Posts

    686
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by froot

  1. OK Hannacode ist cool and I think to know how to use it, however, it doesn't really solve the issue here. Basically I have a pool of images and each image has exactly one HTML-caption preferably created with a CKEditor field. If I use a repeater field for the bodies, I shouldn't have any problem doing a one-by-one loop of images and bodies (i.e. image - body - image - body - …) in order of appearance. There is no benefit in using Hannacode for this at all. My concern is rather, that the "caption" is not really assigned to the image in regards to the database structure. If I ever want to return the same on a different page, or search it, there would be no API call for that. Is it clear what I mean?
  2. yes I agree, it's quite hard-coded this way, I should make more options available.
  3. Thanks for your suggestion, but I don't think I like that one, reminds me of WordPress and the way it handles media. I don't need new pages or separate IDs for each image, just an editor in the caption field. What I had in place was almost perfect. I tried with TinyMCE which throws no errors and renders in the image field, but it doesn't work, I cannot type. I might just add an images-array-field to upload all images for the page and add a repeater field width CKEditor that also includes a Hannacode somehow.
  4. OK I now basically just added… if ($image) : $image = '<img class="ImageTags" src="'.$this->resizeImage($image).'" alt="'.$image->description.'">'; endif; and further below… $image .= '<img class="ImageTags" src="'.$this->resizeImage($image).'" alt="'.$img->description.'">'; and then the function… function resizeImage($image) { $width500URL = $image->width(500)->url; return $width500URL; } to the very module itself. It does what I need but I doubt this is good practice, what if I ever update – rhetorical question. Can I use a hook instead? It's not hookable afaik, as I don't see any underscores.
  5. I also tried the module https://processwire.com/modules/image-extra/ but firstly it doesn't support CKEditor fields either and secondly it is no longer maintained. Now leaning towards repeader fields to meet my needs, although that is not an ideal solution because you have to upload each image separately. Any alternatives?
  6. For a different project, I'm using this module https://processwire.com/blog/posts/pw-3.0.142/ to have a HTML caption for a specific images-field. But I need a CKEditor instead, which is not allowed… I get an error right where the field renders in the admin that type InputfieldCKEditor is not supported. Do you know of any alternatives to this module?
  7. I'm using this module TextformatterImageTags on a CKEditor-body-field. It allows to insert images sequentially with a simple shortcode inside the body without having to add the images manually. It works great and saves a lot of time. How can I set a default size by which the images get resized though? Any idea how that is achievable? Let's say I want a max-width of 500 px, I know how to do that via API for individual images but how do I access the images here? All I do to return the body and the images inside is echo $page->body; Do I need to configure the CKEditor? or the body field? or the image field? or use some arguments with the API method? Or do I use hooks? Hook what though, the body field? images field? the TextformatterImageTags module? Thanks for help!
  8. but here is a general question: When I created a new PaginatedArray; and then ->add($differentItems) // to it, pages and table rows, doesn't matter (or does it?) Then I want to echo $pager->render($rowsAndPages, $options) // but this doesn't work do I use ->setLimit(20) and if so, do I do that before I add the items or after they've been added? Anyhow, page just won't paginate. Thanks for help.
  9. Hi, PW version 3.0.169 php version 7.3 SnipWire version 0.8.7 The site is in test mode. I got the tipp from snipcart.com support to use v3, I only then realised from reading the forums that it's not supported yet so I undid the changes to return to v2 but the price problem persists. Thanks!
  10. I'm having troubles creating a pagination with rows from a ProFields table. $indices = array('title', 'address', 'country'); // those are the fields that I want to search $matches = new PaginatedArray; $category = 'whatever'; $limit = 'limit=25'; $o = '~%='; // the operator :D $q = 'whatever'; foreach ($indices as $i) : $items = $page->table("$i$o$q, category~%=$category"); foreach ($rows as$r) : $matches->add($r); endforeach; endforeach; This works it filters alright with both criteria. I have to do this looping, many other ways failed because multiple selectors don't work with ProFields Table, at least for now. But I can't get it to paginate one way or the other. $pager = $modules->get("MarkupPagerNav"); ?> <div><?php $pager->render($results, $options)?></div> Thanks for help!
  11. textformatters=TextformatterEntities in my field settings cause problems when moving data around (exporting, importing). I can't get rid of the entities in my code and so I have troubles filtering and selecting the content (I tried $sanitizer->unentities, actually need to apply that twice for it to look good but still does not filter/select properly). I figured It must be possible to change the format in the field directly and once and for all. What other options does "textformatters" allow? Because deleting it altogether doesn't work at all. thanks
  12. I'm having and always have a hard time building PaginatedArrays, I never know where to put the "limit=24" selector so please enlighten me. Here's what I'm doing… $categories = $page->protable('start=0, limit=999999'); // this I need in order to retrieve the pages's "categories" and I don't know how to make use of $rows instead for that purpose because of this confusing limit-API $rows = $page->protable; // put ("limit=20") here? $custom = buildSelector($input, $rows); // this function returns an array of selectors depending on the user input $items = new PaginatedArray; // or here? // or here? $items->find("limit=20") // or like this? $items("limit=20") // or like this? $items = $items("limit=20") // or like this? $items = $items->find("limit=20") foreach ($rows as $r) : if ($custom->get('selector')->matches($r)) : $items->add($r); endif; endforeach; // or at this point? and then if ($items) { // or maybe somewhere here? echo '<span class="grey">'.$items->getPaginationString(array( 'label' => 'entries', 'zeroLabel' => '0 entries', // 3.0.127+ only 'usePageNum' => false, 'count' => count($items), 'start' => $items->getStart(), 'limit' => count($items), 'total' => $items->getTotal() )); and then of course… $pager = $modules->get("MarkupPagerNav"); echo '<div class="uk-flex uk-flex-center">'.$pager->render($items, $options).'</div>'; I'm out of ideas and confused cause it doesn't make sense to me either way. ____ The buildSelector function above returns and array… $selected = new Selectors("$letter, $searchterm, $category"); $custom = new Wirearray; $custom->set('selector', $selected); $built->set('sort', $sort); return $custom; and each of the new selectors are basically strings ("category=whatever") Also, you cannot put the "sort=title" or whatever as a selector for the Selectors function (see above). Why, I know not. I don't know if that is the proper way but selecting kind of works now as opposed to many other ways I tried. Selectors always require a lot of trial and error, it seems to have a very sensitive API, always depends on double quotes, single quotes and how you concatenate. Thanks for help!
  13. where to preload fonts? because my <head> (_head.php) is included in _main.php which is loaded last. _init.php? ready.php? these are my preloading tags: <link rel="preload" as="font" href="<?=urls()->templates?>styles/MyFontsWebfontsKit.css" type="text/css" crossorigin="anonymous"> <link rel="preload" as="font" href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" type="text/css" crossorigin="anonymous"> I tried all the above, if I delete cache, I still get a peek at the content without the fonts.
  14. I'm having troubles with the taxes in SnipWire. Here's what how I set it up I put the net-price in the product price field In SnipWire settings I selected: Taxes Provider: Integrated (SnipWire) (not sure about this) Taxes included in prices: false Taxes configuration: Tax name: vat_10, Rate: 0.10, Shipping: false (not sure about this) Shipping Taxes Handling: Apply a fixed tax rate (not sure about this) in snipcart_item_taxes field settings: which types of taxes should be listed as options? Product taxes With these setting, the select-field snipcart_item_taxes doesn't show any options. Nothing seems to change anything, except when I change the types of taxes in the field setting to shipping taxes (or all types) which I find quite confusing. If I try that though, the taxes still don't apply to the products. Not on the product directly before adding to the basket – which it should – nor in the basket before returning the total sum. In the snipcart.com account I can also see the 0.10 tax rate for products somewhere but that doesn't change anything either. To my understanding, the poduct itself should be taxed and the shipping should be taxed as well, with or without the same rate, I'm not sure. As of now, I don't see any. Is that one of those things that will only work when the shop is live? Because I actually have a local and a live installation in development, both don't do as they should. I recently tried to install v3 of SnipWire, but that caused a lot of issues, one of which was/is the price format which didn't allow for commas as decimal separator thus multiplying the prices by 100. I changed the version back to v2 but the wrong prices persist in the snipcart.com-account indexed products and I can't seem to re-index the prices. Not sure if that issue is related. Thanks for help!
  15. I'm using custom fields for images (as mentioned here: processwire.com/blog/posts/pw-3.0.142) for a specific images-field, the images of which need to have an HTML-caption. It works fine so far. Now I'm trying to import pages that use this field. I first exported some pages of that kind to see what the spreadsheet would look like. It seems to not separate the captions for each images but instead put all images in one cell and all captions in another. How could I go about importing these pages and assign the captions to the images accordingly?
  16. the first row actually does the trick already, why do I need the second? limit=0 also works BTW Thanks!
  17. I have a profield table and one of its fields is called category. I want to use the values of this field and created a unique array which I use for the options-filter. $rows = $pages->get('path/to/parent/page')->protable; $categories = new WireArray; foreach ($rows as $r) : if ($r->category != '') : $categories->add($r->category); endif; endforeach; $categories = $categories->unique(); So I loop through the $categories array and output an option field for each. This kinda works but not with the pagination. On the second page it would only show the "options" (categories) of those entries that the unfiltered array would show on a second page. Where's the problem?
  18. the .DS_Store was the issue, Tracy Debugger was even clearer about that. But since I couldn't see it on the ftp server, I re-created the folder in the cache folder, moved the images there and deleted the old one. That worked! no errors anymore. As for the double import of the images, the issue was the following line wrong: 'destinationPage' => $np->id, correct: 'destinationPage' => "$np->id", Anyway, it works now, thanks! How would I do that?
  19. Don't know why but It now adds every image twice, very strange. In the error that is listed it says site/assets/cache/AdminActions/4105/.DS_Store but that file is nowhere, even when showing hidden files. It would make sense if that was the issue. I know this is not module related but still worth mentioning. Here's my code again… $newpages = $pages->get("title=2020/05")->children("template=article, sort=id"); foreach ($newpages as $np) : $np->of(false); $options = array( 'sourceFolder' => '/path/to/site/assets/cache/AdminActions/'.$np->id.'/', 'field' => $fields->get('images')->id, 'destinationPage' => $np->id, 'deleteFolder' => 0 ); $modules->get("ProcessAdminActions")->FtpFilesToPage($options); $np->of(true); endforeach; Thanks again for help!
  20. it's weird, cause it works for the first of the six folders, but fails at the second one, so I doubt it's a path issue. I'll investigate.
  21. 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?
  22. 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?
  23. 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.
×
×
  • Create New...