Jump to content

ottogal

Members
  • Posts

    340
  • Joined

Everything posted by ottogal

  1. Hi all, I'd like to give some feedback about the solution I ended up with. To bundle a few extra fields together with each image, instead of using a repeater I used the module ImagesExtra by @justb3a: https://github.com/justb3a/processwire-imageextra I created an ImageExtra field named imagex and added the following fields: startrow, startcol, widthcols, zindex They refer to a grid of rows and columns, each 2rem high and 2rem wide. startrow and startcol are the topmost row and the leftmost column covered by the image; widthcols is the width of the image, given as count of columns. zindex is the value of the usual z-index attribute to control which image is on top of the stack (in case of overlapping images). The picture below shows an image in the grid with the values startrow=2, startcol=4, widthcols=6 and zindex=1. The CSS grid is defined as follows: .wrapper { display: grid; grid-template-rows: repeat(60, [row] 2rem); grid-template-columns: repeat(40, [col] 2rem); grid-gap: 0; width: 80%; margin: 0 auto; padding: 0; } .wrapper div { width: 2rem; height: 2rem; } The CSS definitions for the images are embedded in the HTML code using a style element, allowing the use of php variables. (Note that the value of widthcols is used to calculate the width of the image in the unit rem, stored in the variable $wrem. The height is calculated automatically, keeping the aspect ratio.) The images together with the extra field values are stored in the field $imagex, and in the foreach loop for each of them the class definition is built: <section class="wrapper"> <?php if ($imagex) { $i = 0; foreach ($imagex as $pic){ $i++; $sr = $pic->startrow; $sc = $pic->startcol; $w = $pic->widthcols; $wrem = 2*$w . 'rem'; $zi = $pic->zindex; echo " <style> .no$i { grid-row: row $sr; grid-column: col $sc; } .no$i > img { width: $wrem; z-index: $zi; } </style> "; echo "\n<div class=no$i>\n"; echo "<img src=$pic->url alt='$pic->description' />"; echo "\n</div>\n"; } }; ?> </section> Works like a charm. Thanks again for all your hints and proposals!
  2. Hi all, for testing pusposes I created one single page using an own template. Now I want to create a user with a special role which gives view access just for that single page, not to all the other pages with different templates. The problem is that a new role always inherits the permissions of the guest role, hence view access to all pages. To deny the view permission for the guest role for all the other templates (but not the homepage) is not a way because guest users should view the site normally. Is there a simple solution for this case? I wouldn't like to install some complex module for this... Thank you for ideas!
  3. Suggestions: You could identify the HUMAN RESOURCES page as the first child of the root page: $page->rootParent->children()->first() Or: Add the background image to the rootPage and refer to it from the Office pages.
  4. Thanks for the hint - looks helpful.
  5. @jacmaes @entschleunigung @wbmnfktr @johndoe Thank you all for your efforts. I see that using grids is not so bad an idea. The repeater field option might be easier to handle for an not so savvy editor. I'll do some experiments...
  6. Thank you both. It seems I was not clear enough about the aim. I'm not talking about a masonry type of layout. The images should be freely positioned, indepentent of each other. So a grid solution seems not adequate.
  7. Hi all, given a template containing an Images field (with unlimited files allowed). Editing a page using this template, I'm looking for the ability to position the images freely (within a <section> element of the template - see the image). Is there a way to achieve this? Thinking loud: A CSS solution (with inline style) using position:relative and values for top and left would need these values to be saved as properties of the individual image... Or do I need some JS gallery able to do it? Any ideas are much appreciated.
  8. ATM dist(me, Berlin) > 1,300 km ?
  9. You could try $matches = $pages->find("template=expertsItem, location=$location, department=$department, sort=expertSurname")->not("department=2131");
  10. In the code fragment you showed of your template file there is no output of the image (like @louisstephens proposed). Without more information it is hard to help.
  11. Go to the tab "Details", under "Maximum files allowed" enter 1. Go to the tab "Actions" and assure to have ticked the checkbox of the template you want to have the header image in.
  12. If so, have a look to FieldsetGroups, too.
  13. The MultiValue Textformatter might be of interest for your use case. (I have no own experience with it, though.)
  14. Hi all, wanting to modify the CSS of a core module (JqueryMagnific in my case), but not to touch the files in \wire\, I found this older blog entry: https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-copies-of-the-same-module That might be helpful for others, too. (It's pure fun using PW!)
  15. Hi @tpr, I found an irritating behaviour when using the submodule ListerTweaks. If I make a custom selection of the Users lister columns, it will not be reflected in the columns selection on the Users page: There the default selection is displayed, and trying to change it has no effect.
  16. Citing from the linked doc pages: Here "$count option" should read "getQty" option, shouldn't it?
  17. You could try this: $selector = $pages->find=("(template=x|y|z|a), (template=a, status=hidden), ... See https://processwire.com/docs/selectors/#access_control :
  18. The messages you get refer to your files and line numbers. We don't know what they contain, so hardly can help without more information.
  19. Wasn't aware of that - but found the blog post: https://processwire.com/blog/posts/processwires-roadmap-in-2015/ 1 hour ago, adrian said: The advantages of using this _OR_ syntax are explained in this blog post: https://processwire.com/blog/posts/processwire-3.0.40-core-updates/#getting-one-field-or-another-from-a-page
  20. It's the same with any search term ending with the open bracket, f.e. config( - with or without $. Edit: Not an issue of the missing closed bracket: Same with config() etc.
  21. @ryan On the Docs' page The $pages API variable, the first red link $pages API methods is linking to the page itself (instead of https://processwire.com/api/ref/pages/ ).
  22. I'd prefer the first variant over the second, because the "->" is more suggestive if concatenating in several steps like $page->{parent}->{'headline|title'}. (This concatenation syntax, adapted from JQuery, was it to draw me into PW some years ago, because of its intuitive comprehensability.) The second variant instead could be, I think, even confusing, since it differs from the function version page('headline|title') just in the $ character.
  23. I share this opinion. As far as I see, some of the listed Benefits of the functions API are especially relevant vor beginners, whereas the potential drawbacks mostly refer to situations not occuring to beginners. So I would suggest to use the functions in all the basic examples for beginners, and additionally give them hints to the alternatives (firstly the variables) and link them to the API access documentation.
  24. @adrian Thank you for your concern. All five points are valid arguments, I support them all. And thank you even more for your steady effort to improve this valuable tool!
×
×
  • Create New...