Peter Knight

Members
  • Content count

    948
  • Joined

  • Last visited

  • Days Won

    5

Peter Knight last won the day on May 16 2016

Peter Knight had the most liked content!

Community Reputation

672 Excellent

About Peter Knight

  • Rank
    Hero Member

Contact Methods

  • Website URL
    https://www.edenstudios.com

Profile Information

  • Gender
    Male
  • Location
    Dublin, Ireland.
  1. Sincerely hoping you're talking about the same CMS but two different ladies and not the opposite 😀
  2. Both $pages->find("id=1|2|3"); and $pages->getById([1216,1217,1218]) worked. My original $formnav = $pages->getById([1216,1217,1218]); // Get specific pages wasn't returning the correct pages because the menu options needed this removing 'show_root' => true, Thanks everyone
  3. is it possible to call multiple page IDs in a selector? I was trying to fetch a few specific pages by ID for a menu as follows $formnav = $pages->get("1216,1217,1218"); // Get specific pages echo $sideMenuForms->render($options, null, $formnav); and it throws the following error Fatal error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? field='1216', value='', selector: '1216,1217,1218' (in /var/www/vhosts/ It works if there is a single page ID specified but not multiples. Looking up the API reference, there is a "get by ID method" for multiple page IDs but it does nothing and no error $formnav = $pages->getById([1216,1217,1218]); // Get specific pages echo $sideMenuForms->render($options, null, $formnav); I can always revert back to a template or path based selector but was hoping to keep it based on ID for the moment.
  4. I have it working - thanks again @ottogal Eventually I stripped back everything and started again with this foreach($page->children as $category) { echo "... "; foreach($category->children as $prod) { echo "
  5. I have a new challenge - outputting the grandchild pages of 3 children (simple enough) but confine the display of each grandchild under it's parent heading. Will try explain... My tree looks like this: Foods (where I want to mirror the structure below in a table) - Fruit (Child of Foods and Level 2 Parent) - - Apple - - Banana - - Orange - Vegetable (Child of Foods and Level 2 Parent) - - Carrot - - Potato - - Cauliflower - Meats (Child of Foods and Level 2 Parent) - - Beef - - Pork - - Chicken Lets say "Foods" is the parent. Fruit, Veg and Meat are children. Apple, Bananna etc are grand children I have the Foods template working to an extent but it's doing the following. IE it's Fruit - - Apple - - Banana - - Orange - - Carrot - - Potato - - Cauliflower - - Beef - - Pork - - Chicken Vegetable - - Apple - - Bananna - - Orange - - Carrot - - Potato - - Cauliflower - - Beef - - Pork - - Chicken Meats - - Apple - - Bananna - - Orange - - Carrot - - Potato - - Cauliflower - - Beef - - Pork - - Chicken This is my effort so far. <?php // the children of this page $products = $page->children(); foreach ($products as $prod){ // Create a table for each child page echo" <div> <div class='prod-ov-wrapper'> <div class='prod-ov-text'> {$prod->title} <table class='uk-table uk-table-divider' border=1> <thead> <tr> <th>Part No.</th> <th>Length</th> <th>Break Force</th> <th>Width</th> <th>Colour</th> </tr> </thead> <tbody> "; // populate the table with details of the children of each child $proditem = $page->find("parent=$page->children, template=product"); foreach ($proditem as $prodDetail){ echo" <tr> <td>{$prodDetail->prod_partNo}</td> <td>{$prodDetail->prod_length}</td> <td>{$prodDetail->prod_breakForce}</td> <td>{$prodDetail->prod_width}</td> <td>{$prodDetail->title}</td> </tr> ";} echo" </tbody> </table> </div> </div> </div> ";} ?> I've tried a couple of things over the last few hours and just can't quite understand the API call I need at $proditem = $page->find("parent=$page->children, template=product"); foreach ($proditem as $prodDetail){ echo" is there a way to do this? I suspect I am close but need to add another variable in there?
  6. That what I thought but it was throwing an error. :-/
  7. Thanks @ottogal Picking my way through this but that makes sense. I've never really set a conditional that far up the php script but looking around the forums, this seems to be correct. <?php $products = $page->children(); foreach ($products as $prod){ // Check that images field is poulated if ($prod->images) { //Create variable from first image in field $image = $prod->images->first();} echo" <div > <div class='prod-ov-wrapper'>"; // Check that images field is poulated if($prod->images) echo " <a href='$prod->url'> <img src='{$image->height(160)->url}' class='prod-preview'> </a>"; echo" <div class='prod-ov-text'> <strong>Part No:</strong>{$prod->title} <br/> {$prod->prod_summary} <a href='$prod->url' class='uk-icon-button' uk-icon='icon: chevron-right'></a> </div> </div> </div> ";} ?> I'm wondering though if I'm being a little verbose. I am checking twice if the image field is populated and I have a feeling I could / should only need to do this once?
  8. I have a page that's throwing an error because some of the pages in the for each loop don't have an image The docs say it's wise to check that an image has content and only then try to output something. I thought the following would work with the if($image) below. $products = $page->children(); foreach ($products as $prod){ $image = $prod->images->first(); echo" <div > <div class='prod-ov-wrapper'>"; if($image) echo " <a href='$prod->url'> <img src='{$image->height(160)->url}' class='prod-preview'> </a>"; echo" <div class='prod-ov-text'> <strong>Part No:</strong>{$prod->title} <br/> {$prod->prod_summary} <a href='$prod->url' class='uk-icon-button' uk-icon='icon: chevron-right'></a> </div> </div> </div> ";} What am I overlooking here? Thanks
  9. Interesting read and I'll bring it up with the site owners. This is actually a port from another CMS to Processwire (wohoo). The original site already uses a flag system and language names in local format so I have to stick with that.
  10. Hi @Dinodog Hope you get sorted soon. BTW There's a ProcessWire Developer Directory here: http://directory.processwire.com/ which lists some of the member available for hire. Might be a good future reference. Glad to hear you haven't moved to WordPress. Security nightmare to say the least and a world of pain
  11. I don't know if this answers your question but here's the post i mentioned Essentially I just used this part if($user->language->name == 'french') echo "and pdf_file is the French version.";
  12. I have a dropdown menu which displays a list of languages installed on my site. Id like to add some country flags to the menu list items and the simplest way would be to add an image field to the languages template which is installed in the settings branch. However it seems like this system template won't accept new fields but isn't locked. Is there a way to extend this template to accept new fields? P
  13. You mean via the API? I wanted the same thing over the weekend and found a post where Ryan provided some simple instructions. Don't have it to hand but will in the morning. It was something very simple along the lines of if $language == 'french' ; echo {}
  14. Hi @Zeka That's a huge help. Thanks for the information particularly the image and file fields.
  15. Started my first demo multilingual site last night and I'm really pleased with the ease of setup. I had a 1 page demo with 5 languages and a language switcher and menu running relatively quickly. Before I get too far down the road, I thought I'd ask some of you more experienced multilingual devs what I should be aware of? Off the top of my head... Do any multi-lingual SEO modules exist or should I build my own fields here? I normally use MarkupSEO but not sure yet if it supports multi-lingual. Are any of the Pro fields NOT multilingual? I'm using a single tree with language options as tabs on each field. Is this a better method than having a separate tree for each language? Are image Description fields multilingual? Anything else I should be aware of? For example I read recently that web forms using FormBuilder should be built separately for each language. That's not a huge deal but a good example of something I hadn't anticipated. Cheers P