MilenKo

Members
  • Content count

    162
  • Joined

  • Last visited

Community Reputation

37 Excellent

About MilenKo

  • Rank
    Sr. Member
  • Birthday September 17

Contact Methods

  • ICQ
    99982787
  • Skype
    mikemastercorp

Profile Information

  • Gender
    Male
  • Location
    Montreal, Canada
  • Interests
    Web development, coding, Network infrastructures, Linux, BSD, Windows, Cisco, Photography, Cooking

Recent Profile Visitors

297 profile views
  1. Ok, I got it working with the initial query: $result = $pages->find("template=recipes-inner, sort=-recipe_views_counter, limit=4"); The issue was caused by the fact that I selected the recipe_views_counter to be Integer, but in Numeric Input Type I had Text by default. Changing it to Number (HTML5) did the trick. One less thing to worry about
  2. Tried again this morning using get instead find: $result = $pages->get("/recipes/")->child("sort=recipe_views_counter, limit=4"); The result was 26 recipes instead of the 4 limitted and I am not aware where it got 26 from as it is not the number of all available ones and is not even the views number. What am I missing here? As far as I removed the sort it works just fine: $result = $pages->find("template=recipes-inner, sort=-modified, limit=4"); So it seems like I am unable to sort by the recipe_views_counter only. Could that be because of the field being an Integer?
  3. Hello @rick and thank you for your reply. You are perfectly right that it was a typo, however the query result is still empty: $result = $pages->find("template=recipe_inner, sort=-recipe_views_counter, limit=4"); foreach($result as $most_views) { .... } It seems like the sort selector is not picking up posts... I am always forgetting about the miraculous Tracy Debugger so will check whit it what is wrong...
  4. Hello. Trying to implement Most visited pages on my recipe site. I already added a field called recipe_views_count and the code to count visits (for now not excluding the session): if (!$user->isSuperuser()) { $page->recipe_views_counter += 1; $page->of(false); $page->save('recipe_views_counter'); $page->of(true); } so all that part is working fine and I am able to see the counter incrementing. Where I am stuck is how to show the most viewed pages now and sort them by the number of visits (max. first)? Trying this: $result = $pages->find("template=recipe_inner, sort=-recipe_views_count, limit=4"); foreach($result as $most_views) { echo $most_views->title; } However something is not right as the query returns empty. If I remove the sort criteria it shows the proper number but for sure not taking into consideration the views count.
  5. @Zeka I think I found the issue as the query seemed perfectly right but was showing strange results. So I went back to check every template and found out that Categories page had assigned recipe-inner as template instead of categories. This would explain the strange result. Edit: After applying the proper templates as per the tree above, the query returns no results. I even deleted all the categories child pages and added them back to every recipe to make sure that at least a few of them would match with others, but still nothing.
  6. == Home == Categories (template=categories) == == Category 1 (template=categories) == == Category 2 (template=categories) == Recipes (template=recipes) == == Recipe 1 (template=recipes-inner) == == Recipe 2 (template=recipes-inner) == Tags (template=tags) == == Tag 1 (template=tags) == == Tag 2 (template=tags) So each recipe could have multiple categories or a single if needed. With the earlier provided code, $related is equal to the id of Categories page but not to the recipes containing the selected categories, hence $related->title shows "Categories"
  7. @Zeka I tried your suggestion and I am closer but the result of the query is not what is needed: Here is the code I used with a tiny modification to match the correct field names: $recipesCategoriesSelector = $page->recipe_category->implode("|"); $related = $pages->find("template=recipes-inner, recipe_category={$recipesCategoriesSelector}, limit=3"); foreach($related as $similar_recipes) { echo $similar_recipes->title; } The result I see instead of having the title of the recipe is the text Categories which is the name of the parent that I used to add child pages as categories. Any ideas what is wrong?
  8. @Zeka Will try your suggestion later on today and share if that works fine. Because I was thinking of another way to organize what is needed, but I don't want to flood the topic. Basically instead of finding matching pages I thought to add a field with PageSelect and pick up manually recipes that would have similarities. Doing so is not an automated process but in my case would allow to be used for drinks matching the recipe or other recipes that you would prefer to suggest (versus the automated). It is always good to have options so I appreciate your suggestion. Now I have an option to provide similar pages by tags, by "category" and manually select so it could even be set in the admin as a drop down box to choose which way to go
  9. @Zeka I thought about that too, however with similar products you can make completely different results sometimes so it won't be a match. Example would be using almonds/almond flour and coconut oil to pan-fry meat or make a cake
  10. Hello. I found this topic looking for some ideas about similar pages. Presently I am working on a cooking website and am looking at how to organize a block of similar recipes in the recipe view. What I have so far is a parent page Categories in which I am creating the child pages for every category. Then in the recipe template I have a field (recipe_category) to select one or multiple categories the recipe belongs to. If the recipe had only one category assigned, it would have been easy to get the result checking if there are others within the selected category however what would be the approach if a recipe belongs to multiple cats? I know I could use the recipe tags too for the sorting and in this case I could implement the tags weight solution provided in earlier posts however how would you suggest to find similar pages which would basically hold an array of recipe_category?
  11. @Sanyaissues I know its been a while since you posted the page in this topic but it really gave me an idea to try - the ingredients list. Could you share some ideas of the approach? The only way I can see it through is by using the repeater approach for every ingredient in the recipe but it has its downsides... Btw, I really like what your work as the page is very clean and the picture materials speaks for themselves.
  12. Module

    @adrian I am almost done with the website main html so will start this week/weekend to turn it into the theme I need. Once I star, I will delete from one post the Posted field and see if the date is preserved and what is more important - if it is the correct one. So we will know soon how would that work
  13. Module

    @adrianI am coming back with a little issue/question for the importer. After finishing the process I noticed that there is a field called date where the importer adds the post publishing date. So do you know if I delete the field the proper timestamp of the post will be kept?
  14. Module

    @adrian I have just ran the test again this morning using your latest update from GitHub and was super happy to find out that the posts import went OK and the comments time stamp is perfectly matching the original. The rest (tags, fields etc.) are not imported, but as I mentioned earlier I do not mind fixing them myself as I need to do a lot of crap cleanup beyond the scope of this topic and not related to the module import. So for now I am totally good to start my work and move the posts to their new home so THANK YOU! If you ever need me to test an import or else, I have my local copy set so I can always run it again and again. For anyone dealing with a migration like mine, feel free to work on your PW Profile (appearance, functionality) then import the WP content to a newly created page of your choice. Once this is done all you have to do is to make sure that the fields in the imported pages are matching the ones in the template you are going to assign the posts to. In my case initially I have imported 600 cooking recipes but the original profile did not contain the comments module yet. So after the import and assigning the imported posts to the recipe template, I lost my comments. To make it work, all I had to do was to assign the comments field to my recipes template and only after that to start changing the imported pages one. Voila, I am now off the WP for good and the work continues.
  15. Module

    Heh, no worries at all @adrian It is perfectly clear that your efforts are put of a good will and you have definitely helped a lot already so no need to apologize for anything. I just saw that MigratorWordpress has been updated 7 days ago and thought I missed your update. Will test the import once I get back toy place tonight and let you know how it works. So far, the only "issue" I had with the importer are the comment dates as I am certain I did not tag the recipes properly and want to edit each one to achieve my new strategy. But hey, no rush at all, OK?