Jump to content

MilenKo

Members
  • Posts

    466
  • Joined

  • Last visited

Everything posted by MilenKo

  1. Hello. As far as my coding skills allows to understand, the example from Raymond Geerts would make the star number to appear rather then allow the user/visitors to rate a page content. Does anyone have implemented similar functionality for the frontend using FieldTypeStarRating?
  2. @Zeka Thanks for the suggestions. I did see those two however I had issues showing the star rating on the frontend and even more to allow users to select one that can update the page rating. I saw an example for the Star Rating Integer and am trying to implement it, but so far no luck. So far The FieldTypeRate was promissing an easy star appearance for the frontend, that can be manipulated from the admin but simply does not show the stars with PW 3x. That is why I asked if someone knows of a shared profile that uses the rating on both ends so that I can see and modify it for our needs.
  3. After passing the initial validation with the team today (everyone liked the theme so far and most important the super-fast browsing thanks to PW), I got a request to put a star rating for all Articles and/or News. Looking at rating options and abilities, I was not really able to find a module that would allow the needed functionality out of the box. Well except with one - FieldTypeRate which seems to be a mixture of a jquery start rating and an adoption module for PW. I quickly installed the module and started testing it, but I am unable to show the stars on the frontend ($page->article_rating). Can someone propose a working sollution for a rating system (prefferably as a fieldtype) that works or any PW profile I can have a look and see how the rating is implemented?
  4. Hello @Jonathan Dart. Are you aware if the module would work in PW 3+ and if so, could you share some details about installing the module? I tried to place the extracted folder to site/modules, but that did not work.
  5. Thanks Robin S. Will try to style those and see how it goes from there. At least I would have the links to prev/next page separated. Do you have any idea why the {class} is not inserting properly in linkMarkup? It seems strange to me that it works fine with itemMarkup but not with linkMarkup ?
  6. Looking at the code this morning, it would have been so easy if I could apply the class='{class}' to the linkMarkup same as it can be applied to itemMarkup. On top of that I need to find a way to move the prev/next buttons aside from the page numbers. Trying to link $page->next() worked sort of but did not point to the next rendering result page but to point to the next page in the row after the initial Recipes one. What am I doing wrong and how can this be achieved? Out of all the issues I was prepared to have, the pagination was one of the easiest to deal with earlier before I had a different template to work on P.S. I just noticed that the present page is wrapped up with <span> so I should be able to assign the curent-page to a span and it should work, but that won't still solve the issue with moving the arrows to the sides. I am looking into a link for Prev/Next page that I could add to the link and the case would be solved.
  7. Hello. I am working on a culinary web project where I am aiming at listing all recipes with a pagination after reaching the recipe limit. As far as I already did the pagination on another project, I was quite happy to use the code and see it in action. However, my joy was not lasting long as far as the present pagination HTML code differs from the other and I was scratching my head today for several hours and yet no solution to precisely match the styling. I was able to apply the pagination, show the prev/next and numbers properly, however the active class is not applied properly and the design has the prev/next arrows at the both ends of the recipe block (image attached). Here is the pagination original html code: <!-- Pagination --> <div class="sixteen columns"> <div class="pagination-container"> <nav class="pagination"> <ul> <li><a href="#" class="current-page">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> </ul> </nav> <nav class="pagination-next-prev"> <ul> <li><a href="#" class="prev"></a></li> <li><a href="#" class="next"></a></li> </ul> </nav> </div> </div> And here is my pagination code (after making sure that the template pagination is enabled): <div class="sixteen columns"> <div class="pagination-container"> <?php echo $result->renderPager(array( "nextItemLabel" => __(">>"), "previousItemLabel" => __("<<"), "currentItemClass" => "current-page", 'listMarkup' => "<nav class='pagination'><ul>{out}</ul></nav>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>" )); ?> <nav class="pagination-next-prev"> <ul> <li><a href="#" class="prev"></a></li> <li><a href="#" class="next"></a></li> </ul> </nav> </div> </div> As far as the pagination active class is not applied on the <li> but on the <a href... > I tried to change the linkMarkup to: 'linkMarkup' => "<a href='{url}' class='{class}'>{out}</a>" however that shows that the {class} is not applied with linkMarkup but with itemMarkup. Tried to add the class to itemMarkup too, but the same result is showing. For sure the navigation is not an issue if it is next to the numbers, however I wanted to attempt to match fully the style and learn how can I move the prev and next pointers away from there or in other words to match the original theme. So any ideas how to achieve the proper functionality and obtain the previous/next page links? I read so many tutorials and manuals today mentioning to use prev() and next() but in my case the results are not coming from $page and the next page pointed to the next page in my admin but not the next results page.
  8. @adrian I am thrilled by your suggestion and would give it a try once the main functionality is achieved. For the moment both the ingredients and Cooking instructions were completed using a textarea field with 1 ingredient per line. Here is the code in case somebody needs it: <ul class="ingredients"> <?php foreach(explode("\n", $page->recipe_ingredients) as $ingredient) { // Explode function is to get the value before Enter key $incr = $incr + 1; // Increment is used for the checkbox ?> <li> <input id="check-<?=$incr;?>" type="checkbox" name="check" value="check-<?=$incr;?>"> <label itemprop="ingredients" for="check-<?=$incr;?>"><?=$ingredient;?></label> </li> <? } ?> </ul>
  9. Thanks for the advice @adrian. I will have to look into it for the future. As far as this is a premium project, at least it will support the development For the moment we decided to simplify the things and go with @BitPoet suggestion as it would allow us easily to add recipes in the future by just copy/pasting ingredients from our old website to the new one.
  10. Thank you very much for the sharing, BitPoet. At first I thought of an repeater too, however some "tough" recipes would call for 10-15 ingredients (if not more) and it would look a bit confusing. On top of that we need to insert some dividers to group some ingredients too. I also thought to try with PageReference field however that might be even more confusing than the repeaters as only two of the four fields need to be referenced and the other two just text. Unless there is another way to have four different fields to be grouped on one line and added at once, I think we are running out of options (other than having a custom js/jquery script to do that - which is beyond our power yet). Will give a try to split the lines and eventually use a #TEXT# to insert dividers and see how it goes from there. For sure, having a text field would also allow me to search for ingredients, and/or directions being done the same way. Will let you know how it goes after implementing this tonight after school
  11. Hello guys. I am starting as a new project to work with my daughter on a cooking recipes website to use it as an initial web development learning curve (for both of us ). So far we did the main page and category listings, but now we need to find an approach for adding the ingredients. Initially I thought to add a simple TextArea field and allow to list the ingredients, quantities etc. in it, however that won't allow us to style it properly (especially if somebody else is adding recipes too). What we are trying to achieve is an ability to add ingredients one per line and then style them with a class in between <ul> & <li> (my guess guess is we need to use some php to separate every line from the rest and make it an array or else but how to easily achieve it - that is the question) Any ideas/suggestions how to accomplish that?
  12. Ok, it makes sense now why it did not work. So any suggestions of the best practice to apply the existing bootstrap styles to the FieldtypeComments form?
  13. Could someone advise me of the best approach for a custom Comments submission form as I tried to create MyCommentForm.php and include it where it is needed as per Ryan's earlier advice, but that did not work. Here is the content of the form: and the call in articles-inner.php is: include("./includes/MyCommentForm.php"); $form = new MyCommentForm($page, $page->comments); echo $form->render(); Browsing an article page shows the form correctly, however the comment is not posted and I see an error: Fatal error: Class 'MyCommentForm' not found in C:\OpenServer\domains\nowknow.pw\site\assets\cache\FileCompiler\site\templates\articles-inner.php on line 136 Error: Class 'MyCommentForm' not found (line 136 of C:\OpenServer\domains\nowknow.pw\site\assets\cache\FileCompiler\site\templates\articles-inner.php)
  14. Working on comments this morning I noticed that in the menu there is something that should not be there - I had the Tags page reference appearing. It was normal for the query I used so I decided to dig a bit to see how can I exclude it (I don't need to show the tags as a menu link pointing to 404). So I modified a bit the query and am sure I will use this approach for any future templates, so here it is:
  15. Hello again. Today I worked on fixing the "class" active of the home menu and ended up removing the Menu module discussed earlier and using the code from the default demo profile: After the menu fix and some block contents moving around to avoid duplicates, it was the time to start digging into the comments functionality. Initially I expected much bigger resistance, however it took me 2 minutes to install two necessary modules: FieldtypeComments and Comments to allow the adding and approving them. As far as the default form was not close to my styling, I had to use the custom calls to achieve it: Then I added a few comments and I was extremely happy to see them appearing properly 100% matching the original styling. Where I am having a bit of confusion is how to apply the custom styling to the comment submition form as the original call of echo $page->comments->renderForm(); shows a form that is having different styling. Also as my form has a button REPLY, I was thinking is there a quick way to link to the post submition form? For sure I can use the styles of the original form and modify them to fit my needs, however I am wondering is there an easier way to achieve that using the theme code and some hooks or else?
  16. Today I got back to the project again and following the already existing arrays to make dynamic the Latest News block: Basically there was nothing difficult/different other than creating a limited array (4 pages as per the design) and sort the result by -date. The rest has been already discussed earlier, so am not going to repeat it. Besides setting up the Latest news, I decided to remove the Twitter block from the footer as far as the theme would be used on a local server in the office.
  17. For those who might be looking for a similar solution, here is my search php that is all done now. And here is the sidebar.php code related to the tag cloud that makes the keywords in the cloud showing the search results:
  18. Alright, we got it all sorted out now using the following query: $matches = $pages->find("template!=keywords,title|body|keywords~=$q, limit=10"); where !=keywords is to exclude any page using "keywords" as template and |keywords is the name of the field used to contain the tags. I am super happy now as the cloud works fine sorting out the used tags by most used (which I needed) and the search page shows any result that contains the search text in title, body and keywords. Now I will only have to modify the text shown if no results are found to be suitable and that is all
  19. @Robin S I decided to redo the tags again as it only takes a few steps to achieve that. So the first thing to try again was to include the keywords in $matches as I knew it is all working fine but to show keywords results. And suddenly, I can see both results correctly - the pages matching the text in title, body and those, matching keywords. I am not aware why it did not work at first place but my thoughts are that for different tests I might have changed a field, template or page from keywords to tags. Now I need to only exclude the Keywords pages itself from the selectors query and it is all completed. Thank you @Robin S mostly for your patience and simple solutions. It meant a lot to me to have a working first theme the way I like it as any other one that would follow will match in one way or the other what I already have. Now I only have to dive in to selectors and find the way to exclude something from the query. That should not be a problem (I guess ).
  20. Ok. I tried to implement your last suggestion as I really liked the approach, however for some reason the IF statement does not work for me. To simplify the things, I created a simple search.php file containing the following code (please note that my tags field is called keywords. Same thing applies for template and page container): <?php /** * Search template * */ $out = ''; $keywords = $sanitizer->name($input->get->keywords); $q = $sanitizer->selectorValue($input->get->q); if($keywords) { $matches = $pages->find("keywords.name=$keywords, limit=10"); // assuming your tags field is named "tags" // output your matches for pages with this tag echo "Tag Match"; } elseif($q) { $matches = $pages->find("title|body~=$q, limit=10"); // output your matches for the search query echo "Title|Body Match"; } ?> So I browsed the main page and searched for a keyword that I am 100% sure it is used for page. So far the result was: Title|Body Match , even though I do not have any page title or body content with the same keyword. Am I missing something here?
  21. @Robin S If I am aiming to extend the search to title|body and tags, would that make sense as the first two are fields containing just a text input where the tags are pages. It would be nice to make the search form to search for a text string within the title, body and tags field however I am not sure how easy that is to achieve because of the fields differences. I thought your example was to be added to the search form however started understanding your point - to use the query to link the top X tags and link them to the pages only in the tag cloud. In such a scenario, I need to find the relation between the tag cloud template and the results showing in the same structure as Articles. But will see how it goes. One thing I was thinking also, would it be easier to have the tags as a text line and separate them by coma? Doing so should allow me to have the search easily modified by just changing the $matches to search in title|body|tags. As to show the cloud, it might not be really necessary even though I am sure I could grab the tags of every page again with some modifications to the @Robin S code but that would require to use explode to extract every tag from the text.
  22. Hello @Robin S I tried today to implement your suggested modification in the search.php however I got two results none of which is what is needed: 1. if I search for existing tag, I am shown the page with the tag name as title and if I click on it brings me to 404. 2. If I search for non-existing tag, I get twice the message that nothing is found (first time it shows because it is looking for a match in title|body and second time - in the tag). From what I understood so far, the issue comes with the fact that the page title|body search would also make the tag available as far as it is also a page. I need to separate the two but so far I am unable to figure out how to implement the tag search separately from the title|body one. I am attaching my original search.php code in case somebody have some time to suggest the fix or at least point me to the right direction. Looking at the code further, it is not clear how I would need to organize the query so that I can search for tags and page title|body text using the same query. For the moment anything I search within the search form on the main page has the structure: localhost/search/?q=enzymes
  23. @Robin S Thank you, Sir! It worked like a charm and now the tags are sorted out properly. What is left would be to figure out the search query and see how to implement it in the theme.
  24. OK. Testing out the @Robin S code made the tags cloud working on the main page. The only thing that I need to change is the order of the tags where I would need to have the most used ones to appear first. As of now, I am not sure how the tags are sorted but for sure the counter works fine. I need to find a way to sort the results by $value and it would all be good.
  25. @fbg13 For sure the caching would speed up the page loading, however, in my development, I am not activating this as to avoid some style/coding issues. Once I know the functionality is all sorted out, I will activate the caching and cleanup of the code etc. Thank you @Robin S and @Sérgio I will give it a try and see how it fits. Once I get a working example, every next project would be easier...
×
×
  • Create New...