Jump to content

FrancisChung

Members
  • Posts

    472
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by FrancisChung

  1. Hi @teppo, it's been going on for a few weeks now. Very frustrating. It's definitely beyond a wait and see approach stage now. Is the robots.txt max-age defined in .htaccess? I don't recall creating such setting for robots.txt specifically, but I do recall such setting for the website in general for cache-headers.
  2. Hi, I have an ongoing issue with Google SEO that I can't seem to fix. Wondering if anyone has come across a similar situation? We deployed a new version of the website using a new deployment methodology and unfortunately, the wrong robots.txt file was deployed basically telling Googlebot not to scrape the site. The end result is that if our target keywords are used for a (Google) search, our website is displayed on the search page with "No information is available for this page." Google provides a link to fix this situation on the search listing, but so far everything I have tried in it hasn't fixed the situation. I was wondering if anyone has gone through this scenario and what was the steps to remedy it? Or perhaps it has worked and I have misunderstood how it works? The steps I have tried in the Google Webmaster Tool : Gone through all crawl errors Restored the Robots.txt file and Verified with Robots.txt tester Fetch/Fetch and Render as Google as both Desktop/Mobile, using root URL and other URLs, using Indexing Requested / Indexing Requested for URL and Linked Pages. Uploaded a new Sitemap.xml Particularly on the Sitemap page, it says 584 submitted, 94 indexed. Would the Search Engine return "No Information available" because the page is not indexed? The pages I'm searching for are our 2 most popular keywords and entry points into site. It's also one of 2 most popular category pages. So I'm thinking it probably isn't the case but ... How can I prove / disprove the category pages are being indexed? The site in questions is Sprachspielspass.de. The keywords to search are fingerspiele and kindergedichte.
  3. Awesome tip, @Robin S Local history is something I use quite regularly but I suppose I should be committing more often as per the Git mantra Perhaps users who rely on local history can make a backup of the System Cache first before invalidating the cache and seeing what sort of performance gains they get. The locations are : Windows <User home>\.PhpStormXX\system that stores PhpStorm data caches. Linux ~/.PhpStormXX/system that stores PhpStorm data caches. macOS ~/Library/Caches/PhpStormXX contains data caches, logs, local history, etc. These files can be quite significant in size. Source : https://www.jetbrains.com/help/phpstorm/project-and-ide-settings.html
  4. Completely understand if you don't wish to create accounts for the sake of it. I happen to use Bitbucket quite a lot as well, which integrates well with Sourcetree since they share the same maker.
  5. I had another read, and I think the best course of action try and reverse engineer a working plugin? https://github.com/topdown/phpStorm-CC-Helpers
  6. I use Atlassians' Sourcetree if people wanted an alternative. https://www.sourcetreeapp.com/
  7. @maxf5, I tried about a year ago but I couldn't get it to work. I assume you're on the latest build of PHPStorm?
  8. I forgot about this .... everyone should upvote this to get a chance of being implemented. https://youtrack.jetbrains.com/issue/WI-36647 Or even better, any Java/PW gurus out there?
  9. Wait till you get to Factory Methods, Contravariance, Covariance, Builder + Specification patterns .... haha Ideally Classes should do one thing and only one thing. So you should probably make multiple smaller classes that has a very distinct and easily identifiable singular purpose rather than 1 monolithic one that tries to do everything.
  10. Wow, it's like Night & Day compared to your first iteration. Looking very good.
  11. 1 of OO Programming's Commandments is : "Thou shalt favour composition over inheritance (or extending a class)" It can seem complex, especially if you're starting out on OO concepts. https://stackoverflow.com/questions/49002/prefer-composition-over-inheritance https://medium.com/humans-create-software/composition-over-inheritance-cb6f88070205 The Medium.com has one of the best explanations I've seen. @bernhard's code above is an example of composition.
  12. Everyone starts somewhere at the bottom and make their way up. Your code wasn't that terrible, just needed a small house clean Glad to hear this. Makes it all worthwhile.
  13. You could take Bernhard's example and encapsulate it even further ... I've added 2 new functions NoErrors & DisplayErrors to encapsulate and hide away more logic.
  14. You want to define $errorMsg outside the function, where your main logic resides. I think I should also pass the message via reference not via value which is the default method of passing arguments. Funny enough, php.net has a very similar example there. http://php.net/manual/en/functions.arguments.php#functions.arguments.by-reference
  15. @SamC, if you're struggling with any aspects no matter how trivial. give me a shout and I can try and help out. I've quite enjoyed the discussions we're having so far.
  16. The idea with the validation functions is to encapsulate the checking logic and the error capture logic inside the function. You could even throw the error there immediately but I don't know what your requirements are. function CheckSendMe($errorMsg) { if ($input->post->sendMe) { return true else { $errorMsg = $errorMsg."Error MSg here"; //appending error msgs here return false; } } ... $cond1 = CheckSendMe($errorMsg); $cond2 = ValidateV($errorMsg); ... if ($cond1 && $cond2 && $cond3) { .... } else DisplayErrorMsg($errorMsg); The idea here is to minimise any long nested if-else chains and favouring readability over pre optimizations or micro optimizations. Perhaps if you're the only coder and or you're working in a small team or you're very familiar with the codebase then you may think this approach may seem like overkill. Until you work on a huge codebase that is alien to you, previously worked on a by a long list of programmers with varying skill levels, and the sight of a huge function with a dozen if-else statements nested coming your way will probably change your mind quickly about readability.
  17. Should never be too lazy for learning. Keep feeding that curious inner child inside you! I think all the myriad of intermediate and advanced techniques, paradigms, theories etc that we programmers use boils down to 2 objectives we strive for. Readability and ease of (future) maintenance. Something that helps achieve the two is proper encapsulation of code & logic, something I think I am still learning better ways to do after all these years! The Pipeline is merely one way of encapsulating your code & logic in a certain way that helps achieve readability. Object Orientated Programming was born because of this need for encapsulating code. You could certainly just use if statements and functions to achieve this as well, perhaps encapsulating some of the logic into smaller functions like below. $cond1 = CheckSendMe(); //$input->post->sendMe. $cond2 = ValidateV(); //$v->validate $cond3 = VerifyCaptcha(); //$captcha->verifyResponse() if ($cond1 && cond2 && cond3) { ConstructEmail(); if (SendMail()) DisplaySendMsg() else DisplaySendFailMsg() } I guess the different ways of encapsulating code will yield different results and your mileage will definitely vary a lot depending on what and how you use it.
  18. I'm pretty sure I read somewhere in the beginning that PW 2.x was not officially supported, at least in the very early versions, which is why I just got the early bird deal and never used it. Perhaps that has changed over recent iterations?
  19. Haha, maybe it's about time I dusted off Tracy Debugger too. Was an early adopter but have never used it because I was on PW 2.8.x for a long time until recently.
  20. You could apply something like the Pipeline Design Pattern to streamline a set of sequential work, which I think is what you're trying to achieve @SamC ? Having said that, it's not something I've used in PHP itself but I've used in other languages like C#. The advantage is better readability and maintainability and no more long nested if - else statements. https://medium.com/@aaronweatherall/the-pipeline-pattern-for-fun-and-profit-9b5f43a98130 An alternative method of getting rid of if - else statements is using functional programming paradigms like Lambda expressions and using optional types and using defensive programming techniques. There's a great course on it on Pluralsight on this called Advanced Defensive Programming Techniques. It can get a bit heavy but it's profoundly changed my coding views in a positive way. Even if you're not familiar with C#, I would recommend having a look at this course if you really want to advance yourself as a coder. https://www.pluralsight.com/courses/advanced-defensive-programming-techniques
  21. It's not this error you're referring to right? You must assign a template to the page before setting custom field values (title__data) [pageClass=Page, template=]
  22. Make a backup of the .htaccess file in your new site and copy across the .htaccess from the source site and see if that works. In my experience, where part of the site is accessible but not others (eg. Homepage vs Other pages) .htaccess has always been the culprit so far.
  23. @heldercervantes , I had to build something from scratch but unfortunately, it's coupled with the site I built it for at the moment despite my best efforts to make it more modular. None of it is in a PW Module although they are all constructed as separate PHP Object Classes at this stage. I had success with it if it's an ad that isn't from one of the advertising platforms out there, i.e. what I call an independent or internal ad. I'm having some issues with some Ads not showing up if it's an Ad from 1 of these Adverting platforms. It's a real pain in the <XXX>, ads! A module that can handle ads would be a huge boost for the Processwire platform. Unfortunately, this is my first attempt at Ads and I would really need someone who is well versed in Web Advertising to help me to undertake such a big task if I were to contemplate doing it.
  24. I use something called SimpleExcel to export / import CSV. http://faisalman.github.io/simple-excel-php/ Here's an example code snippet for Export : $AllPages is just the data source, so you can replace it with your own. I would also ignore all the col_subcat fields and any associated functions like GetSubCategoryNames. You can replace 'SSS-Exported' at the bottom to the filename of your choosing. public function ProcessXML() { $AllPages = Data::PagesAllContentsNoInteraktives(); if ($AllPages->count()==0) exit; $_colTitle = 0; //A $_colCategory=1; //B $_colSubcat1 =2; //C $_colSubcat2 =3; //D $_colSubcat3 =4; //E $_colSubcat4 =5; //F $_colSubcat5 =6; //G $_colContent = 7; //H $_colIntro = 8; //I $_colAuthor = 9;//J $_colImage = 10;//K $_colAlt = 11;//L $_colTitleNav= 12;//M $_colSEOTitle= 13;//N $_colKeywords= 14;//O $_colSEOImage= 16;//Q $_colMeta = 15;//P $_colURL = 17;//R $_colURLnew = 18;//S $_colCanonical=19;//T $_colParent = 20;//U $_colAudio = 21;//V $_colVideo = 22;//W $worksheet = array(); array_push($worksheet, array( 'Title', 'Category', 'Sub-Category I', 'Sub-Category II', 'Sub-Category III', 'Sub-Category IV', 'Sub-Category V', 'Content', 'Intro', 'Author', 'Image', 'Alt', 'Title for Navigation', 'SEO Title', 'Keywords', 'Meta Description', 'SEO Image', 'URL', 'URL New', 'Canonical', 'Parent', 'Audio', 'Video URL', 'ID' ) ); foreach ($AllPages as $page) { try { $subcats = GetSubCategoryNames($page); $subcat1=''; $subcat2=''; $subcat3=''; $subcat4=''; $subcat5=''; try { $subcat1 = $subcats[0]; $subcat2 = $subcats[1]; $subcat3 = $subcats[2]; $subcat4 = $subcats[3]; $subcat5 = $subcats[4]; } catch (\Exception $e) {} array_push($worksheet, array( $page->title, GetCategoryName($page), $subcat1, $subcat2, $subcat3, $subcat4, $subcat5, $page->content, $page->content_intro, $page->author, $page->image, $page->image_alt, $page->title_nav, $page->seo_title, $page->seo_keywords, $page->seo_description, $page->seo_image, $page->url, $page->url, '', $page->seo_canonical, $page->audio, $page->video_url, $page->id )); } catch (\Exception $e) { WriteLog($e->getMessage() . " " . "{$page->title}" . " has errors"); } } try { $excel = new SimpleExcel('xml'); $excel->writer->setData($worksheet); $excel->writer->saveFile('SSS-Exported'); } catch (\Exception $e) { WriteLog($e->getMessage()); } } P/S In case you need to switch from CSV to XML, this post could be of interest. .
  25. Or alternatively, if you can associate a field with each menu item say "show". You would loop through each children, tagging anything to show. When you loop through up the chain, you check if the children has something to show, and if it does it gets tagged as show. Only thing I'm not clear is if there's a scenario where a parent has to be shown but there's no content for its child. You may need to check for this scenario separately, and if such conditions are met, you will need to recurse back down to the children and tag it to show.
×
×
  • Create New...