Jump to content

Peter Knight

Members
  • Posts

    1,554
  • Joined

  • Last visited

  • Days Won

    19

Everything posted by Peter Knight

  1. Thanks guys. I understand the context now and have fixed the issue. Interestingly a list of UNIX server locales I found online were different than the ones installed on my VPS so that was something to be aware of.
  2. I have just published my first PW multi-lingual site. I'm not understanding the following message and the server locale function Warning: your server locale is undefined and may cause issues. Please translate the “C” locale setting for each language to the proper locale in /wire/modules/LanguageSupport/LanguageSupport.module (shortcuts provided below): • English • Français • Deutsch • Español • Italiano For example, the locale setting for US English might be: en_US.UTF-8 Is it just a case to populate each languages "C" field with an appropriate string? IE English C field: en.UTF-8 Francais C fieldn: fr_FR.UTF-8 Deutsh C field: en.UTF-8 Espanol C field: es_ES.UTF-8 Italiano C field: it_IT.UTF-8
  3. I always assumed duplicate content incurred a Google penalty and affected your rankings. Possibly this isn't as much a problem anymore as @AndZyk mentioned and Google gets better about handling it etc. @adrian I have the usual batch of .htaccess settings, ProCache and and SEO Module. I couldn't narrow it down to any.
  4. Had a question about trailing slashes and forcing one or other. I've a site where most pages can be accessed with AND without a trailing slash IE domain.com/about-us/contact and domain.com/about-us/contact/ are both accessible and being indexed by Google. It's obviously bad for SEO but I can't seem to make PW respect one and redirect etc. There is a setting in templates>template>URLs I must be overlooking something as I have 'yes' selected and both URLs are still reachable with no redirect. What do you guys do to counter this?
  5. That's a good one. The MailChimp one is good too. https://templates.mailchimp.com/resources/inline-css/ I'd love to keep the amount of steps for my client right down but at some stage they'll probably need to use this maually. Thanks for the link
  6. That sounds pretty cool. I think the hardest part to this will be the final integration into Outlook itself and it's quirks.
  7. This is a simple enough use-case but was a good reminder (to me) of how PW can be used for simple stuff. A client rang me with a small but irritating problem. Every member of their staff have slightly different email signatures and it looks unprofessional. Even their clients had mentioned it. Initially I said I'd look into creating a few dreamweaver html templates or seeing what 3rd party signature solutions are available. The problem though is they're not a technical bunch and asking them to edit html etc is out of the question. The solution needs to be super simple for them. After a few hours looking at some solutions I realised I can do this very effectively with PW. It has such as nice UI and they'll be able to self manage most of it My plan is to set up a couple of fields: name (page title), email, telephone, Linkedin etc etc Give the client access to create new pages (staff) Allow client to create new pages (staff members) based on a simple HTML template Use PW's "add new" button to auto save pages into a parent folder called Sigs and we're done! I probably need to look at a way to produce inline css as this is eventually integrated into Outlook A foolproof way to display the actual HTML too (instead of view-source) would be great as I imagine they will need to copy and paste the actual html. I know it's hardly a technical masterclass but it's an interesting little job perfectly suited to PW.
  8. Love it. I use file and image tagging extensively and it's one of the few PW methods which trips clients up. I was just wondering during the week if it was possible to have a tag selector based on something a bit more dynamic. Thanks
  9. Hi Mike I think I'll prioritise the 100 or so most important URLs and then I can work through the others gradually. Client confirmed that actually they don't rank terrible well anyway so it looks like a relatively fresh start and the pressure is off. Just have to upgrade to MySQL 5.6 as it's currently running 5.1.X
  10. Hi Mike I have a multi-lingual MODX site which I've rebuilt in Processwire. PW site isn't live but is on a test server. As the MODX version currently has around 500 resources (lets say 500 URIs) I am keen to follow the old alleged Abraham Lincoln advice I'm thinking of doing following and wanted to sanity check my approach 1. Get a sitemap of the entire MODX site into a XLS or CSV and import into Jumplinks 2. Manually go through each "old" URL and update to the new URL Am I missing something crucial apart from keeping an eye on Google's Search Console (was Webmaster tools) and watching for 404 hits. I'll enable 404 monitoring on Jumplinks too. Cheers for any pre flight advice.
  11. Thanks @PWaddict All working now Thanks everyone for introducing me to something new. I can see how this will be useful as the site grows. Even now it easily replaces several lines of PHP if statements .
  12. OK I think I see my missign step. When I click into a language under Admin > Setup > Languages I need to look at a field group called Site Translation Files I need to select the button called Find Files to Translate which brings up a list of files in /site/ and then select my _translations.php file The only issue I have is adding this to my template outputs nothing <?php echo $page->__product_drawing ?> Also tried <?php echo $page->__product_drawing; ?>
  13. Ok so I create a php file called _translations.php. I upload it to site/templates/ directory. Do I then need to add it as a template under Admin > Setup > Templates > Add new template? I don't already have that file. if I create a file called _init.php does it live under /site/ or /site/templates? My Languages page under Admin > Setup just has my 5 languages listed. If I click into the French one, the only thing I can see is a field called Core Translation Files I know I'm probably missing an earlier step.
  14. I'm not sure how to do that. can you elaborate with a simple example?
  15. You mean create a field somewhere called "download button" and translate it with the field's language tabs?
  16. I was trying to fix an error earlier which was preventing a series of if statements from working. Basically I have a button called "Product Drawing" which needs localising depending on the current language session. Eventually got it working - I had a bracket in the wrong place. Curious as to why both these work though. On the sample below. each echo is surrounded by curly braces. <?php if ($page->files->count()) foreach($page->files->findTag('drawing') as $file) { if($user->language->name == 'default') {echo "<a href='$file->url' class='uk-button uk-button-primary'>Product drawing</a>";} if($user->language->name == 'french') {echo "<a href='$file->url' class='uk-button uk-button-primary'>Le plan du produit</a>";} if($user->language->name == 'german') {echo "<a href='$file->url' class='uk-button uk-button-primary'>Produktzeichnung</a>";} if($user->language->name == 'spanish') {echo "<a href='$file->url' class='uk-button uk-button-primary'>El dibujo del producto</a>";} if($user->language->name == 'italian') {echo "<a href='$file->url' class='uk-button uk-button-primary'>Il disegno del prodotto</a>";} } ?> On the sample below, there are no curly braces around the echo <?php if ($page->files->count()) foreach($page->files->findTag('breakingreport') as $file) { if($user->language->name == 'default') echo "<a href='$file->url' class='uk-button uk-button-primary'>Breaking strain report</a>"; if($user->language->name == 'french') echo "<a href='$file->url' class='uk-button uk-button-primary'>Le test de rupture</a>"; if($user->language->name == 'german') echo "<a href='$file->url' class='uk-button uk-button-primary'>Bruchfestigkeit bericht</a>"; if($user->language->name == 'spanish') echo "<a href='$file->url' class='uk-button uk-button-primary'>Informe resistencia</a>"; if($user->language->name == 'italian') echo "<a href='$file->url' class='uk-button uk-button-primary'>La rottura rapporto ceppo</a>"; } ?> Should the second piece work?
  17. Not yet but I was hoping to look at 2FA soon.
  18. Sincerely hoping you're talking about the same CMS but two different ladies and not the opposite ?
  19. 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
  20. 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.
  21. 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 "
  22. 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?
  23. That what I thought but it was throwing an error. :-/
  24. 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?
  25. 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
×
×
  • Create New...