Jump to content

horst

PW-Moderators
  • Posts

    4,088
  • Joined

  • Last visited

  • Days Won

    88

Everything posted by horst

  1. I think they simply have not! ?
  2. @Sanyaissues I see that there is used GD for the creation of the image variations, (at least some). Please, can you tell me which value you use(d) for "defaultGamma" in your $config->imageSizerOptions (or optional a options array passed to the variation creation)? BTW, the image handling is perfect! Different source sets for landscape and portrait orientation, (native) lazy loading, WebP variations with jpeg/png fallback, - everything is in! ? ? If you or the artist is interested in protecting the original images (the high quality 2000px ones) you may embed a .htacess snippet and the admin-image-proxy php from here.
  3. Yep, there are two images added. Why? If you want to rename that one that is named "index.php", you can try to get it by name from the Pageimages object. $img = $page->imgs->get("name=index.php"); // during testing, fisrt check what you have get in $img !! $page->getUnformatted("imgs")->rename($img, 'newbasename.jpg'); $page->save(); If this doesn't work, maybe because php is no valid image extension, you have to get the image files manually from the URL, beautify the file(base)name and add it after that to the images field.
  4. @rash, you first must (double)check what you get from $imgs->eq() or any other method. What do you see when you debug it, maybe with var_dump()? You also may try to use $imgs = $page->getUnformatted("imgs"); What objects / values do you get from $page->imgs and from $page->getUnformatted("imgs")? And if you have a multiple based object, how many items are in it, which one is the latest added one? $page->of(FALSE); $page->imgs->add($img_url); $page->save("imgs"); $imgs1 = $page->imgs; $imgs2 = $page->getUnformatted('imgs'); echo "<pre>"; var_dump($imgs2); die();
  5. Have you tried to get the last added item from imgs after you saved the page, use the rename method and maybe save it again? (Don't know if a second save must be done or if it is implizit) $img_url = "https://example.com/index.php?cust=foo&id=1234&filename=d9b88153-89e4.jpg"; $img_basename = "GET-THE-NAME-dot-extension-HERE"; $page->of(FALSE); $page->imgs->add($img_url); $page->save("imgs"); $page->imgs->rename($page->imgs->last(), $img_basename); $page->save("imgs"); // maybe this is not needed ?? Also check that the ->last() item is the one you added before.
  6. For me it always was enough to remove unwanted entries from the modules table, regardless if the files were removed or still available.
  7. Hi, you may try to copy the complete wire/modules InputfieldFile folder with all files into site/modules InputfieldFile. Then PW should ask you in the admin that there are two modules and which one you want to use. But please better first try this in a backup copy. I used this sometimes in the past, but not with newer PW versions.
  8. You are in Flow! ? ?
  9. You may have a look to the sort ids. With my old module they initially get setup to 9999999 for the first child. Maybe this is what interferes now. Simply uninstalling the module does not change this. Maybe you temporarily can change the sort order to something different then manually drag/drop, so the tree gets reordered and the sort ids also gets rebuild, (from 0 upcounting instead of the old downcountig from 99999999). And after that, set the sort order back to manually drag/drop.
  10. You can set this under Homepage > edit like shown here: Does this solve your issue?
  11. Oh sorry, I haven't read thoroughly. Please do a var_dump check what the "$xml->anbieter->immobilie->anhaenge->anhang->daten->pfad" contains. It looks a bit suspicious, as it is the same in all image cases. There seems to be a missing differenciation in the node "anhang". Maybe you have to loop over the anhaenge as anhang? foreach ($xml->anbieter->immobilie->anhaenge as $anhang) { // check conditions ... (attributes of $anhang) ... // when found the header image url: $object->object_header_img->add($anhang->daten->pfad); }
  12. I think you simply can use one code line to add a file to a pagefile(s) or pageimage(s) field. When output formatting is off, what it must be when modifying a page via API, there is no difference between singular and multiple file fields. They are always multiple. The difference for a singular field only exists for output! So following your simplified code should work. Can you test this please and report back? foreach ($xml->anbieter->immobilie->anhaenge->anhang->attributes() as $attribute) { $object->object_images->add($xml->anbieter->immobilie->anhaenge->anhang->daten->pfad); } $object->save();
  13. Another thing, on PW site, would be to allow upload of zip(ed) files to pagefile pageimage fields. As a workaround.
  14. Hey @bernhard seems to be a very good timing to me, this release! ? One question: how would I tell the Iframe to load a page with urlsegments? I don't need to render a file- or imagefield but a sort of external or sibling page that need to be called with an id of the current edited page. Is this possible?
  15. Hi @titanium, I don't have had time to install PHP 8 and test out all my sites and modules under it. I will do so with priority for WireMailSmtp. But it may take 1 or 2 weeks, sorry.
  16. The only thing what I remember is a login throttle module. Maybe you can copy this and adapt it for your use case, or borough some pieces of code from there?
  17. Looks fine to me ? Hi @wwwouter, welcome to the forums. To your question about generating a dynamic CSS file via PHP, I would do it like this: 1) create a php file for example called "dyncss.php" and copy it under site/templates/ (look that it starts with a namespace signature "<?php namespace ProcessWire;" 2) in pw admin under setup > templates > addNew create a new template and select dyncss as its template file 3) in your site/config.php create a appropriate content header for css files, according to the advice "To add more content types see contentTypes in /wire/config.php (and add them in /site/config.php)." // in site/config.php merge our custom types into the existing core ones $config->contentTypes = array_merge($config->contentTypes, array( 'css' => 'text/css' ) ); 4) now open the template in backend under setup > templates > dyncss and adjust some settings: a) under family tab set "no, may not have children" and for example "can be used for new pages = one", if you only want to have one unique page of this type b) under the files tab disable the compiler, under content type select css, and if you use delayed output with prepend and append files you have to disable this here for this content type c) adjust others as you may like or need and save and close the template 5) create a page in your page tree that has this template, give the page a page name that you want to call as url for your dynamic css file for example "mycss" 6) put all your php/css magic into the php file under site/templates and add the URL of your generated page where ever you need it in your generated html If you later on want to use more than one dynamic css file, you can decide to allow more than one page with that template, or go the root with url-segments and a single page what I would prefer. But first I hope this can be a good starting point to get you going. If questions arise, come back here into this thread again and ask. ? Happy exploring and coding.
  18. Hi, I use a saveReady Hook and want to set values of the name field according to values from other fields. But only the name field of the default language is updated, regardless of the language the user is in. When saving via API scripts, the result is the same as when saving interactive via page editor. My code is as follows: $this->pages->addHookAfter('saveReady', function($event) { $p = $event->arguments[0]; $lang_DE = $event->wire->languages->get(1016); $lang_EN = $event->wire->languages->get(1018); $newName_DE = 'ein-generischer-neuer-name'; $newName_EN = 'a-genric-new-name'; $p->setLanguageValue($lang_DE, 'name', $newName_DE); $p->setLanguageValue($lang_EN, 'name', $newName_EN); } How can I set (andSave) the other language name too in a saveReady Hook? Or do I need to use another hook for that? EDIT: The above code works as expected. It was interfering with special scripts / hooks on my development site. ?
  19. This exception says that it has found something that was expected to be a object of type pageimage but maybe it is not what can be the case if there is a empty pageimage field in your template and you have not a check for that in your template file, so simply calling pageimage::srcset on an empty object (null). First you should inspect your involved page and template about this. If you find that there is a valid pageimage object (with available image object) that triggers this exception, you must find out why the srcset method isn't known at this state. But I would go first step first. Mostly there is no second step needed after it. ?
  20. maybe this can help you out: https://processwire.com/api/ref/wire-array/sort-flags/ (but haven't tested anything myself)
  21. horst

    Client Login

    here is one from ryan: here is another (that I don't know) and more can be find using the g**gle site search.
  22. horst

    Client Login

    I don't get what you are looking for, if you need no registration in the front. Do you need a Login form in the front? It must have at least a username and a password field, Additionally some security protection like $session->CSRF would be good, for example. There are examples here in the forums for those simple steps. Maybe I will find one. wait, ...
  23. Hey, I know I used it already somewhere but can not remember / find it now. ? Within an Inputfield in a PageEditor, it can be important to detect if the inputfield is on the base page or on a repeater item. Exactly I need to get the precise name of the field. For example if a user named his field foo, I can get the name by calling $this->hasField->name from within my inputfield module. When the field is on a repeater, its final name is not foo but foo_repeater1234. That's what I'm after. What method(s) can help me to get this from within the inpufield module?
  24. Hi @bernhard, thats a nice and short one! ?
  25. Sorry I'm short in time ATM, but I think in general this is handled by PHP https://www.php.net/manual/en/function.set-error-handler.php You will find such function calls in pws wire directories, for example in WireHttp.php and other files. As far as I remember right, it is possible to define multiple handlers in PHP that you can use by "bubbling" (or cascading) and maybe conditionally exit that at any point. You definetly dont't need to hack the core. Maybe the PHP manual is a good starting point. Next would be to find where PW handles it and how to set you above this, do your logging and after that pass the event through to PWs handler where needed.
×
×
  • Create New...