Jump to content

Lance O.

Members
  • Posts

    371
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Lance O.

  1. @Macrura73 I see your point. That's a subtle distinction that makes a big difference. In this case, I don't necessarily need to use a repeater, but I can see cases where I would. I've tested your code and it works flawlessly. Thank you for your eye for detail! @ryan Your example code works perfectly! Thanks for taking the time to work this out.
  2. Thanks @diogo, @ryan, @JeffS, and @Macrura73. I appreciate the help. I've tried the suggestions here, as well as many of my own, but still no luck. These are two solutions that seem to work, but are more verbose: $first = true; foreach ( $page->featured_project->images as $image ) { if ( $first ) { $thumb = $image->image_field->size( 100, 100 ); echo '<img src="' . $thumb->url . '" alt="' . $thumb->description . '" width="' . $thumb->width() . '" height="' . $thumb->height() . '">'; $first = false; } else { } } Another solution: $i = 0; foreach ( $page->featured_project->images as $image ) { if ( $i == 0 ) { $thumb = $image->image_field->size( 100, 100 ); echo '<img src="' . $thumb->url . '" alt="' . $thumb->description . '" width="' . $thumb->width() . '" height="' . $thumb->height() . '">'; } $i++; } To summarize, the Home page includes a field called "featured_project." In these solutions, the "featured_project" field type is "Page" and is set to "Single page (Page) or empty page (NullPage) when none selected" on the field's Details tab. A featured project contains a repeater field named "images" and contains an image field named "image_field."
  3. @JeffS The field type for "featured_project" is set to: Multiple pages (PageArray). Note that for the solutions posted below, the field type for "featured_project" was set to Single page (Page) or empty page (NullPage) when none selected. Here's the set up: Home page -- featured_project (Page field) Project page -- images (repeater field) ---- image_field (image field)
  4. I just deleted all of my existing fields and started from scratch. This definitely does not work: $img = $page->featured_project->images->image_field->first(); echo $img; The error message: Error Call to a member function first() on a non-object
  5. @ryan You are correct. The following code returns the ID of the repeater item page, not an image: $img = $page->featured_project->images->first(); echo $img; Is it possible to retrieve and resize an image that is included in a repeater field from another page?
  6. I want to resize an image that is included in a selected featured project as referenced from a Home page. The "Featured Project" field found on the Home page is using a Page type. The "Images" field included in the "Featured Project" is a repeater field that includes an Image field. How do I access the first image in the "Images" field and also resize the image? This works and returns the ID of the image: $img = $page->featured_project->images->first(); but this doesn't work to resize the image: $img = $page->featured_project->images->first(); $thumbnail = $img->size(236,225); Nor does this: $img = $page->featured_project->images->first()->size(236,225); Any insight is appreciated!
  7. Awesome update to this module. Thanks celfred and ryan!
  8. Is there a more efficient way to code this using children($selector)?: $ancestor = $pages->get( 1134 ); // Get the Section 1 page $find = $pages->find( "parent=$ancestor->children, template=subcategory" ); $assets = $pages->find( "tag=$find, sort=title" ); if ( count( $assets ) ) { foreach ( $assets as $asset ) { echo "<div class='asset'><a href='{$asset->url}'>{$asset->title}</a></div>"; } } The page hierarchy looks like this: - Browse (the page that this code resides on) -- Section 1 (the ancestor page with id of 1134) --- Category 1 ---- Subcategory 1 ---- Subcategory 2 --- Category 2 ---- Subcategory 3 ---- Subcategory 4 -- Section 2 --- Category 3 ---- Subcategory 5 ---- Subcategory 6 --- Category 4 ---- Subcategory 7 ---- Subcategory 8 - Assets -- Asset 1 (tag = id of Subcategory 1) -- Asset 2 (tag = id of Subcategory 2) -- Asset 3 (tag = id of Subcategory 3) -- Asset 4 (tag = id of Subcategory 4) I want to display all of the assets where tag = id of Subcategory 1, Subcategory 2, Subcategory 3, and Subcategory 4. In other words, I want to display all assets that are "included" in Section 1.
  9. If provided the opportunity, I would like to donate $ to ProcessWire. Perhaps as a local/regional sponsor?
  10. @Sevafr2 Thanks for the link to the variation of the infinite scroll!
  11. Thanks for the comments. I implemented infinite scroll on a development site, but after seeing it in action, my client decided not to use it. If I implement this functionality on a live site in the future, I'll be sure to share my experience. Thanks again.
  12. Has anyone implemented the jQuery version of Paul Irish's Infinite Scroll script on a site built with ProcessWire? If so, I'm interested in reading about your experience and tips on how you implemented it. https://github.com/paulirish/infinite-scroll
  13. Thanks, everyone! I consider this site to be a work in progress. When I've got some free time, I plan to make the site responsive for mobile devices.
  14. I just launched a site for my brother, a New York based travel photographer: http://bit.ly/PXw2bI I've been developing in WordPress for the past five years. While not my first ProcessWire site, it was refreshing to develop in a flexible content management system without the "bloat."
  15. Can you clarify the current functionality in PW when a new image is uploaded in place of an existing image? Does PW delete the original image and add the new image? It isn't actually "replacing" the image, is it? What if the image names (example.png) are the same?
  16. At some point with all of my projects, the client will ask for an image to be replaced. But the image description rarely needs to be updated when the image is replaced. (For example, the client may wish for the image to be cropped in a different way.) Unfortunately, when replacing an image in PW, the description is deleted. If the client isn't aware that it will be deleted, it leads to frustrated clients and missing data. And if a large number of images need to be replaced, it is cumbersome to copy the description and paste it back into the field when the image is replaced. In a future version of PW, I've love to see the description remain untouched when an image is replaced.
  17. I just discovered the Template of selectable page(s) option in the Selectable Pages section, which allows me to use a different template for the categories within /work/. Brilliant!
  18. I'm working on a portfolio site where I want the following public site structure that organizes projects by categories: /work/ -> Listing of all projects /work/strategy/ -> Listing of strategy projects /work/user-experience/ -> Listing of user experience projects /work/development/ -> Listing of development projects Then, projects would be structured as: /work/project-name-a/ /work/project-name-d/ /work/project-name-c/ /work/project-name-e/ ... My question is, what is the best field type to use to categorize projects? Should I use a Page with Multiple pages (PageArray)? I guess my confusion is moving from WordPress categories/taxonomies to PW's use of pages. Any insight would be appreciated.
  19. Thank you all for the helpful information. I've started to create a theme for the admin just to see how much control I have over the design. @ryan, thanks for the information regarding the admin template. @renobird, I'm looking forward to reading your walk-through. Thank you!
  20. Can a different template be used just for the profile editing? And then only give those employees guest and profile-edit permissions? Would this prevent me from having to create a new admin theme?
  21. Thank you for the insight, slkwrm. I didn't realize there was a comment module. I'll have to experiment with it today.
  22. I have a client that wants the following functionality for an intranet site: The intranet must be password protected. Each employee must have their own individual username and password. There may be a total of 100 employees who would have access to the site. A small group of employees need to have full admin rights to add, modify, and delete pages, posts, and images. They must also be able to add and delete non-admin employees. Admins and non-admin employees must be able to modify their personal profile on the site. Profile information may contain name, email, password, bio, photo(s), and links to external social media sites. The login and profile pages should *not* look like the PW admin. Employee profile pages should be available to other employees. In other words, the site should support an employee directory. Employees must be able to comment on existing pages and posts on the site. (Not sure how to implement this requirement.) Images that are uploaded should be viewable in a slideshow gallery format. I've developed one site in PW so far, but nothing like the above requirements. I'm 90% confident that PW can handle these requirements, but thought I'd check with the PW community first before making a commitment to using PW. I could build the site in WordPress, but it may be more work than to build it in PW. If someone else has built a similar site, I am interested in hearing about your experience.
  23. Nevermind! I deleted everything and started from scratch and it is working now.
×
×
  • Create New...