Jump to content

Jon E

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by Jon E

  1. Thank you so so much @abdus!
  2. Hi, Been scratching my head on this one all day - I have a function to find if my current page is referred to in other pages, which is working fine, but I want to only output the section if there is content to go in there, i.e. I wouldn't want to show the 'events' heading or div if there are none. I know this should be quite straightforward but I've been looking at this for a couple of days and stuck on it, so any help would be really great. Thanks so much. <div class="written_list_participant"> <h2>Events</h2> <ul> <?php $fe = $pages->find("contributors=$page, template=event"); // $page is the current page foreach($fe as $e){ echo "<li><a href='{$e->url}'>$e->title</a></li>"; } ?></ul> </div>
  3. Hi, Running into some issues with this myself - I have multiple pages referenced and want to output the title of these pages - works when I have a single page option but either getting the ID's (i.e. 1144|1089) or nothing when I try to call title... can someone help me? Sorry, have looked around a lot but just not getting the concept! Thank you very much. <?php if ($page->children) { foreach($page->children as $selectedthumbs) { echo "<tr><th><a href='{$selectedthumbs->url}'>{$selectedthumbs->title}</th><th>{$selectedthumbs->contributors}</th></</tr>"; }} ?>
  4. Hi, Thanks so much - that makes sense... I've tried to combine the below in a lot of different ways but keep getting an error... Any ideas? Thanks <?php if ($image->caption){ //Output markup 1 } else { //Output markup 2 } ?> <?foreach($page->images as $image) { $thumb = $image->width(1040); echo "<li><img src='$thumb->url' alt='$image->description'><p class='caption'><strong>{$image->imagetitle}</strong> <em>{$image->imagetext}</em> <span><br>{$image->role}</span></p></li>";} ?>
  5. Hi there, Little stuck on something and have looked around. I have used the image field extender module but when I'm outputting images in my gallery I want to check if there is a caption before I output the markup. How would I go about this? Thanks echo "<li><img src='{$thumbnail1->url}' alt='{$image1->description}' /><p class='caption'><strong>{$image1->imagetitle}</strong> <em>{$image1->imagetext}</em> <span><br>{$image1->role}</span></p></li> ";
  6. Hi there, Am really stuck on this one and I had a look around but couldn't work this out still. I have a repeater field (screenshot attached) - and I want to run a command such as: <?php echo $page->homepage_media->getRandom()->video_strip_1->url ?> <?php echo $page->homepage_media->getRandom()->video_strip_2->url ?> <?php echo $page->homepage_media->getRandom()->video_strip_3->url ?> <?php echo $page->homepage_media->getRandom()->video_strip_4->url ?> <?php echo $page->homepage_media->getRandom()->video_strip_5->url ?> So I want all random links output individually but all from the same repeater entry. Does that make sense? Sorry would appreciate any help.
  7. Hi, Sorry to ask again, I have tried so much but I want to be able to post entries without a thumbnail. I know the 'if' statement is probably wrong below but what am I doing wrong? Thank you <?php foreach($page->children("template=blog-entry") as $key => $post) { if($key == 2){ // Render static content after 2 posts echo"<div class='grid__item cat1' id='blog_listing'><div id='tweet'></div><div class='clear'></div><div class='hide'><button class='action--buy'></button></div></div>"; } // let's grab the project thumbnail and resize it $image = $post->blog_thumbnail; // get the first image $thumb = $image->size(1000); echo "<a href='{$post->url}'><div class="; echo"'grid__item cat"; echo $post->get("blog_category"); echo"' id="; echo'"blog_listing'; echo'"'; echo">"; if(count($post->blog_thumbnail)) { echo "<img src='{$thumb->url}' alt='{$album->title}' />"; } echo"<div class='blog_listing_meta'>"; echo"<h2><strong>"; echo $post->get("title"); echo"</strong><br/>"; echo $post->get("date"); echo"</h2>"; echo"</div>"; echo'<div class="hide"><button class="action--buy"></button></div>'; echo"</div></a>"; } ?>
  8. Hi, Sorry thanks for helping and I might be being an idiot but if I do: <?php foreach($page->children("template=blog-entry") as $key => $post) { if($key == 3{ // Render static content after 3 posts echo"<h2>static block</h2>"; } // let's grab the project thumbnail and resize it $image = $album->blog_thumbnail; // get the first image $thumb = $image->size(1000); echo "<a href='{$album->url}'><div class="; echo"'grid__item cat"; echo $post->get("blog_category"); echo"' id="; echo'"blog_listing'; echo'"'; echo">"; echo "<img src='{$thumb->url}' alt='{$album->title}' />"; echo"<div class='blog_listing_meta'>"; echo"<h2><strong>"; echo $post->get("title"); echo"</strong><br/>"; echo $post->get("date"); echo"</h2>"; echo"</div>"; echo'<div class="hide"><button class="action--buy"></button></div>'; echo"</div></a>"; } ?> I get: Parse Error: syntax error, unexpected '{' (line 25 of C:\MAMP\htdocs\dev\site\assets\cache\FileCompiler\site\templates\blog-listing.php) This error message was shown because: you are logged in as a Superuser. Error has been logged.
  9. Hi, I have looked around a few places but I couldn't find a solution here so wondered if someone could help me here. I am making a listing page for blog items, but need to interrupt the listing after a few posts (to be decided how many) with a static div (that will pull in the most recent tweet). Could someone help me with how to 'inject' this into my foreach loop? Hope this makes sense and thank you. <?php foreach($page->children("template=blog-entry") as $album) { // let's grab the project thumbnail and resize it $image = $album->blog_thumbnail; // get the first image $thumb = $image->size(1000); echo "<a href='{$album->url}'><div class="; echo"'grid__item cat"; echo $album->get("blog_category"); echo"' id="; echo'"blog_listing'; echo'"'; echo">"; echo "<img src='{$thumb->url}' alt='{$album->title}' />"; echo"<div class='blog_listing_meta'>"; echo"<h2>"; echo $album->get("title"); echo"<br/>"; echo $album->get("date"); echo"</h2>"; echo"</div>"; echo'<div class="hide"><button class="action--buy"></button></div>'; echo"</div></a>"; } ?>
  10. Hi, It does, and I'm getting just the filename.jpg output... not the whole directory. Thanks Jon
  11. Hi, Could someone give me a helping hand please? I have the below code: <?php // Show the gallery widget if there are slideshow images attached to this press article if(count($page->slideshow_images)) { echo '<div id="article_slideshow_widget">'; $n = 0; echo "$page->images->first()->url;<img src='http://i.imgur.com/0heduk5.png' class='article_slideshow_widget_zoom'></div>"; $n++; } echo ""; ?> I want to output the first image from the images field in the article_slideshow_widget div, but it is only giving me the filename currently (I removed the img tags to see what was being output as I was being given a broken image as the complete URL isn't there!) Sure I'm close but would really be grateful for a pointer. Thanks so much Jon
  12. Thank you so much for all your help.
  13. Hi, Got it working with the below, thanks so much. Does anyone know how I can only show the #related_projects div if I have options selected? Seems to be showing on all pages currently. Sorry to be annoying and thanks so much. Jon <?php if($page->related_projects):?> <div id="related_projects"> <h2>You might like...</h2> <?php $relatedProjects = $page->related_projects->find("limit=2"); foreach($relatedProjects as $rp) { echo "<li><a href='{$rp->url}'><img src='{$rp->images->first()->url}'>"; echo "<h3>{$rp->title}</h3></a></li>"; } ?> </div> <?php endif; ?>
  14. Thanks looks like that would work but.... Parse Error: syntax error, unexpected '' . $rp->images->first()->url ' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' (line 39 of
  15. Hi, Not sure that will work, I need to find the pages selected in my related_projects field... Thanks though...
  16. Hi, I have created a page field type called related_projects. I want to output this on a template. I need to limit it to 2 and to: - Find the project name - The first image from a field named images Can anyone help me please? I've really had a good look but totally stuck, especially with the image... Thanks so much. Jon
  17. Almost. I have all of the images in the images field on the homepage. I then have a page called 'clients', which is blank. For each child of this page I want to enter the tag into a field, so on a client child page I enter 'portrait' and it shows all images from the homepage that are tagged with 'portrait'. Does this make sense? Thanks so much
  18. Hi, Do you think anyone would be able to help me with this? So I want to output a certain tag that is specified in a field for this page from images tagged as such from the homepage... Thanks so much
  19. Thanks, that works. But say if I want the tag its pulling from to be dynamic, so I use the 'tag_name' field within this code to show whatever I propose in the admin panel, how may I go about doing that? Also for some reason I only get one image appearing at the moment... Sorry thanks so much. <?php include("./head.inc"); ?> <div id="client_body"> <h1>Client Area</h1> <h2><?php echo $page->get("title"); ?></h2> <?php if($page->tag_name):?> <h2><?php echo $page->get("tag_name"); ?></h2> <?php endif; ?> <?php $homepage = $pages->get("/"); //get the homepage foreach($homepage->images as $image) // retrieve first image with tag 'mytag' $images = $homepage->images->getTag('tag'); echo "<img src='$image->url'>"; ?> <?php include("./foot.inc"); ?>
  20. Hi, So I am creating a portfolio site and am using my homepage as a way of displaying images (so images added to that entry). Is there a way I can create a tag page, so that I can add a page elsewhere on the site, and the user can enter into a field the tag of images they want to show there that are uploaded to the homepage entry. So, I'm trying something like the below: <?php include("./head.inc"); ?> <div id="client_body"> <h1>Tag view title</h1> <h2><?php echo $page->get("title"); ?></h2> <?php if($page->tag_name):?> <h2><?php echo $page->get("tag_name"); ?></h2> <?php endif; ?> <?php foreach($page->images as $image) { // retrieve first image with tag 'mytag' $image = $page->images->getTag('mytag'); echo "<img src='$image->url'>"; } ?> <?php include("./foot.inc"); ?> Thanks, does this make sense? Jon
  21. Hello, Yes I have images in an images field for all of the child pages... I want to achieve that - is it something like below? <?php $features = $pages->find("template=project, sort=-date"); foreach($page->images as $image) { echo "<img src='$image->url'>"; } if($feature->images->count()) { echo "<ul class='bxslider'>"; foreach($feature->images as $image){ echo "<li><img src='$image->url'/></li>"; } echo "</ul>"; } ?>
  22. Hi, Would someone be able to give me the code so that I can see how this can be achieved - basically I want to output all the images from pages with certain template types on a parent page. My whole code is: <?php include 'head.inc'; ?> <div id="portfolio_list"> <?php $features = $pages->find("template=project, sort=-date"); foreach($features as $feature) { $thumb = $feature->thumbnail ? $feature->thumbnail->width(800)->url : "http://i.imgur.com/1zxfxMW.jpg"; // if no thumbnail, replace by placeholder echo "<ul class='bxslider'>" . "<li><img src='{$thumb}' /></li> <li><img src='{$thumb}' /></li> <li><img src='{$thumb}' /></li> <li><img src='{$thumb}' /></li> </ul>" . //changed from $thumb->url to only $thumb "</ul>"; } ?> </div> <?php include 'foot.inc'; ?> So rather than outputting the thumb each time I want to cycle through all the images in that post... If someone could show me exactly how that would be done that would be great as I'm so stuck......
×
×
  • Create New...