Jump to content

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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! 

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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 ;)

  • Like 3

Share this post


Link to post
Share on other sites

We (Avoine) have the (hairy) balls also in ScheludedPages basket.

  • Like 2

Share this post


Link to post
Share on other sites

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 :-)

  • Like 4

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

  • Like 2

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

@OrganizedFellow

Thanks. Glad you like the module. You've been away a while... ;):)   

  • Like 1

Share this post


Link to post
Share on other sites

@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 :) 

  • Like 1

Share this post


Link to post
Share on other sites

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 :-)

  • Like 4

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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;
  • Like 1

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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...

  • Like 2

Share this post


Link to post
Share on other sites

@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>');

Share this post


Link to post
Share on other sites

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 by kongondo

Share this post


Link to post
Share on other sites

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).

Share this post


Link to post
Share on other sites

Btw, I think I may have found a bug - In the posts dashboard I can't sort by Date properly.

date_sort_bug.jpg

  • Like 1

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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.

kongondo.jpg

Share this post


Link to post
Share on other sites

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.... :-)

Share this post


Link to post
Share on other sites

@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 :)

  • Like 2

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By bernhard
      --- Please use RockFinder3 ---
    • By MoritzLost
      Cacheable Placeholders
      This module allows you to have pieces of dynamic content inside cached output. This aims to solve the common problem of having a mostly cacheable site, but with pieces of dynamic output here and there.  Consider this simple example, where you want to output a custom greeting to the current user:
      <h1>Good morning, <?= ucfirst($user->name) ?></h1> This snippet means you can't use the template cache (at least for logged-in users), because each user has a different name. Even if 99% of your output is static, you can only cache the pieces that you know won't include this personal greeting. A more common example would be CSRF tokens for HTML forms - those need to be unique by definition, so you can't cache the form wholesale.
      This module solves this problem by introducing cacheable placeholders - small placeholder tokens that get replaced during every request. The replacement is done inside a Page::render hook so it runs during every request, even if the response is served from the template cache. So you can use something like this:
      <h1>Good morning, {{{greeting}}}</h1> Replacement tokens are defined with a callback function that produces the appropriate output and added to the module through a simple hook:
      // site/ready.php wire()->addHookAfter('CachePlaceholders::getTokens', function (HookEvent $e) { $tokens = $e->return; $tokens['greeting'] = [ 'callback' => function (array $tokenData) { return ucfirst(wire('user')->name); } ]; $e->return = $tokens; }); Tokens can also include parameters that are parsed and passed to the callback function. There are more fully annotated examples and step-by-step instructions in the README on Github!
      Features
      A simple and fast token parser that calls the appropriate callback and runs automatically. Tokens may include multiple named or positional parameters, as well as multi-value parameters. A manual mode that allows you to replace tokens in custom pieces of cached content (useful if you're using the $cache API). Some built-in tokens for common use-cases: CSRF-Tokens, replacing values from superglobals and producing random hexadecimal strings. The token format is completely customizable, all delimiters can be changed to avoid collisions with existing tag parsers or template languages. Links
      Github Repository & documentation Module directory (pending approval) If you are interested in learning more, the README is very extensive, with more usage examples, code samples and usage instructions!
    • By Craig
      I've been using Fathom Analytics for a while now and on a growing number of sites, so thought it was about time there was a PW module for it.
      WayFathomAnalytics
      WayFathomAnalytics is a group of modules which will allow you to view your Fathom Analytics dashboard in the PW admin panel and (optionally) automatically add and configure the tracking code on front-end pages.
      Links
      GitHub Readme & documentation Download Zip Modules directory Module settings screenshot What is Fathom Analytics?
      Fathom Analytics is a simple, privacy-focused website analytics tool for bloggers and businesses.

      Stop scrolling through pages of reports and collecting gobs of personal data about your visitors, both of which you probably don't need. Fathom is a simple and private website analytics platform that lets you focus on what's important: your business.
      Privacy focused Fast-loading dashboards, all data is on a single screen Easy to get what you need, no training required Unlimited email reports Private or public dashboard sharing Cookie notices not required (it doesn't use cookies or collect personal data) Displays: top content, top referrers, top goals and more
    • By daniels
      This is a lightweight alternative to other newsletter & newsletter-subscription modules.
      You can find the Module in the Modules directory and on Github
      It can subscribe, update, unsubscribe & delete a user in a list in Mailchimp with MailChimp API 3.0. It does not provide any forms or validation, so you can feel free to use your own. To protect your users, it does not save any user data in logs or sends them to an admin.
      This module fits your needs if you...
      ...use Mailchimp as your newsletter / email-automation tool ...want to let users subscribe to your newsletter on your website ...want to use your own form, validation and messages (with or without the wire forms) ...don't want any personal user data saved in any way in your ProcessWire environment (cf. EU data regulation terms) ...like to subscribe, update, unsubscribe or delete users to/from different lists ...like the Mailchimp UI for creating / sending / reviewing email campaigns *I have only tested it with PHP 7.x so far, so use on owners risk
      EDIT:
      Since 0.0.4, instructions and changelog can be found in the README only. You can find it here  🙂
      If you have questions or like to contribute, just post a reply or create an issue or pr on github, thanks!
    • By MoritzLost
      Sorry for the convoluted title. I have a problem with Process modules that define a custom page using the page key through getModuleInfo (as demonstrated in this excellent tutorial by @bernhard). Those pages are created automatically when the module is installed. The problem is that the title of the page only gets set in the current language. That's not a problem if the current language (language of the superuser who is installing the module) is the default language; if it isn't, the Process page is missing a title in the default language. This has the very awkward effect that a user using the backend in the default language (or any other language) will see an empty entry in the setup menu:

      This screenshot comes from my Cache Control module which includes a Process page. Now I realize the description sounds obscure, but for us it's a common setup: We a multiple bilingual sites where the default language is German and the second language is English. While the clients use the CMS in German, as a developer I prefer the English interface, so whenever I install a Process module I get this problem.
      As a module author, is there a way to handle this situation? I guess it would be possible to use post-installation hooks or create the pages manually, but I very much prefer the declarative approach. The page title is already translatable (through the __ function), but of course at the time of installation there is no translation, and as far as I'm aware it's not possible to ship translations with a module so they are used automatically. Could this situation be handled better in the core? I would prefer if the module installation process would always set the title of the Process page in the default language, instead of the language of the current user.
×
×
  • Create New...