rickm Posted June 30, 2014 Share Posted June 30, 2014 Thanks for the info kongondo For anyone wanting a 'quick hack for now' for setting the published date, run through the MarkupBlog.module file, and the template files and find: find("template=blog-post and immediately after add this: , blog_date<=".date('Y-m-d G:i:s')." This will basically add a condition to the post (aka page) lookup, to make sure the date field is set to now, or lower. I've run some tests on my local copy and it's working as expected. Link to comment Share on other sites More sharing options...
kongondo Posted June 30, 2014 Author Share Posted June 30, 2014 Scheduled publishing is an integral part of the workflow for many bloggers, so this would definitely make sense. I couldn't live without such a feature anymore.. @kongondo: if you're still pondering whether to use SchedulePages somehow or cook up your own method, I'd vote for SchedulePages. Admittedly I'm being somewhat selfish here (I'm sure we'll be using this module for our client sites and I don't like the idea of having to explain why and how scheduling posts is different from all other pages) but it's also a great module I haven't made a decision on this yet. On the one hand I don't want to reinvent the wheel; why not just use SchedulePages. On the other, I am a bit wary of tying an important functionality of Blog to a third party module that is not part of the core. In case things were to break in the future and they were not fixed (no offence meant to Jasper), that would leave Blog users hanging.....Maybe I am being over cautious. I'll make a decision soon... Sorry for spamming (sort of), but just wanted to comment on this one that most (quite possibly all) of the sites we've implemented a blog for have more than one blog. Doesn't sound that far fetched to me: one or more for internal use, one for each division (a lot of our blogging clients are municipalities and they've got a ton of these), one for CEO/mayor, one for each temporary project etc. Also, if you were referring to creating a bunch of user-specific blogs: I've explained this sort of behaviour (in another system) to clients over and over and over and can assure you that, though it may sound like the logical solution, in real world it just doesn't work.. unless you also allow some sort of "blog superusers" to post with any user account, which could introduce an entire set of new problems One typical situation is a CEO or mayor having his/her own blog. Most people of that caliber simply don't have much spare time and blogging is rarely considered a core task, so even if this person does really write his/her own posts, there's a very high probability that someone else handles posting them online.. which is where the trouble starts if each blog is tied to one user. I'm sure you get the point. Anyway, I'd appreciate if you could consider this kind of feature, but I get that it's probably not too high in priority Admittedly I currently have no idea how I could implement such a feature and to be honest, I haven't thought much about it. Where would the posts, tags and categories live on the tree for the different blogs? It could get messy very quickly. Anyway, any and all ideas are welcome, thanks! Link to comment Share on other sites More sharing options...
kongondo Posted June 30, 2014 Author Share Posted June 30, 2014 For the curios, auto-publish date will either have to be set via API using a small auto-load module triggered via cron or via the module SchedulePages. As stated above, I am yet to decide which route to take... Link to comment Share on other sites More sharing options...
teppo Posted June 30, 2014 Share Posted June 30, 2014 On the one hand I don't want to reinvent the wheel; why not just use SchedulePages. On the other, I am a bit wary of tying an important functionality of Blog to a third party module that is not part of the core. In case things were to break in the future and they were not fixed (no offence meant to Jasper), that would leave Blog users hanging.....Maybe I am being over cautious. Nothing wrong with being careful, but luckily we're talking about free software here. If it's any more reassurance, we've got a lot of sites relying on this module already, so trust me: in the (unlikely) scenario that something was to happen and the module wasn't kept up to date, I for one would be more than happy (and forced, actually..) to catch the ball 3 Link to comment Share on other sites More sharing options...
apeisa Posted June 30, 2014 Share Posted June 30, 2014 We (Avoine) have the (hairy) balls also in ScheludedPages basket. 2 Link to comment Share on other sites More sharing options...
kongondo Posted August 9, 2014 Author Share Posted August 9, 2014 This post is in response to this question posted on GitHub Comment Layout I'm using Foundation instead of Skeleton and need to tweak some of the layout. Can you identify which file I would need to tweak to change the comments layout? I can do so much via CSS but not the bigger shifting around of content First, I'd like to reiterate that this Blog Module does not use any CSS framework. The Blog (site) Profile (on which Blog Module is based) uses the Skeleton CSS framework. However, in this Module's demo/example output/template files, I have used PocketGrid CSS. It is not a requirement. You can use whichever CSS framework (or not) you wish. The following example is for this module (but is equally applicable to the Blog Profile). It is very easy to style Blog's comments by targeting the output HTML IDs and Classes in your CSS. In my example template files, my custom styles are in blog.css. The example code below is an HTML output of Comments where 'comments are allowed'. <div id="comments"> <span class="num-comments-icon">2</span> <h4>Comments</h4> <ul class="comments CommentList"> <li class="comment CommentListItem" id="comment1"> <p class="comment-head CommentHeader">Comment by kongondo on 13 April 2014 11:16 pm</p> <div class="comment-body CommentText"><p>Simply the best CMS.</p></div> </li> <li class="comment CommentListItem" id="comment10"> <p class="comment-head CommentHeader">Comment by kongondo on 23 May 2014 2:42 pm</p> <div class="comment-body CommentText"><p>ProcessWire rocks, yeah!</p></div> </li> </ul> <!--CommentForm--> <div id="CommentForm" class="CommentForm_new"> <h4>Post a comment</h4> <form id="CommentForm_form" action="./#CommentForm" method="post"> <p class="CommentForm_cite"> <label for="CommentForm_cite">Your Name</label> <input type="text" name="cite" class="required" required="required" id="CommentForm_cite" value="" maxlength="128"> </p> <p class="CommentForm_email"> <label for="CommentForm_email">Your E-Mail</label> <input type="text" name="email" class="required email" required="required" id="CommentForm_email" value="" maxlength="255"> </p> <p class="CommentForm_text"> <label for="CommentForm_text">Comments</label> <textarea name="text" class="required" required="required" id="CommentForm_text" rows="5" cols="50"></textarea> </p> <p class="CommentForm_submit"> <button type="submit" name="CommentForm_submit" id="CommentForm_submit" value="1">Submit</button> <input type="hidden" name="page_id" value="2488"> </p> </form> </div><!--/CommentForm--> </div> So, you do not need to tweak any file. All you need is to style the output. For the PHP stuff, I am in the process of writing some documentation... Hope this answers your query. Thank you for using Blog 4 Link to comment Share on other sites More sharing options...
Peter Knight Posted August 10, 2014 Share Posted August 10, 2014 Cheers for the reply and apologies re the framework mixup. I guess I'm approaching this with a few expectations picked up from my other blogging platform. Within that, almost every part of the blog was a mini template which you could tweak to make fundamental layout changes. Link to comment Share on other sites More sharing options...
kongondo Posted August 10, 2014 Author Share Posted August 10, 2014 Sparrow, no need to apologise for anything . Your question will help the next guy. Once I write the API documentation, you'll realise that you can also tweak this Blog to make fundamental layout changes. You can output bits and pieces (tags, posts, categories, authors, comments, etc) anywhere using its API since it is a PW module. All these bits and pieces are independent of each other. This is similar to PW pages in the sense that you can output page fields anywhere in any order in your site or even not output any of the fields. 2 Link to comment Share on other sites More sharing options...
OrganizedFellow Posted August 10, 2014 Share Posted August 10, 2014 ABSO-FREAKING-LUTELY BEAUTIFUL!!!!!!! Seeing all those screenshots gets me all excited amigo Thank you for a job well done. This comes in perfect timing for a new project that I started yesterday. GEEZZZ, p-e-r-f-e-c-t. 1 Link to comment Share on other sites More sharing options...
kongondo Posted August 10, 2014 Author Share Posted August 10, 2014 @OrganizedFellow Thanks. Glad you like the module. You've been away a while... 1 Link to comment Share on other sites More sharing options...
OrganizedFellow Posted August 10, 2014 Share Posted August 10, 2014 @OrganizedFellow Thanks. Glad you like the module. You've been away a while... Work. Lots of it. Two new PW sites. Hopefully worthy of sharing for the Showcase 1 Link to comment Share on other sites More sharing options...
kongondo Posted August 13, 2014 Author Share Posted August 13, 2014 Update: Minor version bump to 1.2.1 after some minor styling issues updates. Documentation: I am taking a short break from writing code to write some badly needed documentation for Blog (and some other PW tutorials if I get time ). I am writing this documentation as tutorials which I will post on my website soon. I'll keep you updated. I haven't forgotten any Blog features pending requests 4 Link to comment Share on other sites More sharing options...
webweaver Posted August 15, 2014 Share Posted August 15, 2014 Thank you Kongondo and Ryan for these excellent modules! I've implemented this into a site I'm developing and am having an issue... The blog posts are not truncating. I have the summary length set to 150 , but nothing is being truncated. I know when i created a post I'm populating the "blog_body" field and these settings seem to be for the "blog_summary" field (which does is not one of the fields for the template).. From what I can see in the MarkupBlog.module, there is a conditional if summary is empty to pull from the blog_body and truncate. The blog I'm working on is here: http://shootkta.info/blog/ .. If you have any thoughts, please let me know. 1 Link to comment Share on other sites More sharing options...
kongondo Posted August 15, 2014 Author Share Posted August 15, 2014 Hi Webweaver, Glad you like the module. It is truncating fine for me here. The code is pulling text to truncate from blog_body. I decided to skip over using a blog_summary since truncation can be done from blog_body. I am guessing it is not truncating because you have not set the second parameter/argument of renderPosts() to true. The default is false (i.e. do not truncate). Apologies for this; I have delayed with documentation but I am currently writing this. Here's example code to make it truncate. $blog = $modules->get("MarkupBlog"); $limit = 10; //limit will be passed to the selector fetching blog posts; //'true' will truncate posts to what we have set in blog_quantity but default to 450 if this is not set $content = $blog->renderPosts("limit={$limit}", true); echo $content; 1 Link to comment Share on other sites More sharing options...
pwired Posted August 15, 2014 Share Posted August 15, 2014 Kongondo, is your blog module out of beta and can be used already safe ? I read a lot of good things about your blog modules and are going to install them this week-end. 1 Link to comment Share on other sites More sharing options...
kongondo Posted August 15, 2014 Author Share Posted August 15, 2014 Still in Beta but safe to use but I need to add some features before going stable (e.g. scheduled publishing, etc) . Other than that, it works fine... 2 Link to comment Share on other sites More sharing options...
webweaver Posted August 15, 2014 Share Posted August 15, 2014 @Kongondo - Thank you very much for the explanation to fix. Next time I'll know not to pull my hair out for 2 hours and just ask the question and wait for the reply Btw, the generated summary strips out all tags so the posts in the blog list looked pretty bad.. So I removed the strip tags.. But then had another problem - if the cutoff was in the middle of an anchor tag, the "view more" anchor tag would become nested and didn't work.. So I put back in the strip tags but allowed <p> and <img> tags.. The summaries in the blog list look much nicer now. ex: Line 543 in MarkupBlog.module now reads: $summary = strip_tags(substr($page->blog_body, 0, $summaryLimit), '<p><img>'); Link to comment Share on other sites More sharing options...
kongondo Posted August 15, 2014 Author Share Posted August 15, 2014 (edited) As for <p></p>, those are added back later. See line 602 of the code if($small) { $out .= "<p>" . $page->summary . "… <a class='more' href='{$page->url}'>" . __('View More') . "</a></p>"; } Hadn't considered images in the summary.... ..Maybe I'll need to add at blog_summary [non-rich text area] to the blog template. Edit Or, for now, maybe not. I don't want to add too many fields...I'll have a think Edit 2: We now have this feature inbuilt in renderPosts(). You can specify tags that should not be stripped as indicated in this post: https://processwire.com/talk/topic/7403-module-blog/?p=78227 (see post_small_allowable_tags) Edited January 2, 2015 by kongondo Link to comment Share on other sites More sharing options...
webweaver Posted August 15, 2014 Share Posted August 15, 2014 Ya, I hesitated on the img tag Basicly I want them to see a majority of the post in full formatting (as much as possible) while they are on the blog listing page. But line 602 is surrounding the entire post in a paragraph, so there is still no formatting within it. The paragraphs within the post itself were getting stripped. I should mention also that I enabled CKEditor in for the blog_body field and changed the code in ProcessBlog.module for quickpost_body to use CKEditor also (line 387), but the tags were being stripped from the quickpost CKEditor, so had removed the sanitizer from quickpost (line 1441). Link to comment Share on other sites More sharing options...
kongondo Posted August 15, 2014 Author Share Posted August 15, 2014 I get you now. I'll have a think...Thanks for testing.. Link to comment Share on other sites More sharing options...
webweaver Posted August 15, 2014 Share Posted August 15, 2014 Btw, I think I may have found a bug - In the posts dashboard I can't sort by Date properly. 1 Link to comment Share on other sites More sharing options...
webweaver Posted August 15, 2014 Share Posted August 15, 2014 More on Date sorting.. It seems once I open a post, then close, it sorts correctly in descending order. But I can't sort by ascending and when I click on the Date column header it doesn't sort on the fly. All the other columns work fine. 1 Link to comment Share on other sites More sharing options...
pwired Posted August 16, 2014 Share Posted August 16, 2014 Forgot to ask, if I install a fresh processwire 2.4 and the 2 blog modules, how does the blog show up on the front ? I mean a fresh pw 2.4 install has it´s own default front with nav, body and sidebar. How does the blog integrate with this ? Edit1: Got it, installing and just saw the blog template files, css and js. It is really complete ! How can I disable the default front that came during the processwire install and only have the basic blog front ? uploaded all the php blog files to /site/templates/ and in admin tried to change template for home to blog.php but didn´t allow me. Ok dumb me, just had to delete home.php and rename blog.php to home.php Now I can start building up it´s using pocketgrid so that is a real bonus. In the admin I saw a new tab named Blog will all the great config in it. Link to comment Share on other sites More sharing options...
kongondo Posted August 18, 2014 Author Share Posted August 18, 2014 Guys, apologies for not responding earlier. @Webweaver I've had a thought about the 'summary' text and I want to leave it as is for now. My reckoning is that a summary is just that; a blurb of text (usually one paragraph)... Thanks for reporting the issue with sorting the 'date' field. The Posts Table is being generated from ProcessWire (MarkupAdminDataTable). So, this is not an issue with ProcessBlog per se but thanks for catching that. I have actually been considering using other tables (e.g. DataTable) that are capable of dynamic sorting (i.e. sorting from the database). The sorting your see now is static and does not draw from the database. As for quickpost I have been wavering between making it RTE or not. I reckoned that many people would not be using it often for post creation. If there's sufficient demand I might change it back to RTE. @Pwired Glad you find the module useful. As stated in the first post, I intentionally used lots of template files in an attempt to make it easier for folks to see what's going on in the code. It is definitely not the recommended templating approach. In addition, using the Blog API, the user would be able to use the templating approach they wanted (as well as the CSS framework they wanted). However, documentation to assist users with the API is badly needed (and I am working on this at the moment). So in time, you will be able to 'disable the default front' that comes with MarkupBlog. This means basically deleting the template files . Technically, Blog does not need any of those template files. They are just there to showcase its capabilities. OK, back to writing.... Link to comment Share on other sites More sharing options...
teppo Posted August 18, 2014 Share Posted August 18, 2014 @kongondo: sorry if this is unrelated (I don't have a proper test environment at hand right now) but sorting by dates is entirely doable using MarkupAdminDataTable too. It just requires a bit of extra work: prefixing actual, visible value with hidden, sortable value; something like yyyy-mm-dd etc. This is how I solved it in ProcessLoginHistory. Sorting multi-page values is another issue entirely, but as far as sorting visible results is good enough, no need to complicate things with new 3rd party components 2 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