-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
Maybe try this before the script: if (!file_exists("angebote.csv")) { die("Can't find the file!") } If that does trigger you may need to use the full path to the file: wire('config')->paths->root . "angebote.csv"
-
If the default language should be frensh you can just use the default language instead of adding a new one.
-
Validation does not happen on the page level, but in each fieldtype separately and also technically this doesn't happen when a page is saved, but rather right when new values are set to the field regardless of what happens afterwards. So I doubt there's a reliable way to check if the whole page's changes where all validated. Maybe you can check, if the ProcessPageEdit form, that you're using in the backend, validated completely, but that does leave out any changes elsewhere.
-
$page->children->explode("fieldName"); (bool) $page->children->get("fieldName!=''");
-
For such cases please use to the documentation. If you're comparing that with the value of an textfield, than that's ok. Otherwise the leading 0's should also be gone in your existing pages. If you don't need batching you can leave all the calculation to the for loop. // Loop over each line for($i = 0; $i < count($csv); $i++){ if($i == 0) continue; // If first line are the column headlines $data = str_getcsv($csv[$i], "\t", '"'); […] } And I'm not sure why your file is not read correctly. I'd look into the used charset (UTF-8 at best) and if the user running the php command has rights to read the file.
-
Where to set image resizing quality and how to re-resize images
LostKobrakai replied to Adam Kiss's topic in General Support
It says 0 because you didn't specify a height. When using ->size(500, 300) it will be xxx.500x300.jpg. For the sizing issue I cannot help further, there are people more experienced in the topic than me. -
Where to set image resizing quality and how to re-resize images
LostKobrakai replied to Adam Kiss's topic in General Support
Are you re-uploading the image or otherwise forcing a regeneration of those thumbnails? Also are you sure you're looking at thumbs and not the original image? -
I'm just using this importer by myself, but it would need you to use the command line. <?php include("index.php"); // First argument (batchnumber) is required if(empty($argv[1]) || $argv[1] == null) die("Please provide a batch number!" . PHP_EOL); // Convert batchnumber to int and set batchsize $start = (int)$argv[1] - 1; $batchSize = 1000; // Read file $csv = file("newsletter.csv", FILE_IGNORE_NEW_LINES); $length = count($csv); // Loop over each line for($i = 0; $i < $batchSize; $i++){ $key = $start * $batchSize + $i; if($key == 0) continue; // If first line are the column headlines if($key == $length){ die("End of file!" . PHP_EOL); } $data = str_getcsv($csv[$key], ";", '"'); // Change csv delimiter and quotes if needed // $data is an array of your csv data. e.g. array(1203, 1230) for your cat_adr.csv $addr = wire('pages')->get("oldAddId=". (int) $data[1]); $cat = wire('pages')->get("id=". (int) $data[2]); $addr->of(false); $addr->category = $cat; try { $addr->save(); } catch (Exception $e) { echo "$key: $e" . PHP_EOL; } // Prevent memory overflow wire('pages')->uncacheAll(); } Pack this in a file import.php and put it in processwire's root and the csv as well. Call it from the command line by using "php import.php 1". You can remove the batch part if you don't need it. You can do whatever you need to between the str_getcsv line and the uncache line. If you don't have access to the command line you could still use the script by adding a file inputfield, where you upload the file to the server and read it from there, but you'd need to keep track of things like timeouts in the browser environment.
-
You're on the dev version of pw? Also what's the first if statement doing there? $page is not the page holding the inputfield. It's the page the inputfield is trying to get the label from.
-
Each template has an alternative template option. Pack your device sniffing in the _init.php and change "$page->template->altFilename" to whatever it's detecting.
-
I was confused, because it did somehow link to the MobileDetect module as well. I've no clue why.
-
Should be. I've currently not the time to test this further, but it looked like the inputfield will just pass the string to the getMarkup function.
-
Are you sure you got the right link here? @topic Browser detection on the server side is quite flawed, so try to not use it. But there are things you can do on the server, like detecting webp support and other things based on the request headers, which does help in terms of squeezing the last bits of performance out of your website, but it's a long way before these really matter.
-
Moved to dev talk
-
What exactly do you mean by adaptive? For me adaptive means just a less fluid form of responsive design, with just few hard breakpoints, which doesn't seem to be what you need.
-
Sure, somehow I imagined the topmost pages to not have parents anymore xD But the feature is still the right call. The page inputfield is calling Page::getMarkup, which you can simply hook. In the field settings just use insert "MySpecialLabelKey" or whatever string you want to init the hook. $wire->addHookBefore("Page::getMarkup", function($event){ $page = $event->object; $key = $event->arguments(0); if($key == "MySpecialLabelKey"){ if($page->template == "manufacturer") $key = "{title}"; if($page->template == "model") $key = "{parent.title} {title}"; } $event->arguments(0, $key); });
-
https://processwire.com/blog/posts/processwire-2.6.16-core-updates-more-on-prodrafts/#page-fields-now-support-custom-format-labels Does this work for you?
-
To soften that statement a bit: $sanitizer->url() is still needed to sanitize input to a valid url, but to use the url as part of a selector you need to also use $sanitizer->selectorValue() as well.
-
It shouldn't matter on which pages the dropdowns are. Only the relation (parent/child) between the choosable pages must be correct.
-
You could switch dependencies, where Pages2Pdf installs WirePDF, instead of requiring it to be installed previously.
-
I've already add this to github, as even the first option should be able to just download the thing without installing. https://github.com/ryancramerdesign/ProcessWire/issues/1387
-
You can set it up, so that other users get Reno as default.
-
Not a problem with your installation. I think it's a problem of lister in general.
-
Yeah, that's better for sure. But I'm still wondering, why sorting isn't changeable via a filter.
-
I doubt this being a filesystem / apache problem, as then no pages would work at all. What are your access settings on the home template?