Jump to content

Sevenupcan

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by Sevenupcan

  1. Thanks Ryan, I really appreciate you taking the time to read my post. I thought the reason would be close to what you and diogo talked about. Can you offer any insights or advice into how you manage your fields and fieldtypes? I guess the idea of copying the same field is only weird to me because you can see them altogether in a universal list, but if you created these fields from within a template they might look like the same field but underneath it, they would probably have their unique IDs to keep them separate. I just wanted to be sure I wasn't going against the DRY method. Many thanks for your time.
  2. Oops, thanks for showing me how to write it much cleaner with the correct syntax. When I try you're above example inside a loop ie... foreach() The code only renders items with images. Have isn't my php written correctly? This is the code I have: <?php $tours = $pages->find("template=tour"); foreach($tours as $tour) { ?> <div class="tour"> <div class="pictures"> <p class="date"><?=$tour->start_date;?></p> <img src="<?=$tour->images->first()->size(200,0)->url;?>" width="200" class="picture"> </div> <div class="copy"> <h1><a href="<?=$tour->url;?>"><?=$tour->title;?></a></h1> <?=$tour->summary;?> </div> <div class="prices"> <p class="price">£<?=$tour->price;?></p> <p class="per-person">per person</p> <button class="book">Book now</button> </div> </div><!-- tour --> <?php } ?>
  3. If you wanted to set the dimensions of the first images how would you write this? Could you do: <img src="<?='{project->images->first()->url}'?>" width="<?='{project->-images->first()-width(200)}'?>" />
  4. Hi there, For one of my templates I have a start date and an end date. Both fields are effectively the same type of input and output. Rather than create two fields can I add the field twice and customise the label in the template? I thought this might be possible using field-template context but realised the problem is that a fieldtype is unique and can only be added once. This example stems to a bigger concern. When I create the fields needed for my template, each of my fields effectively serve the same purpose regardless of what template they are on, the only difference is they have different contexts depending on the template. The field-template context option allows me to avoid creating fields like book_title and book_price. As I can just create one field called price. Which means that if I create a new template of movie, I can re-utilise the same field for give different descriptions based on the template. Unfortunately this model stops working when the same fieldtype is needed inside the same template. For example lets say I need two more fields one might be for a featured image and another for generic images I must create a field called featured_image and another one called images. This example might be debatable because you could say that this should be controlled by creating a custom fieldtype module with a checkbox for featured images. So what are you thoughts on using fields and their modularity? Lets say you had a site with a shop and a blog. How would create and name your fields? Would you have fields like: blog_title blog_body blog_author product_title product_body product_price or would you have... title body author price ps. I've really enjoyed developing with ProcessWire, for a designer at heart it has been super easy for me to build a site with my own markup without sacrificing the back end. Thank you to everyone who's been involved in it's development.
  5. I just added Ziiro Proton Watch to my wishlist http://t.co/3suHUN5i

×
×
  • Create New...