Jump to content

thomassausen

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by thomassausen

  1. My snippet doesn't work. <?php $latest_portfolio = $pages->get("/referenzen")->children(); foreach($latest_portfolio as $item) { $thumb = $page->portfolio_image->size(160); echo '<a href="' . $thumb->url . '"> <img src="' . $thumb->url . '" alt="' . $thumb->description . '" </a>'; } ?> Returned: Error Call to a member function size() on a non-object (line 26) Line26 is: $thumb = $page->portfolio_image->size(160); Even if I try: <?php $latest_portfolio = $pages->get("/referenzen")->children(); foreach($latest_portfolio as $item) { $thumb = $page->portfolio_image; echo '<a href="' . $thumb->url . '"> <img src="' . $thumb->url . '" alt="' . $thumb->description . '" </a>'; } ?> I only received empty html-tags (img src etc)
  2. Well, I need more practice to get into this PHP/PW-thing. For the last couple of years I wrote only EE-tags. So there is my Portfolio with all Items displayed as thumbnail-image. And I did some mistakes... <?php $latest_portfolio = $pages->get("/portfolio")->children(); foreach($latest_portfolio as $item) { $thumb = $page->portfolio_image->first()->size(160); echo '<a href="' . $thumb->url . '"> <img src="' . $thumb->url . '" alt="' . $thumb->description . '" </a>'; } ?>
  3. Thanks. I would never have occurred to me (->first ). And yeah the cheatsheet is my new friend.
  4. Hi there, I'm coming from ExpressionEngine and giving PW a try. So far I'm very excited and PW could be my next main cms. I'm rebuilding my portfolio-site with PW at the moment. So I have these pages: Home --- Portfolio ------Portfolio item #1 ------Portfolio item #2 ------Portfolio item #3 On Portfolio, I want to list all latest Portfolio items. I did it with: <?php $latest_portfolio = $pages->get("/portfolio")->children(); foreach($latest_portfolio as $item) { echo "<div class='span3'><article><a href='{$item->url}'>{$item->title}</a></article></div>";} ?> So it list all my titles. But each item has a "portfolio_image"-field with one big image. So how do I output these image as an thumbnail in my code? Further I tried to code a detail-view for each item. But my big image is not gonna to display: <h1><?php echo $page->title; ?></h1> <?php if ($page->portfolio_image) { $image = $page->portfolio_image; echo "<img src='{$image->url}' alt='{$image->description}' />"; } ?> Title is fine but not the right image-url. It output " site/assets/files/1014/ " and not "site/assets/files/1014/image.jpg" What did I wrong?
×
×
  • Create New...