Neo Posted June 5, 2015 Share Posted June 5, 2015 In order to learn and better understand how PW works, I would like to build a simple blog / news system, where articles can be posted under different categories and an overview page lists all available posts with pagination. Within the site's menu (I am using Markup Simple Navigation), the overview page should just be displayed ("blog / news") without showing any child pages. I don't want to use a module. The only tutorial I found so far is the following: http://wiki.processwire.com/index.php/Simple_News_System Is this the only tutorial available / the recommended approach? Would appreciate your guidance and advice. Link to comment Share on other sites More sharing options...
Macrura Posted June 5, 2015 Share Posted June 5, 2015 building a news system could take some in depth knowledge of the api - i would read all of the docs and study the cheatsheet. the navigation is trivial; there are innumerable ways to include/exclude pages (MSN supports selectors) 1 Link to comment Share on other sites More sharing options...
Craig Posted June 5, 2015 Share Posted June 5, 2015 Not a tutorial exactly - but you could perhaps look at the blog profile to see how certain things are achieved? 1 Link to comment Share on other sites More sharing options...
MuchDev Posted June 7, 2015 Share Posted June 7, 2015 I am just wrapping up a fairly simple blog/news system and I unfortunately don't have the time to do a tutorial, but I would be happy to share my code if you were wanting to see how to execute anything. I took some ques from Ryan's profile as well as his blog module. I think it would be a really good place to start. here is my public(ish) dev version: http://www.muchdevelopment.com/spa/ Link to comment Share on other sites More sharing options...
Neo Posted June 7, 2015 Author Share Posted June 7, 2015 @MuchDev sure, always happy to see ideas and input. Setting up the basic structure with the pages is fairly simply. What I am struggling with a bit is a category function for each post. Instead of having to create a specific page in the tree for each category under which you can post new items, I would like to be able to create / assign the category within the news item's page. Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 7, 2015 Share Posted June 7, 2015 You should take a look at this: https://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/ 1 Link to comment Share on other sites More sharing options...
mr-fan Posted June 7, 2015 Share Posted June 7, 2015 @MuchDev sure, always happy to see ideas and input. Setting up the basic structure with the pages is fairly simply. What I am struggling with a bit is a category function for each post. Instead of having to create a specific page in the tree for each category under which you can post new items, I would like to be able to create / assign the category within the news item's page. Cathegories...are simple by pagefields. (Even nice functions like "See also" could be just simple pagefield to select.) Easy example on a site for a diary like newssystem with use of URL segments....really great stuff for little functions like /archive/ or /2015/ or /my-cat/ just with different URL segements... Newspage: http://waldkindergarten-altfraunhofen.de/aktuelles/#start URL Segment for archive show all: http://waldkindergarten-altfraunhofen.de/aktuelles/archiv/#start URL Segment 2 for year: http://waldkindergarten-altfraunhofen.de/aktuelles/archiv/2015/#start or for cathegory name: http://waldkindergarten-altfraunhofen.de/aktuelles/archiv/ausfluege/#start every single item lives under /aktuelles/: http://waldkindergarten-altfraunhofen.de/aktuelles/unser-waldkater-2015-05-11/ (it get on creation a name + date combination) some codeexamples for URL Segments are here - this works with just a few lines of code so great, so easy, so cool...ähh sorry but in every second post i have to write how much i like PW!! https://processwire.com/talk/topic/9476-new-project-a-nice-growing-kindergarten/#entry91259 (attention - it's may not the best code but it works so far) some backend pics... I only have one single cat to choose since i use this in the isotope view to sort! best regards mr-fan 3 Link to comment Share on other sites More sharing options...
adrianmak Posted June 13, 2015 Share Posted June 13, 2015 I am just wrapping up a fairly simple blog/news system and I unfortunately don't have the time to do a tutorial, but I would be happy to share my code if you were wanting to see how to execute anything. I took some ques from Ryan's profile as well as his blog module. I think it would be a really good place to start. here is my public(ish) dev version: http://www.muchdevelopment.com/spa/ how did you implement the categories and tagging something like /?cat= /?tag= on the url ? 1 Link to comment Share on other sites More sharing options...
Macrura Posted June 13, 2015 Share Posted June 13, 2015 (edited) @adrianmak - if you use the GET variables (aka query string parameters), then you can use them in a selector, once sanitized; and then use that selector to present the relevant posts. I have used that option, but now i always use segments, since i can cache those pages. i would probably only use get vars if i was maybe filtering client side, so still able to cache the page itself... Edited June 14, 2015 by Macrura clarified technical terms 2 Link to comment Share on other sites More sharing options...
MuchDev Posted June 13, 2015 Share Posted June 13, 2015 I utilized the method demonstrated by MR FAN. Add a page field to your template, or in my case an autocomplete field with the part of the tree that houses categories or for the tags part of the tree for the tags. Then you just search for pages that have that page title within them. //look for get strings if($searchString = $sanitizer->selectorValue($input->get->tag)){ $tagTitle = $pages->get("template=tag,sort=-created,name=$searchString")->title; $query = $defaultQuery.",tags.name=".$searchString; $headerText = 'Posts tagged with "'.$tagTitle.'"'; }elseif($searchString = $sanitizer->selectorValue($input->get->cat)){ $catTitle = $pages->get("template=category,sort=-created,name=$searchString")->title; $query = $defaultQuery.",categories.name=".$searchString; $headerText = 'Posts relating to "'.$catTitle.'"'; }else{ $query = $defaultQuery; $headerText = "Current posts"; } //find posts based on query $posts = $pages->find($query); 1 Link to comment Share on other sites More sharing options...
adrianmak Posted June 14, 2015 Share Posted June 14, 2015 @adrianmak - if you use the get vars, then you can use them in a selector, once sanitized; and then use that selector to present the relevant posts. I have used that option, but now i always use segments, since i can cache those pages. i would probably only use get vars if i was maybe filtering client side, so still able to cache the page itself... What is get vars ? a pw's api ? Link to comment Share on other sites More sharing options...
LostKobrakai Posted June 14, 2015 Share Posted June 14, 2015 It may look a bit special because of the lower case spelling but it's the GET variables you're using mostly with forms. Everything after "domain.com/?variable=value". 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now