Jump to content

MilenKo

Members
  • Posts

    466
  • Joined

  • Last visited

Everything posted by MilenKo

  1. Hello again. I decided that it was too easy to achieve the list of the children of a child, so to have some extra fun and make it look better, I decided that it is time to mess up with the counters and show in the Articles template the number of howto pages in every child-category. I am playing now with that and once I have some progress, will share it up (or ask for help ) This counter would not be just a cosmetic but is a needed feature for the home page where I will have to manage to list the parent-categories with N-howto child pages and a counter of the child in it. So let's have fun.
  2. Please note that I did not look at the opening and ending PHP for the moment so I am leaving the cleanup and code elegance for the end when I will move to testing and optimization. I decided to do it that way hoping that with the time I will gain a bit more coding skills and that would allow me to rethink the approach and have the theme properly optimized. As of now, here is what was achieved: == HOME PAGE == 1. Header logo is uploaded using fields 2. Header Menu is set statically (except Home link pointed to $config->urls->root;) As far as we have only 5 links, I did not bother using API even though it is not hard to do it and the code was posted earlier. 3. The 3 Features blocks under the header were done by a defined field in Homepage using a repeater (every feature contains the fa-icon, title and body text). 4. About US block in the footer is defined by About Us field in the Homepage. The plan is at the end to move all the settings to a Settings page and does the proper calls from there, however, let's not complicate the things more for the moment. 5. Last but not the least for the HomePage - the search form is working fine even though I am planning to mess up with the Ajax search later to make it, even more, friendlier and interactive. == Articles == 1. Articles page shows up a title and some nice headline text (as per the theme styling) - all pulled out by the template fields. 2. Articles page lists now all the child pages that are used like containers/categories to hold the thematically sorted child pages. As far as I changed the idea today, I will have to look and replace the date of publishing and parent category with the number of howtos in each child under Articles. 3. About US in the footer did not show, so I had to change the code from $page->about to $pages->get('/')->about == NEWS == 1. Same things have been applied as per Articles. 2. Styling has been changed to add an image for every news. I still need to add a check if an image exists in the post and if not, assign a default one. Outside the pages, every inner page has the breadcrumbs automatically pulled up and does not need any fine tuning. The next step would be to tie up the Software, Hardware, Network on the main page and sho N-number of pages there too with some sorting applied. Now after playing with the child of a child I hope that it won't be that difficult to achieve it.
  3. Phew... after messing up the things quite a few times and getting confused about showing the child of a child of a child, I decided to step off for some time and then come back with some fresh ideas. The first few minutes were crucial as everything started working as it should with minimal changes to the original Articles template. Here is the articles.php And here is the articles-category.php:
  4. @nik, that is exactly what I was looking for because I got stuck with the child of the child of the child pulling and I either need some coffee to wake up or some good sleep and no distraction from the family. You have made my day, man!
  5. I had a few minutes for a quick look and searched the forum about showing the child of a child. Found some very resourceful info and decided to organize the things elegantly. To do this, I created a new template calling it articles-categories and assigned to it the articles fields. After playing with $render I was able to pull up the list of articles including the children (software etc.) Then it was just a matter of moving the child pages to software and allowing the articles template for the new child to be articles-categories. Then I came up with the idea to list only the child-cattegories in articles so that a visitor can choose what he is looking for and click on the proper howto group. Once I get back home I will share the code I used as I still need to work on it a bit in order to make it fully working. Having this approach eliminates the page duplication as if you browse the /articles/ you will only see the child but not their children. For sure, if you click on the children in Articles, then you will see all the parent-name related articles. Let's see how that goes and hopefully there will be no more surprises on this. To make the theme looking better I will remove the date and time of adding from the articles template as it would only lost the groups and it is not needed to show such info
  6. Robin S, I am EXTREMELY thankful to you as it was really the family setting that I missed out somehow. I was able to apply the Articles template to Software "category" being a child theme and assign to it a few child howtos. For sure I will have to deal with an error as the theme was not intended for this approach and I got this: Notice: Undefined variable: result in C:\OpenServer\domains\nowknow.pw\site\assets\cache\FileCompiler\site\templates\articles.php on line 55Fatal error: Call to a member function renderPager() on a non-object in C:\OpenServer\domains\nowknow.pw\site\assets\cache\FileCompiler\site\templates\articles.php on line 55 where the Articles template code around line 55 contains the pagination code: <footer class="archive-footer text-center"> <?php echo $result->renderPager(array( "nextItemLabel" => __("»"), "previousItemLabel" => __("«"), //"firstNumberItemClass" => "pagination__item--first-num", //"lastNumberItemClass" => "pagination__item--last-num", //"previousItemClass" => "pagination__item--prev", //"nextItemClass" => "pagination__item--next", //"firstItemClass" => "pagination__item--first", //"lastItemClass" => "pagination__item--last", "currentItemClass" => "active", //"itemMarkup" => "<li class='pagination__item {class}'>{out}</li>", //"linkMarkup" => "<a class='pagination__item-link' href='{url}'><span>{out}</span></a>" "listMarkup" => "<ul class='pagination pagination-custom'>{out}</ul>", )); ?> </footer><!-- .archive-footer -->
  7. @szabesz Thanks very much for the info. My guess is that I am more like a guy that looks at examples and finds the interesting approaches, so the ghost clone seems like another perfect example to dig in and squeeze some knowledge from the more skilled and advanced coders.
  8. I tried to add a page assigning the article template to it and then move it, however, PW is not allowing that to be done and shows the error attached. Now I am in doubt how could this be achieved as obviously, my logic is against PW logic or rules. All I am looking at is to have sort of a "Category" with a "Child category" in it to be listed with the same template as the Category one. For sure I am able to create Software, News, Hardware and Cisco as parents and start adding the child pages to them, however they would not be listed as children of Articles. One way to approach this would be to use selectors as suggested earlier, however any new HowTo category would cause a code edit instead of listing the new page automatically. Now I plan to add only 4 but what if there are 100?
  9. Getting back to NowKnow, I moved on to add a few child pages of Articles (Software, Hardware, Network, Cisco). I decided that pointing to that child should list all the child pages topic related to the parent, so would point the parent to have the same template as the articles itself (articles). However, I am struggling to do that as in the drop down list I only have the articles-inner which would list the article itself (title, image, body text etc.) Am I missing something here or there is another way to assign the Articles template to its "groupped child" (Software, Hardware etc.) My goal is that if somebody browse an url: http://FQDN/articles/software - that would show all the software howto child pages having the same listing template as Articles. Having clicked further on the title, would link to the child page content and being styled by the articles-inner template. Any suggestions or ideas how to achieve that? I did not test to create the a page under Home and then move it to articles to see if its template would change, however I am not sure this is the best way to achieve it?
  10. I started thinking this morning... If I want to apply the delayed output to a theme, what would be the best approach to such a complex theme containing tons of blocks etc. on the main page. Should I decide which part of the page would be the main "body" output and the rest to be included or added, so that any other page applies the same content and be able to push $body/$content at the same spot or what is the best approach for that. If I am not wrong, the init.php (file loaded before) and main.php (the file loaded after) are applied to all pages in the profile but not exclude the home page. I checked the skyscrapers theme however the main page does not contain that many features on the main so I am still struggling to figure out what is the best approach in a more complex website. For sure I can do a standard page template but am trying to learn the best practices and start applying those rather than just do what you can. Even if it takes more time to process and figure out all the bits and pieces, I am willing to invest my personal time into something so elegant leading to a better and more productive result
  11. @szabesz you made my day . To be honest, I do not think you were dumb not to see it properly organized. It is just to have the proper tools, some willing to achieve the task and for sure some support from friends and other devs that can have the proper approach. I think it would work the way I see it, but thinking and having it done are two different things. I will definitely see the paginator as I am not sure the search results would be paginated (haven't tested them yet as I did not have added 10-20 pages matching the same search term etc.) But this is on the way So far I will start adding some topics and see how to point them out on the main page. Who knows, maybe the approach would be useful for the others one day that are struggling to get the things done and need a similar structure. If it was done on Wordpress, it would be done in PW and would be way more elegant as a code as well as a logic
  12. Ok. I gave a second thought last night and decided that the howto's would be added only to the Articles, so there will be no need to touch the news and FAQ. Initially I thought to use the FAQ for a quick/small howto's however it seems better to add a few descriptions how to add the articles etc. rather than use it as a knowledge sharing. So the structure would change: |= Home |== FAQ |== News |== Articles |=== Account settings |=== API Questions |=== Customizations |=== Mobile Apps I think that this approach would cause less confusion and would allow to pull up all children of Articles and show N-pages of each on the main. Following the structure above, all that is needed to be done is to have add Account Settings, API Questions, Customizations and Mobile Apps as children of Articles and start adding the howto pages. Let's see how it goes applying the changes. The challenge would be to pull the list of all the children and the N-latest/random pages of it. I am not sure yet do we need to split the News the same way but for the moment I am going to concentrate on the Articles as this is what is the most needed functionality for our team.
  13. Hello Szabesz. It is interesting to know that PW can handle multiple selectors and it would definitely come in use when I get to that point. I want to explain my idea and the needs as I feel as it is not clear. It might become easier to understand my goal by looking at the screenshot I took from the HTML view of the theme (image attached). The need is to have a parent page for some HowTo division by topic and then show a few (in the specific case 3 child pages). On top of that, it is needed to show how many child pages does the parent contain and when clicking to View all, to show only the howto's from that specific parent. In this particular case, I thought to have a structure like this: |=HowTos (parent of all HowTo pages but a child of the Home) |== Account settings (child of Howtos and parent of all Account settings howto pages) |=== Howto1 (howtos itself) |=== Howto2 !== API Questions (child of Howtos and parent of all API Questions howtos) |=== Howto1 |=== Howto2 |== Customization (child of Howtos and parent of all Customization howtos) |=== Howto1 |=== Howto2 |== Mobile apps (child of Howtos and parent of all Mobile apps howtos) |=== Howto1 |=== Howto2 So far I think the best approach would be to follow that structure and then list all the child of Howtos and underneath to show N-pages of the howtos. Having done the things this way, in case of a need to add another child of Howtos and parent of another topic, it would be listed automatically under the already existing in the frontend and of course the N-pages it contains underneath. I hope I did explained it better now as I understand it is hard to explain sometimes what is in the head. Btw, thanks for the shared ideas and the module of @LostKobrakai. So far I am trying to learn how to work with the standard API tools of PW and not extend the functionality with additional modules. I have nothing against the use of modules and am grateful to those who spend their time in creating and sharing them.
  14. @szabesz , I started the sharing as code, however, it went too long, so I changed it to an attachment. Looking at the spoiler block now->makes it look much much better and for sure if searchable would make more use of the code This morning I started to think how to group the Articles, News and FAQ and thought to create a parent called Howtos however I need to attach a template to it and I do not really need/want this to be browsable but just to separate the howto pages from the rest. At first I thought that I can assign a template from the Articles or News however that would duplicate the content (it would contain all articles, news and faq in one list). As I expected it caused error in the articles.php template, where I use the code for the pagination: I wanted to group the articles, news and faq pages at first place just sp that I can grab the list of every child in Howtos parent and show it on the front page where a few posts from each one are shown. On the other hand, if I need to allow access to a colleague to add content than it would just be done by providing it only to the Howtos page and any child pages in it. Any ideas how to better organize the structure if you think my approach is not needed/the best following the logic?
  15. Ok. I had to fine tune some of the possible search errors, so I added the code and error message if no results are found as well as if a search is initiated without keywords etc. Here is the code used of the search.php and search-form.php, so please do not spare the mercy and share honestly if you see something that can be improved in the code. In order to implement the search you need to create add the template using search.php and then create a page (I called it Search Results, as I used the title in the headline) which use search template. As far as the needed functionality so far is achieved with the search, I am moving forward starting to create some real howtos and group them in the proper parents that would be shown on the main page. I am not expecting to have difficulties doing that as the API seems pretty straight forward even for my non-programmers brain but if something comes up on the road, will search for a way to solve it. As per szabesz advice (thanks for the idea), I am adding the code in a spoiler block. So here is the content of search.php: And here is the code for the search-form.php:
  16. Hello again. Today I had to become creative but I am glad to a once that the search functionality is fully completed. As I am getting back to the office and I have to present the theme to my it team, I decided to remove for the moment the drop down categories and post types as it is not even clear are we going to use it or not to share the company knowledge internally. I did not remove the post types as I realized that I will need that to show a different icon before the post title (image, text or video). Once I get back home I will share my search.php and the search form I used in order to make everything work. As always, feel free to share any spotted mistakes or if you know a better approach. To achieve the search functionality, I got the code from PW standard profile and defined the $out to be equal to my result code. I had some issues assigning html code to a phone variable, however after an hour of coding and fixing silly errors it all came as it should. Now when the search is done I think it is time to start importing some real Hortons and add the categories (parrent/child) in order to show the data on the main page.
  17. Ok. It was worth revisiting the instruction for the creation of the page without template (Post types). After assigning it to the template post_types (that have a title and post_type fields only) I was able to create 3 pages (Text, Image, Video) and assign them to Articles-inner, News-inner, and FAQ pages. Because of the fact that the Text, Image, and Video are children of a page, I can list them all using a simple query in the search form dropdown box. Easy as cake. So the search is on its way to being developed and implemented...
  18. Ok. So for the moment I am back to the initial Bootstrap theme to finish what we started. As far as the search functionality offers an ability to select the page category and post type (does it contain an image, video or text), I decided that I need to add a way where the post type can be defined during the adding. Initially, I thought a list of the options would be best where the list would contain: text, image, video however I was surprised that I did not see such type in the field set. Decided to have a checkbox with the three options so that the type can be checked during adding, however, I am struggling to achieve that as well while adding a field Post_type and choosing the type as a checkbox. I am not finding a way to define the choices of the checkboxes so any ideas or suggestions how to do that? I have read something about creating a checkbox field as a page and add some subpages in it with no file defined for the template, however, it was not clear for me, so am still struggling to achieve the simple functionality needed.
  19. Alright. I was checking up the theme and it looks like the one I was looking at was the developers original website, so stripping that out would be also not very much liked. The theme would work in Wordpress and would be free, however I need to setup wordpress, add categories, follow tons of instructions just so that I can strip the code etc. Will have to choose another theme that would be Bootstrap/HTML5, fully validated (it is important to make sure that the final result would also be valid ) and what is most important - to be free with no obligations and if possible - to be a knowledge share. As far as this theme hunt would be long and will move the focus away, I will just look for a good looking valid bootstrap theme that would have some complexity and start with it. For sure I will finish the one I worked on already and share as promised the key parts to make it dynamic.
  20. OK. I think I found the victim of choice that might have even better functionality, however, what is more important - it is fully free so I can use and share the files with everyone. The official theme is for Wordpress so I will have to strip it to HTML code, do an initial cleanup and what is left to implement in PW. It would be exciting I think as I will try to start with the delayed output from the beginning so as usual if you find any errors or know a better approach, shoot straight. Here is the theme in case I got your attention to it. Once I clean up the code will share the HTML version so that we could start it together and learn on the fly
  21. Ok. I think there should not be any issues with the search even though I did not have much time playing with PW even though I planned to. Instead of giving explanations, I will just copy/paste the simple search code with some comments in it to help me and everyone else the logic: I am certain that this would make the search results showing properly, however looking back at the code of the skyscrapers I have found the logic behind the delayed output so I think it might be the perfect timing for me to work a bit on the existing theme files and redo them as per that. I had difficulty understanding the calls and what was the full logic of it, however, I found out that every template defines the content of $content or $body (just variables that can be named anything) so the main template is showing just $content/$body instead of the full logic of the specific template. I might do the simple search first and then start improving the site so will see but what is more important is that the code above makes perfect sense and represents the easy implementation I was so afraid of messing up. Once I finish with the code, I will post the search.php in case someone would need to review it. As far as my example is of a premium theme, I am not sure of the consequences posting the code in here, so I will have a look to another free bootstrap theme that would have most (if not more) of the functionality already discussed and will post the files/theme once done. If you happen to like the premium theme and want to turn it into a project, I will do my best to share the needed pieces of the code to achieve that so that you would already have the rest
  22. Happy New 2017 Year my favorite community of PW. All the best wishes goes to devs of this fabulous Symbiotic Organism (if I may allow myself to call PW like that). The idea behind this is that it grows with every new 'cell' joining the community, it evolves surely in its DNA and the changes happen most of the time rapidly right in front of our eyes. For me as a newbie in the web development and using PW it is so much fun as I am learning a lot and by the time I memorize it, there is already a better and much more elegant approach. But enough of the sweet talk, I still have my goals to achieve and convince myself how easy it can be achieved once the knowledge gets on the way. I'll be honest and admit that so far I was doing some development in short sparks of 10-15 minutes break time so most of the functionality was achieved with a snap of the fingers. Now it is time to implement one of the most important functions to my theme - the search and I would lie if I don't say that I am expecting some struggle and a fight here. The reason to start learning was to make the site search working as we need it at work (mostly used for intranet Knowledge database and not stop only there but to continue improving the functionality based on the expanding needs in time. Looking at first at the theme - I would not even hope to reach that far so PW was like a little Christmas gift for me wrapped with the help and support of all others who knew what/how and did not mind sharing it. Like all crazy people do, we started redecorating and painting our house a few days before Christmas where we had to cook and host a party for the new year celebration so I decided that today is my "day off" from everything where I would lie in bed and do nothing. Well of course I came up with a better idea - to use all my spare time to implement the search at least and document it well in the forms and code so that I can always come back to it and know why I did it that way etc. I saw a few people had some struggling with the search functionality however I am planning to look at the skyscrapers and the default examples and figure it out. So let's cut the good memories of the party and start working out the 2017 I saw this morning Ryan's post and got excited even further so am planning to test his latest release to use as a 'search dissection'
  23. Oops, nevermind guys, I found the answer for $input->whitelist by a simple search. I should have checked the code before. Here it is the explanation just in case someone else is looking at the code and wondering why on Earth it is used. Now would be the time to create a search template to list the results of the search. For this purpose I would need to either use the Article listing or News listing but the decision is yet to be determined
  24. Hello again. A bit of spare time in between the Christmas and New Year parties was used to start working on the search. Having looked at the skyscrapers example and the needs of the theme I use for my project, I realized that to accomplish the search and fit into the theme I would need to add another field to the Articles, News and FAQ templates which would be the post type with a list (text, image/s, video). This was needed as in my search form I have the choice to select the page category (Articles, News, FAQ or Any) as well as the format of the post. I know based on my experience that this functions might not be needed as far as the search results show some results based on any word in any order in the title but it is the theme that decided to do it that way and the idea here is to have an example how it is done if needed. Here is the sample code to list the "Category" and some thoughts about it: <select name="category" class="form-control"> <option value=''>Any</option> <?php // generate a range of all the FAQ types, checking our whitelist to see if any are already selected foreach(array('FAQ', 'Articles', 'News') as $range) { $selected = $range == $input->whitelist->category ? " selected='selected'" : ''; echo "<option$selected value='$range'>$range</option>"; } ?> </select> So far I used just a simple array to list my options as all I did not create initially the Articles, News, and Faq to be under some main template so that I can call a list of the child. I might redo the structure for the later use in order to allow the listing of other categories added on the fly but so far I am trying to achieve the basic functionality and then would work on the improvements. What is not clear to me is te $input->whitelist->category ? Does the 'whitelist' is a part of the skyscrapers theme functions or is a call in PW for the checkup? Of course following the analogy, my format call is like this: <select name="format" class="form-control"> <option value=''>-- All Formats --</option> <?php // generate a range of all the FAQ types, checking our whitelist to see if any are already selected foreach(array('Text', 'Image', 'Video') as $range) { $selected = $range == $input->whitelist->format ? " selected='selected'" : ''; echo "<option$selected value='$range'>$range</option>"; } ?> </select> The game continues...
  25. Hello, everyone. I had a tiny bit of spare time and decided to play a bit with PW. Opening up the page to see if everything so far is working fine, I noticed that the logo is appearing OK on the main (Home) page but on the inner pages it shows a missing image. I remembered that I changed the $page->image->url call that was suggested earlier and did not check if the logo appears. The problem with the logo on the inner pages was caused by the fact that a simple $page->logo-url call would not work on templates where the logo is not added as a field. Considering the fact that in every template I am including the header.inc where the header logo is, I started to think how on Earth the trick is working. A bit of digging and brainstorming and the solution is in place. I added to _init.php the logo variable and changed the call in header.php: $logoURL = $pages->get('/')->logo->url(); As far as my idea is at the end to move most of the settings to a specific "Settings" page, then I will have to change the page where the logo will be kept, however this won't be a problem when I have the reminder of what was done and how in here. Happy holidays and Merry Christmas lovely and super supportive people. All the best and tons of productive ideas in 2017 (that would make our life even easier and nicer using PW )
×
×
  • Create New...