Jump to content

sww

Members
  • Content Count

    14
  • Joined

  • Last visited

Community Reputation

2 Neutral

About sww

  • Rank
    Jr. Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Nope … ~= is even more restrictive … it needs the exact word. so typing "someb" … wouldn't give me anything. The fields I am searching need to have something like "ignore punctuation optional".
  2. Hey there, i am trying to add a kind of "intelligent" search. Is there any way to ignore punctuation and extra chars. e.g. When I type "somebody elses" that I still get the result "SOMEBODY ELSE´S CAR, 2005" The problem is the extra ´ … if I don't type it I don't get the result. So far I am using %=query (which isn't enough, I know) So the idea would be something like that: $selector = "sanitize(title|text)%=$q, limit=50"; I know, it's not gonna work like that … just to illustrate. Best, Stefan
  3. Hi there, I set up the Image Extra Fields + multilang support. UNF the second language is not showing when switching to the other page language. It always displays the default language. Custom field name is "img_title"; Trying to output the field like this: <?=$page->images->first()->img_title;?>
  4. @Soma yeah, just figured it out. stupid me … was thinking to complicated. thx anyway!
  5. Hey there, is there really no way to turn the OR logic into an AND logic when selecting pages by (e.g.) tags? so instead of $pages->find("template=exhibitions, tags=foo|bar") something like $pages->find("template=exhibitions, tags=foo&&bar") so the pages needs to have all requested tags, not just any of them. Thanks, Stefan
  6. @tpr @kongondo thanks again. but i took a second thought on that. for my purpose it's better the visitor gets a designed pdf having all the images in place instead of getting them as single files to their download folder. so i ended up using the fpdf library … works like a charm.
  7. tried full path too … thanks … will try it out asap.
  8. Hey there, i am knocking my brain out here … I am trying to generate a zip file based on image paths coming from a url parameter. Ended up using the zipArchive standard like this way: https://itsolutionstuff.com/post/php-how-to-create-zip-file-and-download-using-ziparchive-example.html. Also tried this method https://processwire.com/api/ref/wire-file-tools/zip/ before … UNF without any luck on both methods. All I am getting is a zip file with zero bytes. No errors appear. I think the file isn't even been created in the first place and it is just downloading the defined zip file coming from $fileName Here is my code: <?php $lb_images = "[".htmlentities($_GET['images'])."]"; // $lb_images = ['/site/assets/files/1062/image-1.jpg','/site/assets/files/1062/image-2.jpg','/site/assets/files/1062/image-3.jpg', ...] function createZip($files_ = array(), $destination = '', $overwrite = false) { if(file_exists($destination) && !$overwrite) { return false; } $validFiles = []; if(is_array($files_)) { foreach($files_ as $file) { if(file_exists($file)) { $validFiles[] = $file; } } } if(count($validFiles)) { $zip = new ZipArchive(); if($zip->open($destination,$overwrite ? ZIPARCHIVE::OVERWRITE : ZIPARCHIVE::CREATE) !== true) { return false; } foreach($validFiles as $file) { $zip->addFile($file,$file); } $zip->close(); return file_exists($destination); }else{ return false; } } $fileName = 'my_zip_'.time().'.zip'; $files_to_zip = $lb_images; $result = createZip($files_to_zip, $fileName); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $fileName); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($fileName)); ob_clean(); flush(); readfile($fileName); exit; ?>
×
×
  • Create New...