-
Posts
1,419 -
Joined
-
Last visited
-
Days Won
7
Everything posted by Peter Knight
-
Of course! There's me assuming it needs to be complicated :-/ I had tried page->title but that was massive. Hadn't thought of ID as I only use them in MODX
-
Im working on an FAQ section for a client. It's using Foundations Accordian JS so you click a Question and it toggles the Answer. You know the deal. The tricky part for me is when looping through my FAQs, I need to assign each anchor and target div with a unique number. Been trying to set a variable at one and then incrementally add a number per each FAQ. Wondered if my syntax was wrong or if there are more basic issues with the $x=1 idea. <a href='#$x++'>{$faq->title}</a>; <div id='$x++' class='content'> My working code (apart from the $x++) <?php $x=1; // Start a fairyball at 1 $faqs = $pages->find("template=faq-detail"); echo "<dl class='accordion' data-accordion>"; foreach ($faqs as $faq) echo " <dd class='accordion-navigation'> <a href='#$x++'>{$faq->title}</a>; <div id='$x++' class='content'> {$faq->faq_body} </div> </dd> "; echo"</dl>" ;?>
-
How to convince old client to swith from EE to PW?
Peter Knight replied to OrganizedFellow's topic in Pub
Agree. I think you're all nuts. Thankfully I'm not allergic to nuts. Here's another thing my old boss used to say to me : "Pete me auld flower. That's not just allowed. That's in fact encouraged". Stay nuts -
@GuruMeditation The tone of this thread could rapidly diminish!
-
Yep - You just bet me too it. I eventually tried creating a variable first and then passing the value to the echo thingy. BTW, re. variables - my wife came into the office yesterday and I must have looked particularly grumpy. The conversation went kind of like this: Her: whats wrong? Me: oh...just bloody variables Her: Bloody fairy balls? I thought you were having ProcessWire problems! Well, it made me laugh and got rid of my grump.
-
I have an image field as follows: Max files allowed = 1 Formatted value = Automatic Inputfield = cropimage If I follow the instructions here, this needs to be my echo call <?php echo $page->photo_for_course->getThumb('crop-for-course-detail'); ?> But this just outputs the fullpath as a string. The documentations states that "getThumb returns url to the thumbnail you have asked for". So I then thought I needed to tag an ->url on the end as follows <?php echo $page->photo_for_course->getThumb('crop-for-course-detail')->url; ?> It's not a first() issue as the file only allows for one image so Im a bit stuck. I've achieved this before but was using the $pages API and had a foreach loop. Surely I don't need to foreach here as I'm only using a single image? Thanks in advance. I feel like it's you guys that are building this site :-/
-
Thanks Adrian. In this instance there are multiple values so all is cool in looping land.
-
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}";} ?>
-
How to convince old client to swith from EE to PW?
Peter Knight replied to OrganizedFellow's topic in Pub
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" -
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?
-
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 :-/
-
@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
-
Adrian - thanks. I've only spent 5 hours trying to solve this and a couple of hours on the forums.
-
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
-
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/">
-
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.
-
Thanks guys. I'd prefer to use HannaCode here too. Much less to type for starter.
-
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.
-
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.
-
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
-
-
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.
-
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.
-
I've always recommended CampaignMonitor over MailChimp. in my experience, MC UI is less intuitive for clients and generates less support calls. Try both?
-
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?