kongondo Posted February 3, 2016 Author Share Posted February 3, 2016 Is it possible to hide the author link shown in the sub-nav sidebar (under the heading See Also)? I've hidden the author in the post itself from the Settings in the Blog dashboard, but I'd like to do the same in the sidebar (since all posts will be written by the same author so it's rather redundant). Having looked at the html I see that each sub-nav link is a <li>, but they're not given a unique class or ID so it's hard to target them individually. All the best, Tony. @Tony, It seems you are using (or copied from) the demo template files that are optionally installed with Blog. In this particular case we are dealing with blog-post.php. The code that generates that sidebar is found between lines 24 - 35. The method spewing out the markup is renderNav() (line #35). As a quick btw, the general rule of thumb is rather than using CSS to hide markup, first check if it is possible not to output that markup in the first place . In our case, it is possible. Line #31 of the code is what is outputting the Author's name and URL. All you need to do is comment out that line, as well as earlier variables building up towards that code, i.e. lines 25 ($authorsURL), 27 ($authorURL) and line 28 ($authorName). I'm not sure you've seen my earlier posts about documentation (it is a long thread after all), but I used to have Blog's documentation hosted on my website, which is currently in deep hibernation until I get time to revive it. Thankfully, the good guys over at wayback machine archived my now asleep and offline website including all the Blog tutorials. These can be found here and the documentation for renderNav() is here. As you'll see, you can use renderNav() to output all sorts of stuff. Hope this helps 2 Link to comment Share on other sites More sharing options...
alan Posted February 4, 2016 Share Posted February 4, 2016 Just in case you didn't see, the (fabulous, super-helpful and extensive) docs and examples @kongondo provided are here. Current status: reading with a grin 2 Link to comment Share on other sites More sharing options...
kongondo Posted February 4, 2016 Author Share Posted February 4, 2016 (edited) Update: Merged dev 2.3.6 to master. This version makes it possible to use CKEditor to create Quick Posts Edited February 5, 2016 by kongondo added some clarity 2 Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 6, 2016 Share Posted February 6, 2016 Hi, how can i change the language in the frontend? For example "Post a comment". I can't find any entries. Link to comment Share on other sites More sharing options...
kongondo Posted February 6, 2016 Author Share Posted February 6, 2016 @congomonster, Sorry this is one of those things that hasn't yet found its way into the documentation. Almost each method in MarkupBlog accepts options to alter its output. For the example you've given, that would be an option in renderComments(CommentArray $comments, $limit = 0, Array $options = null). Within the method, the $defaultOptions are as listed here. The option responsible for 'Post a comment' is 'comments_post_text' => $this->_('Post a comment'), . An example of passing options to the method: $options = array( 'comments_post_text' => 'My Text for Post-a-Comment', 'comments_list_empty' => 'Nobody has dared to comment on this article...yet', 'comments_empty' => 'Are you sure you want to be the first to comment?' ); $blog = $modules->get("MarkupBlog"); $renderComments = $blog->renderComments($page->blog_comments, 0, $options); $content = $blog->renderPosts($page) . $renderComments; echo $content; Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 7, 2016 Share Posted February 7, 2016 Hi kongondo, thanks for your reply. But i need a more help to understand. Where did i have to put your example? I put this in the blog-post.php template. I don't have to change it in the MarkupBlog.module file? Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 7, 2016 Share Posted February 7, 2016 Ok. Get it to work I put it in my blog-post.php and changed something looks now like this: $options = array( 'comments_post_text' => 'My Text for Post-a-Comment', 'comments_list_empty' => 'Nobody has dared to comment on this article...yet', 'comments_empty' => 'Are you sure you want to be the first to comment?' ); $renderComments = $blogConfigs['commentsUse'] == 1 ? $blog->renderComments($page->blog_comments, 0, $options) : ''; Link to comment Share on other sites More sharing options...
kongondo Posted February 7, 2016 Author Share Posted February 7, 2016 Two things: You never need to change the code in the module itself! Otherwise, your changes would be overwritten with upgrades You don't need this code to be like this: $renderComments = $blogConfigs['commentsUse'] == 1 ? $blog->renderComments($page->blog_comments, 0, $options) : ''; If you read the comments in the demo blog-post.php template file, it says for this demo, renderComments() has to adapt to whether blog commenting feature was installed or not whilst remaining blog structure/style-agnostic in your own blog install, you would know if you enabled the feature so there would be no need for such a check in addition, our 'check' code is not code you would normally use in a template file. we use such code here to be both foolproof that the commenting feature is installed and blog structure-agnostic The blog demo could not know in advance whether you or anybody else was going to install Blog with the comments feature enabled/disabled. Hence, it had to make that check by looking into the module configs ($blogConfigs). In your case , you know if you installed blog with the comments feature or not, so no need to make such a check. Hence, use the other code I provided instead, i.e. $options = array( 'comments_post_text' => 'My Text for Post-a-Comment', 'comments_list_empty' => 'Nobody has dared to comment on this article...yet', 'comments_empty' => 'Are you sure you want to be the first to comment?' ); $blog = $modules->get("MarkupBlog"); // Here, no need to check if blog was installed with comments feature; you should know - you installed it yourself $renderComments = $blog->renderComments($page->blog_comments, 0, $options); Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 8, 2016 Share Posted February 8, 2016 Thank you very much! This helps me a lot. Another question i have is, can i change classes the same way? I searched this topic but didn't find an answer. For example: In my blog overview there is <ul class="MarkupPagerNav"> <li class="MarkupPagerNavOn MarkupPagerNavFirst MarkupPagerNavFirstNum"><a href="/blog/"><span>1</span></a></li> <li class="MarkupPagerNavLastNum"><a href="/blog/page2"><span>2</span></a></li> <li class="MarkupPagerNavNext MarkupPagerNavLast"><a href="/blog/page2"><span>Vorwärts</span></a></li> </ul> how can i give "MarkupPagerNav" a second class like "pagination". I'm working with Zurb's Foundation Framework. Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 8, 2016 Share Posted February 8, 2016 Not sure if you're creating the pager by yourself, but here's how to edit the classes for pw in general: https://processwire.com/api/modules/markup-pager-nav/ 1 Link to comment Share on other sites More sharing options...
kongondo Posted February 8, 2016 Author Share Posted February 8, 2016 @congomonster, I suppose you are using the pagination that comes with renderPosts(), which is actually coming from the module @LostKobrakai has mentioned. I've added an option in renderPosts() that will accept an array of options to pass on to MarkupPagerNav. Will post an update within the hour Link to comment Share on other sites More sharing options...
kongondo Posted February 8, 2016 Author Share Posted February 8, 2016 Update: Version 2.3.7 Following this question, it is now possible to pass MarkupPagerNav options to renderPosts() if you wish to customise your posts' pagination. All the MarkupPagerNav options listed here can be passed as an array within an array to renderPosts() as shown in the example below: $blog = $modules->get("MarkupBlog"); $paginationOptions = array( 'nextItemLabel' => "Forth", 'previousItemLabel' => "Back", 'listMarkup' => "<ul class='MarkupPagerNav Zurb pagination'>{out}</ul>", 'itemMarkup' => "<li class='{class} not necessary class'>{out}</li>", 'numPageLinks' => 5 ); $options = array( 'post_pagination' => $paginationOptions,// array of markup pager nav options 'post_count_text' =>'Article',// other posts options passed as normal ); echo $blog->renderPosts("limit=5", true, $options); 3 Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 8, 2016 Share Posted February 8, 2016 Hi kongondo, that's amazing! Thank you for your help. I tried it and it worked when i copy your code. But i already hav an array for the defaults options. To translate "more" to "mehr" for example. $content .= $blog->renderPosts("limit=5", true, $defaultOptions); How can i put the second array behind the $defaultOptions array? I tried google. Is array_merge an option? Link to comment Share on other sites More sharing options...
kongondo Posted February 8, 2016 Author Share Posted February 8, 2016 (edited) Just like I've shown you in the example above . No need to do merges and such. See below (including the comments in the code); hope this is now clearer. $paginationOptions = array( 'nextItemLabel' => "Forth", 'previousItemLabel' => "Back", 'listMarkup' => "<ul class='MarkupPagerNav Zurb pagination'>{out}</ul>", 'itemMarkup' => "<li class='{class} not necessary class'>{out}</li>", 'numPageLinks' => 5 ); $defaultOptions = array( // array of MarkupPagerNav options // you have to use the index 'post_pagination' and its value MUST be an array // here, we've passed it the array $paginationOptions that we created above 'post_pagination' => $paginationOptions,// the value here must be an array; the index must be named 'post_pagination' // other stuff you already had in your defaultOptions 'post_more_text' => 'mehr', 'post_whatever_option_1' => 'blah blah blah', 'post_whatever_option_2' => 'foo bar', ); $content .= $blog->renderPosts("limit=5", true, $defaultOptions); Edited February 8, 2016 by kongondo 2 Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 8, 2016 Share Posted February 8, 2016 It's working now! THANK YOU very much!!! This blog module is really awesome!!! Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 10, 2016 Share Posted February 10, 2016 Hi, i have still some things that i needed to change. Maybe someone knows the answers. 1. After i installed the modul upgrade Processwire says that i have more then one of this modules installed and that i have to choose. Is this normal? 2. It is possible to add a new entry to the shortcut menu (backend) in Processwire? Blog Category and Blog Tag are already there. How can i add for example Blog Post? 3. In the Comments section the date is still in english. I changed the date value in blog_date field into german am %A, den %d.%m.%Y I tried the same in the field blog_comments. But this doesn't work. Link to comment Share on other sites More sharing options...
kongondo Posted February 10, 2016 Author Share Posted February 10, 2016 (edited) #1: Not normal. PW version? If you ugraded using PW, it should have renamed the older folder as .ProcessBlog or similar #3: A PW date field has two parts. The output and input formats. Have a look at both (input is in the input tab). In the Details tab (Date/Time Output Format Code), you can use your strftime code: am %A, den %d.%m.%Y. You will see that date in the frontend (in your post) In the Input tab (Date/Time Input Formats -> Date Input Format Code) I think you can only use PHP date. So, something like l, d.m.Y in the date input format code will give you Thursday, 11.08.2016. You will see that when editing your post in the backend. You will not be able to uses 'den' with PHP date Edited February 10, 2016 by kongondo Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 10, 2016 Share Posted February 10, 2016 The Processwire Version is 2.7.0. I have a folder MarkupBlog and a folder called ProcessBlog. There is no folder .Processblog. I have show hidden files on. I already changed the entries in the input tab. The format is changeing. But the month stays in english. Link to comment Share on other sites More sharing options...
kongondo Posted February 10, 2016 Author Share Posted February 10, 2016 This is what the PHP manual says: To format dates in other languages, you should use the setlocale() and strftime() functions instead of date(). Link to comment Share on other sites More sharing options...
Marcel Epp Posted February 10, 2016 Share Posted February 10, 2016 In the field blog_comments is a section where i can put my date. It says that this is the output for my comments. I can use date or srftime. I thought strftime makes a language change. But everything i put in will not be regognized. Link to comment Share on other sites More sharing options...
kongondo Posted February 10, 2016 Author Share Posted February 10, 2016 (edited) @congomonster, thanks for catching that. Fixed; in dev branch for now. @all Please note that if you want the method MarkupBlog::formatDate() to output your comments date according to the date field in blog_comments, you just need to pass it a second parameter 2 (integer 2). For instance, in the template file 'blog-recent-comments.php', line #30, we had this: $date = $blog->formatDate($comment->created); ...but we now have this: $date = $blog->formatDate($comment->created, 2); Since the second parameter is give a value of 1 by default, this change should be backward compatible. Unless you want the updated feature, you don't need to do anything in your template files. Edited February 11, 2016 by kongondo 2 Link to comment Share on other sites More sharing options...
kixe Posted February 12, 2016 Share Posted February 12, 2016 Hi kongondo, I tried out your huge module and I think would like it, but it doesn't work properly (using PW 3.0.7). I will give you a small bug list. clicking on Posts results in Error: Call to a member function count() on null (line 1355 of .../site/modules/ProcessBlog/ProcessBlog.module. Problem: field blog_files isn't assigned to the blog-post template by default which is the reason for the error above. After removing line 1355 the modal for posts doesn't appear after clicking, linked page opened instead The dropdown function of the tabs in Admin are disabled if blog tab is active cannot open Settings -> Settings -> Edit cannot open Tags -> New -> Tags Add cannot open Categories -> New Categories -> Add cannot open Posts -> Quick Post -> Add cannot open Edit Posts -> Actions Dead link (404) in Module description on processwire.com http://kongondo.com/tutorials/specific-features/creating-a-blog-in-processwire/ (just realized in the topic of this thread a temporarily link to the tutorial) A personal wish: Dashboard -> Archives -> month clickable with link to a list of selected items Link to comment Share on other sites More sharing options...
alan Posted February 12, 2016 Share Posted February 12, 2016 Hi @kixe I know @kongondo or others will probably be better able to help you but I just wanted to say that the good news is that: I think would like it, but it doesn't work properly is incorrect as far as my experience goes—I just installed it on a fresh PW v2.7.3 and it worked perfectly, no errors. To begin to help, perhaps, check you have debug turned on in config.php `$config->debug = true;`, then there is this post. Sorry if you have already done this and good luck; it's worth it, the @kongondo's Module(s) for the blog make a very professional, complete solution. I was greatly impressed when I tried it. 1 Link to comment Share on other sites More sharing options...
kongondo Posted February 12, 2016 Author Share Posted February 12, 2016 (edited) @kixe, Thanks for pointing these out in advance. I am not being naughty but as you can tell from here, Blog is only compatible with ProcessWire 2.4 - 2.7 . I have been so busy I haven't even had a chance to install, let alone play with ProcessWire 3.X. So for now, I am not able to support Blog for that version of ProcessWire, but I do appreciate people catching such bugs in advance (although, PW 3.X is still an evolving beast) Edited February 12, 2016 by kongondo Link to comment Share on other sites More sharing options...
kixe Posted February 12, 2016 Share Posted February 12, 2016 Thanks for the quick answer. I am pretty sure your module works proper in 2.7. I am involved in 2 projects both based on 3.0 probably going online in summer. I updated already most of my stuff for 3.0. Ryan is working very very quick and I am pretty sure we will have a stable Version of 3.0 very soon. 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