Jump to content

Peter Knight

Members
  • Posts

    1,466
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Peter Knight

  1. Thanks Adrian. In this instance there are multiple values so all is cool in looping land.
  2. Making progress. Because each field must be an array, it appears I do need to loop through each. This is working but perhaps not the way I *should* be solving it <?php $course_level = $page->course_detail_level; $course_category = $page->course_detail_category; $course_grouping = $page->course_detail_grouping; $course_prerequisite = $page->course_detail_prerequisite; $course_writer = $page->course_detail_writer; $course_lessons = $page->course_detail_lessons; foreach($course_level as $level){ echo "<strong>Level:</strong> {$level->title}";} foreach($course_category as $category){ echo "<strong>Category:</strong> {$category->title}";} foreach($course_grouping as $grouping){ echo "<strong>Grouping:</strong> {$grouping->title}";} foreach($course_prerequisite as $prereq){ echo "<strong>Prerequisite Course:</strong> {$prereq->title}";} foreach($course_writer as $writer){ echo "<strong>Writer:</strong> {$writer->title}";} foreach($course_lessons as $lesson){ echo "<strong>Lessons:</strong> {$lessons->title}";} ?>
  3. On the National Geographic case study, I found it interesting that the developers moved the whole site to ProcessWire in the background and *then* brought this up with the client. Had they asked if they could move from Drupal to PW, the answer would likely have been negative. Perhaps a risky strategy for some but as my old boss once said: "Ask for forgiveness. Don't ask for permission"
  4. I've created several fields and want to output their values on my page. Normally, the following works fine <?=$page->field-name-here?> For my latest fields this doesn't work and is instead outputting an integer (which I imagine is the page number). <h4>Course Details</h4> <strong>Level:</strong> <?=$page->course_detail_level->title?><br /> <strong>Category:</strong> <?=$page->course_detail_category?><br /> <strong>Grouping:</strong> <?=$page->course_detail_grouping?><br /> The above fields are mostly all based on a Page type and then an input field type of AsmSelect. I imagine my issue is that I am therefore dealing with an array and need to create a foreach statement?
  5. I have 12 fields set to 33% width and although 3 of them are the correct size, nothing will sit to their right (in the 2nd and 3rd column). This happens to the first field on every second row of fields. Checked the database value for the fields and they're definitely 33%. The wierd thing is, if I set it to 10, 20 or 30%, they behave in the same way. Wierd glitch or known bug? Or maybe my maths is crap :-/
  6. @SiNNuT Image fields can hold multiple images (a WireArray) so I need to specify which exactly which image I want to call. Got it. Getting the tatoo on my face next week
  7. Adrian - thanks. I've only spent 5 hours trying to solve this and a couple of hours on the forums.
  8. Definitely need to go back to PHP junior school Do I need to create a separate variable for the first image and then call that in my echo statement <?php $graduates = $pages->find("template=graduate-detail, sort=-date"); $myfirstimage = $pages->graduate_photo->first(); foreach ($graduates as $graduate) echo " <img src='{$myfirstimage->url}' /> <h3>{$graduate->title}</h3> {$graduate->graduate_summary}<br/> <a href='{$graduate->url}'>Read more</a> <hr/> " ;?> Above doesn't work but I think Im on the right track
  9. I did but it didn't fix anything. Actually, it outputs the complete path to my image except the actual image name <img src="/my-pretend-site.com/site/assets/files/1093/">
  10. I'm trying to output a series of photographs onto a index page. Each photo is from a different page so I'm using the $pages API. Everything is working bar the image and link to the main Graduate detail page. My PHP call <?php $graduates = $pages->find("template=graduate-detail, sort=-date"); foreach ($graduates as $graduate) echo " <img src='$graduate->graduate_photo->url' /> <h3>{$graduate->title}</h3> {$graduate->graduate_summary}<br/> <a href='{$graduate->url}'>Read more</a> <hr/> " ;?> What's happening Instead of outputting a JPG from a field called graduate_photo, i'm left with the following: <img src="graduate-hazel-scully.jpg->url"> As you can see, the image name is correct but the path is incomplete. It's outputting the '->url' too for some reason. I've red thorugh the PW images documentation so I'm not sure what my issue is. Possiblt it's because the docs are mostly giving examples where an image is called from the $page instead of $pages.
  11. Thanks guys. I'd prefer to use HannaCode here too. Much less to type for starter.
  12. Hi SiNNut Yes, I had. Although for some reason it didn't appear to be saving and that could have been my problem. I logged out, cleared the cache and it's working now.
  13. Does ProcessWire support PHP includes when they are called from a text field? I've created a field called Inject Include and added a PHP Include call within that. Right now, the ouput on the front end is my PHP include wrapped in HTML comment tags. <!--?php include("includes/get-graduates-main.inc"); ?--> BTW I'm trying this because HannaCode doesn't seem to be supported by 2.5. Otherwise, I'd have a HannaCode in the text field.
  14. HannaCode isn't currently listed as compatible with 2.5 on the Module page http://modules.processwire.com/modules/process-hanna-code/ I'm wondering if this is why my HannaCode is outputting the raw tag or if it *should* be working and I've got bigger probs. Running 2.5.5 dev
  15. Thank you both. Didn't realise it has to be nested. All working now
  16. I can see what it's doing. Just not sure how to integrate with my block of code. Do I add your line at the start before echo like so? <?php date("F", $test->getUnformatted("testimonial_date")); // October $tests = $pages->find("template=detail-testimonial, sort=-date"); foreach ($tests as $test) echo " {$test->testimonial_date}<br/> <h3>{$test->title}</h3> <p>{$test->testimonial_body}</p> <hr/> ;?> I've tried a few things and am getting an error.
  17. I've been reading through the forums regarding date and time output and trying to understand it better. At the moment, none of the samples are working for me Basically, I have a Datetime field set to output M j, Y On the front end, this is basically Sep 25, 2013 etc I was wondering how I could change following {$test->testimonial_date} to isolate just the date or the month or year. Here's my code: <?php $tests = $pages->find("template=detail-testimonial, sort=-date"); foreach ($tests as $test) echo " {$test->testimonial_date}<br/> <h3>{$test->title}</h3> <p>{$test->testimonial_body}</p> <hr/> ;?> I want to keep the Datetime field as is instead of creating a different datefield for day, month year.
  18. I've always recommended CampaignMonitor over MailChimp. in my experience, MC UI is less intuitive for clients and generates less support calls. Try both?
  19. Shouldn't layout be left to devs template preferences? I like my modules not to assume any layout prefs. Also, any plans to email admins for new comments?
  20. Definitely recommend it. I normally wait until V1.2 of any software I rely on but having installed the beta the day it was available I was surprised just how stable it was. I'm a So finding boot up,shutdown and general speeds to be snappier on a 2011 macbook. I'd say go for it. You can always install on a partition and test if you're unsure.
  21. Thanks Kongondo. Blog module is just getting better and better. BTW I've had the issue in the past where I've needed a "featured image" with each post. Using your older Blog Module, I've just told editors that the first image in the images field will be the featured one and it's worked perfectly. They know they can reorder images as required so have very few probs that way.
  22. Nice. Thanks for sharing. On the screengrab of the tree, you have custom icons for each page. Is that achieve dwith a Module or some page setting I've yet to try.
  23. Hey guys. I've sourced someone. Job closed.
  24. I need to outsource some navigation / menu work. If you are interested, please PM me and I can send you full requirements Basically, I need to outsource A 2-level drop down menu First level of links should be determined by the Page Field. 2nd level are just child pages Incorporate the drop down menu into http://www.meantheme...ugins/meanmenu/ I can handle the styling. Really need someone to just create the mechanism, simple CSS and PHP, This is a paid job. Thanks
  25. @Joss - Sounds good. I'll mockup a flyer and make a PDF if thats cool? Could even be tagged #processwhere
×
×
  • Create New...