Jump to content

biber

Members
  • Posts

    80
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Germany

Recent Profile Visitors

2,225 profile views

biber's Achievements

Full Member

Full Member (4/6)

18

Reputation

4

Community Answers

  1. Hi @cwsoft, thanks for your hints, I will try the options. Günter
  2. I like to use keys instead of the mouse, whenever possible. Is there a way to walk through a gallery (eg. call the next or previous page) by cursor keys left or right?
  3. Hi @poljpocket, sort (-iname ... ) does not work, because iname_* contain different criteria to sort the images. To have an impression of the site, here's the link: (The new sorting function is not yet implemented completely) http://www.malabu.de But ->reverse(); was the right way, it works! Thanks to you all Günter
  4. hi @ShaunaB1 and @Gideon So, Thanks for your efforts to help to my problem. Unfortunately a simple "-" does not solve my challenge. I also tried a "sort(1/iname_3)", where iname_3 contains a timestamp - no success. @Gideon SoI did a dump on $images in line 32 and it throws a long list of all parts of the image-field. Sorting itself works as desired, but not with an option "image_created descending". Greetings Günter
  5. Hi, I have built a site with some galleries, which can be ordered by different criteria, like place, name or date_created. This works fine, iname_1,2 or 3 can be chosen by user. Now I want to have the option to sort the images "latest image first". Setting "rsort" instead of "sort" in line 31 comes up with this error: Where is my mistake? Any idea? Here is my template: 1 <?php include(\ProcessWire\wire('files')->compile(\ProcessWire\wire("config")->paths-> root . 'site/templates/_head.php',array('includes'=>true,'namespace'=>true,'modules'=> true,'skipIfNamespace'=>true))); // include header markup ?> 2 3 <div id='haupt'> 4 5 <?php 6 7 // output 'headline' if available, otherwise 'title' 8 echo '<h1>' . $page->get('headline|title') . '</h1>'; 9 10 //get all segments and clean segments! 11 $seg1 = $sanitizer->pageName($input->urlSegment1); 12 $seg2 = $sanitizer->pageName($input->urlSegment2); 13 $seg3 = $sanitizer->pageName($input->urlSegment3); 14 15 //check for the second urlsegment not needed 16 if ($seg2) { 17 // unknown URL segment, send a 404 18 throw new \ProcessWire\Wire404Exception(); 19 } 20 21 //check for the third urlsegment not needed 22 if ($seg3) { 23 // unknown URL segment, send a 404 24 throw new \ProcessWire\Wire404Exception(); 25 } 26 // Sortierung übernehmen: 27 $order = $input->get->order; 28 29 // sortiere nach name_: 30 if ($order >0) { 31 $images = $page->images->sort("iname_".$order, SORT_NATURAL | SORT_FLAG_CASE); 32 $session->set($order, $order); 33 } 34 35 // ohne Sortierung: 36 else { 37 $images = $page->images; 38 } 39 40 //normal content without first url segment! 41 if (!$seg1) { 42 43 echo $page->body; 44 if (!empty ($page->name_1|$page->name_2|$page->name_3)) echo '<p>Sortierung nach '; 45 if (!empty($page->name_1)) 46 echo '<a class="tab" href="'.$page->url.'?order=1">'. $page->get('name_1'). '</a>&nbsp;'; 47 if (!empty($page->name_2)) 48 echo '<a class="tab " href="'.$page->url.'?order=2">'. $page->get('name_2'). '</a>&nbsp;'; 49 if (!empty($page->name_3)) 50 echo '<a class="tab " href="'.$page->url.'?order=3">'. $page->get('name_3'). '</a></p>'; 51 52 // output images 53 foreach($images as $image) { 54 $iname_3 = $image->created; 55 $thumbnail = $image->height(100); 56 echo '<div class="rahmen"><a href="'.$page->url . $image.'?order='.$session-> get($order).'"><img class="shadow" src="'.$thumbnail->url.'" alt="'.$image-> kopf.'" title="'.$image->kopf.'" loading="lazy"></a></div>'; 57 } 58 59 } 60 61 //special view output with an url segment... 62 if ($seg1) { 63 // get the image in the correspondent position: 64 $index = $input->$seg1; 65 $image = $page->images->index($index); 66 67 // Link zum vorigen Bild: 68 echo '<a href="'.$images->getPrev($images->$seg1).'?order='.$session->get($order). '"><img src="'.$config->urls->site.'templates/styles/links.gif" alt="voriges Bild" title="voriges Bild"></a>&nbsp;'; 69 70 // Link zur Thumbnail-Seite: 71 echo '<a href="'.$page->url.'?order='.$session->get($order).'"><img src="'.$config ->urls->site.'templates/styles/index.gif" alt="zurück zur Übersicht" title="zurück zur Übersicht"></a>&nbsp;'; 72 73 // Link zum nächsten Bild: 74 echo '<a href="'.$images->getNext($images->$seg1).'?order='.$session->get($order). '"><img src="'.$config->urls->site.'templates/styles/rechts.gif" alt="nächstes Bild" title="nächstes Bild"></a><br />'; 75 76 // Bild zeigen: 77 echo '<img class="shadow" src="'.$images->url . $seg1.'" alt="'.$images->$seg1-> get('kopf|name_1').'" title="'.$images->$seg1->get('kopf|name_1').'">'; 78 79 //echo '<img class="shadow" src="'.$images->url. $seg1.'" alt="'.$images->$seg1->kopf.'" title="'.$images->$seg1->get('name_1|kopf').'">'; 80 81 82 // Textfelder zu den Bildern anzeigen: 83 echo '<h2>'.$images->$seg1->caption.'</h2>'; 84 echo '<h2>'.$images->$seg1->get('kopf|name_1').'</h2>'; 85 //var_dump($images->$seg1->filedata['_109']); 86 //var_dump($images->$seg1->caption); 87 echo '<p>'.$images->$seg1->bildtext.'</p>'; 88 echo '<p>| '.$images->$seg1->iname_1.'&nbsp; &nbsp;| '.$images->$seg1->iname_2. '&nbsp; &nbsp; | '.date("d.m.Y",($images->$seg1->created)).' |</p>'; 89 } 90 ?> 91 </div><!-- end content --> 92 <?php include(\ProcessWire\wire('files')->compile(\ProcessWire\wire("config")->paths-> root . 'site/templates/_foot.php',array('includes'=>true,'namespace'=>true,'modules'=> true,'skipIfNamespace'=>true))); // include footer markup ?>
  6. If I set a var_dump($images->$seg1->filedata['_109']); I get the error
  7. Hi all, still have problems with that userdefined fields: to every image I have defined some fields, represented by a number in the database-field "filedata". Here one example: {"_109":{"data":"ehemalige Post","data1015":""},"_108":"schon lange gibt es hier kein Postamt mehr","_110":"S\u00f6rup Dorf","_111":"","_112":"2024-02-17 00:00:00","_114":""} _109="kopf", _108="bildtext", _110="iname_1", _ 111="iname_2" and _112="iname_3" I can access to this content by $images->$seg1->filedata['_xxx'] for all parts but not to _109(kopf), which is a TextLanguage-field and contains two parts. While I do not need the language-function anymore, I tried to convert it to a simple Text-field, but this lead to a long error-list and no success. Any idea?
  8. My url segments are the names of the images. This works as desired. You may have a look at the site: http://malabu.de It is an elder version, I'm working at a new edition with a better sorting function.
  9. Hi @ngrmm, with $seg1 I am able to access a single image of my gallery. The method is described here: https://processwire.com/docs/front-end/how-to-use-url-segments/ The crazy thing about my template is, that it works with $images->$seg1->get('kopf|name_1') but not with get('kopf') or $images->$seg1->kopf
  10. hi @ngrmm, thanks for your reply. maybe I have shortened my code-excerpt too much 😉 $seg1 = $sanitizer->pageName($input->urlSegment1); $images = $page->images; name_1 defines a sort criteria, not importent in this context. My problem is: At the overview with all thumbnails I can access to my user-defined imagefields (for exemple field "kopf"). But if I select one image I only get an empty string. $images->$seg1->get('kopf|name_1') shows field 'kopf' as expected. $images->$seg1->get('kopf') shows an empty string
  11. Hi, in a gallery I have defined some extra fields to my image-field. As long as I show the overview with all thumbnails I can access to my fields (for exemple field "kopf"). But if I select one image I only get an empty string. Very strange: if I get ('kopf|name_1') it shows the content of the "kopf"-field. ("name_1" is a field at the page without reference to the image) Here an excerpt from my template:
  12. Hi @elabx, thanks for your reply. Maybe, I did not yet understand the technique of "new image fields", and so it was not very helpful to mess around with the database. I will try to purge the relics of the old system from my templates and be happy. Thanks for your help, @elabx, also to @ngrmm, who's hint showed the key page.
  13. Thanks @ngrmm, I have read the announcement about the new custom field option. My problem is: I have a site with about 1500 images with more or less text in ImageExtraFields. This is stored all together in one field 'filedata' as shown in my first post. Now I want to separate this content and put it into fields 'caption', 'description', 'textarea', which are existing in the database, but empty. Here a screenshot of the database structure:
  14. Hi, I have built a simple website based on image-galleries some years ago. (malabu.de) To add descriptions I used the ImageExtraModule by just3be. In the database I can see, that some of the data are collected in the field 'filedata' in the table field_images, while the fields 'caption', 'description', 'textarea' stay empty. It looks like {"_109":{"data":"ehemalige Post","data1015":""},"_108":"schon lange gibt es hier kein Postamt mehr","_110":"S\u00f6rup","_111":"einhundertelf","_112":"2024-02-17 00:00:00"} very confusing. I would prefer to get the content seperated into the standard fields like 'caption', 'description', 'textarea'
  15. Thanks to @netcarver and @da² @da²: Including namespace solved my problem. Additional I had to learn to put this to the first line and to close it by ?>
×
×
  • Create New...