kongondo

Module: Blog

Recommended Posts

1 hour ago, tooth-paste said:

1. Image summary page
My blog index page works but I would like to have the image on the right side. Can I do this with CSS (img.post-featured-image{float:right})?

Yes, that's CSS issue. Try and see if it works ^_^.

1 hour ago, tooth-paste said:

2. blog-post.php 

How can I output the post that is linked to. I mean the page with the full blog-item? I use this code but it does not work.

Are you using the demo template files that come with blog or did you create/or are using a blank blog-post.php? If the latter, then please have a look at the example demo file. It is a bit redundant to have the code you pasted (which is an example code I gave for some other context) within a blog-post page itself (i.e. redundant to use it in blog-post.php which is the template file for a single blog post).

  • Like 1

Share this post


Link to post
Share on other sites

Yes, I meant AND. Rewriting URL as you suggest is way beyond my capability. I guess I'd have to live with it. In any case it's no biggie.

About the categories, sorry about the confusion.  What I meant was the categories that are displayed at the end of each post. Ideally when you click on it it should take you to the pages with the "news" and "blog" template respectively rather than the page with "category" template.  I hope I'm makes sense.

Thanks for your help.

Share this post


Link to post
Share on other sites

Hi. I cannot edit the blog using the dashboard panel, every time I try to save a blog-post (or add a category or edit the blog setting etc) the page re-loads and nothing is saved. This is very strange because it used to work fine. I've tried with both 'blog-author' & 'superuser' roles, checked the logs in PW, check the developer tools on browser, tried with different browsers... I don't see any error message anywhere, I wish I could post more information. On my local machine the blog is still working, on the live server (same files) I have problems. Anyone had this problem before?

PW 2.8.35 - Blog 2.4.0

Share this post


Link to post
Share on other sites
On 17/02/2017 at 4:51 PM, MaryMatlow said:

What I meant was the categories that are displayed at the end of each post. Ideally when you click on it it should take you to the pages with the "news" and "blog" template respectively rather than the page with "category" template.  I hope I'm makes sense.

That's the expected behaviour. When you click on a category, you are taken to its page and are shown a list of all the posts that use that category, i.e. /category/my-category/. I can't remember how you set up, but if your "news" is a category, clicking on a post categorised under "news" should take you to /category/news/ with a list of all posts classified as news items. 

7 hours ago, palacios000 said:

This is very strange because it used to w

Seems something changed in your system? Some autoload module that is affecting save? I have tested and it works fine here. Does the same thing happen if you edit the post page normally? (i.e. not in the Dashboard modal).

Share this post


Link to post
Share on other sites

As you suggested I use our demo templates and alter them to my own needs. It works great. Thank you. Can you help me out with the topNav.

On the blog page with all post there is a topNav with selectable Categories. When you click on a single post, the topNav is replaced with a subNav 'See also' and 'Related categories'. Can I remove the subNav and replace it with the topNav? So I would like to always select Categories in stead of 'Related post'. 

In the template file 'blog-post' I removed the subnav. Is it possible to add the topNav(categories) on a single post?

Share this post


Link to post
Share on other sites

The method rendering those side menus is renderNav(). It takes as a second parameter an array or PageArray. In blog.post (the template file for a single post, which you wish to edit), around lines 20 - 22, you can see it takes the PageArray made up of the current post's categories (blog_categories) as follows:

if(count($page->blog_categories)) $subNav .= $blog->renderNav(__('Related Categories'), $page->blog_categories);

In the main blog page, i.e. the one that uses the template blog.php, around lines 14 - 15, we see the same function taking a different PageArray; one that is made up of ALL the categories as follows:

$categories = $pages->get('template=blog-categories');// this grabs the parent of all category pages
$subNav = $blog->renderNav($categories->title, $categories->children);// we pass its children, a PageArray made up of all categories

So, the latter code (the lines 14 - 15 in blog.php) is what you need to copy to your blog-post.php to achieve your desired result. Please note that in that demo code, there is no limit set to the number of categories that are returned. If you have lot's of categories you will want to place a limit on the children, e.g. $categories->children('limit=50');

Share this post


Link to post
Share on other sites

Preview of new Blog Dashboard UI coming in the next update...

Posts List

new-blog-ui-posts.thumb.png.becafecec27d3f5616477764c032b2ef.png

Quick Post (now in modal)

new-blog-ui-quick-post-with-rte.thumb.png.79f256ed52c307e3fb2fc328e78a1c1c.png

Thoughts? Opposition :)?

Edited by kongondo
  • Like 2

Share this post


Link to post
Share on other sites
On 18/02/2017 at 7:29 PM, kongondo said:

Seems something changed in your system? Some autoload module that is affecting save? I have tested and it works fine here. Does the same thing happen if you edit the post page normally? (i.e. not in the Dashboard modal).

Thanks for the quick reply! Update:

  • I can edit or add pages normally, I have role 'superuser'
  • From the dashboard I can only edit posts, I cannot add new ones.
  • I have re-installed the blog module, with same results
  • I have checked the user permissions, both on the role 'blog-author' & from the blog- templates
  • I've cleared PW cache in /assets/cache
  • probably on the live server, I was never able to add new posts from the dashborad

What else can I check? Thanks a lot for any hint

Share this post


Link to post
Share on other sites

Hello to all,

i'm new to processwire and started with an test installation (3.0.42) with multilanguage support and the blog modul. I have write a test post and if I call it at the frontend I get the following error message:

Recoverable Fatal Error: Argument 1 passed to MarkupBlog::renderComments() must be an instance of CommentArray, instance of ProcessWire\CommentArray given, called in C:\xampp\htdocs\pwire2\site\assets\cache\FileCompiler\site\templates\blog-post.php on line 54 and defined (line 1059 of C:\xampp\htdocs\pwire2\site\assets\cache\FileCompiler\site\modules\ProcessBlog\MarkupBlog.module) 

I've searched the forum but nothing found. Would it be better to use PW 2.8.35 for a new project?

Thanks for your help!

Alex

Share this post


Link to post
Share on other sites
On 20/02/2017 at 9:11 AM, palacios000 said:

What else can I check? Thanks a lot for any hint

Difficult to tell at this point. Could you confirm that the post (meaning the textarea, etc, inputs) are actually sent? JS errors? If it works on your local server but not the live one...that tells us there is some configuration in the live server affecting things. Other than these, I could have look if you are able to grant me temporary access.

On 20/02/2017 at 5:34 PM, al-ex23 said:

i'm new to processwire and started with an test installation (3.0.42) with multilanguage support and the blog modul. I have write a test post and if I call it at the frontend I get the following error message:

Welcome to the forums and ProcessWire @al-ex23. I am not sure whether that's a file-compiler related problem. Does refreshing several times help? 

Share this post


Link to post
Share on other sites

Happy to announce Blog 2.4.1 is now available for testing on the dev branch. Please test and let me know that it works OK, all the way from install to uninstall and everything in between, thanks.

This version is highly refactored, brings in a new cleaner UI (at least I think so), including better sorting of posts/categories/tags, author bios, category description (not sure many know that categories have a field for entering descriptions), etc and one new (frontend) option that enables the control of the 'edit' link that appears for logged in users when viewing a Blog Post. The link can now be placed at the top, bottom or switched off altogether (@thanks to antoiba86 idea).

Here are a couple of screens. I have tested in 2.7.2, 2.8.35 and 3.0.42 and everything seems to work fine. However, further tests are needed before I commit this to master. That's where you come in, thanks.

 

Blog 2.4.1 - 001.png

Blog 2.4.1 - 002.png

Blog 2.4.1 - 003.png

Blog 2.4.1 - 004.png

Blog 2.4.1 - 005.png

Blog 2.4.1 - 006.png

Blog 2.4.1 - 007.png

Blog 2.4.1 - 008.png

Blog 2.4.1 - 009.png

Blog 2.4.1 - 010.png

Blog 2.4.1 - 011.png

Blog 2.4.1 - 012.png

Edited by kongondo
  • Like 7

Share this post


Link to post
Share on other sites

@kongondo Seriously this is an awesome job, I use the blog alot and this looks really clean and 'lit'. Can't wait for the new UiKit however would there be a guide to other devs so their Modules looks clean with the new UI 

  • Like 2

Share this post


Link to post
Share on other sites

Hi @kongondo, I had to reinstall the Blog module as it was giving a problem (it was completely disabled, couldn't perform any action: post, delete etc.). Anyway ,I reinstalled and everything works fine but for the comments. It is giving me this error:

 

Recoverable Fatal Error: Argument 1 passed to MarkupBlog::renderComments() must be an 
instance of CommentArray, instance of ProcessWire\CommentArray given, called 
in /xxx/html/site/templates/blog-post.php on line 53 and 
defined (line 1059 of /xxx/html/site/modules/ProcessBlog/MarkupBlog.module) 

This is the code I'm using on blog_post.php:

 

	$blog = $modules->get("MarkupBlog");
    $blogConfigs = $modules->getModuleConfigData('ProcessBlog');
    $renderComments = $blogConfigs['commentsUse'] == 1 ? $blog->renderComments($page->blog_comments) : '';

    $options = array('post_date_text' => on, 'post_categories'=>0, 'post_comments' => 2, 
	'post_large_image' => 1, 'post_author' => 1);
    $content = $blog->renderPosts($page, false, $options) . $blog->postAuthor() .
	$renderComments . $blog->renderNextPrevPosts($page);//with post author widget
    
    //include the main/common markup
    require_once("blog-main.inc");

 

 

I'm using ProscessBlog 2.4 and Processwire 3.0.53

 

What could be the problem here? Thanks for your help.

 

Share this post


Link to post
Share on other sites

Just an update: This was resolved when I recompiled the modules. 

In trying to fix this I had uninstalled ProcessCommentsManager, but now I can't install it back. It doesn't seem to exist. Is there any other way to manage comments?

Share this post


Link to post
Share on other sites

Hi @MaryMatlow

Glad you got it sorted. That's a core module, so check under core/modules/ in the modules page, specifically a process module called 'Comments'.

  • Like 1

Share this post


Link to post
Share on other sites
On 2017-03-02 at 6:21 PM, kongondo said:

Hi @MaryMatlow

Glad you got it sorted. That's a core module, so check under core/modules/ in the modules page, specifically a process module called 'Comments'.

Done. Thank you.

Share this post


Link to post
Share on other sites

I've moved my site to a other server and getting a fatal error! Please help.

Notice: Undefined variable: class in /var/www/vhosts/website/httpdocs/site/assets/cache/FileCompiler/site/modules/Blog/MarkupBlog.module on line 1443

Fatal error: Class 'DOMDocument' not found in /var/www/vhosts/website/httpdocs/site/assets/cache/FileCompiler/site/modules/Blog/MarkupBlog.module on line 885

Error: Class 'DOMDocument' not found (line 885 of /var/www/vhosts/website/httpdocs/site/modules/Blog/MarkupBlog.module) 

 

Share this post


Link to post
Share on other sites
59 minutes ago, tooth-paste said:

I've moved my site to a other server and getting a fatal error!

 

59 minutes ago, tooth-paste said:

Error: Class 'DOMDocument' not found

Seems your new server does not have the PHP extension DOMDocument installed. Ask your host to install it for you.

  • Like 1

Share this post


Link to post
Share on other sites

Hello Community,

With the module ProcessBlog I have only problems and can not install it right now. Please check this under https://processwire.wpzweinull.ch/blog-9/. There is something missing CSS or the template is not properly installed.

What can it be what has led to this problem? I installed the modules ProcessBlog scratch. Downloaded from the database of the modules, installed, selected the style and then installed the blog with categories and settings.

But something is still quite wrong.

I would be grateful for any tip very.

Thanks in advance.

Share this post


Link to post
Share on other sites
You must assign a template to the page before setting custom field values (title__data) [pageClass=Page, template=]

This error is displayed after installing the blog component. So something really does not happen.

Share this post


Link to post
Share on other sites

@Alex L,

Welcome to the forums.

Please note that for modules that have their own support forums, we do not start other threads but rather post in those support threads. OK, to your question. 

If you want to use Blog's demo template files and styles, it is easiest if you install ProcessWire with a 'blank profile'. What is happening is that the profile you are using (I think it's called 'site-default') is conflicting with Blog's template files. I am in a bit of a rush so cannot explain further.

Share this post


Link to post
Share on other sites

Hello @kongondo

Oh, excuse me. I did not know it. I have now installed a blank page profile and the blog as well. At https://processwire.wpzweinull.ch/blog/ it is now. Unfortunately, there is always the error message "class comment not found". So I will then install Disqus comments.

Maybe you can see it at times, what is with this error. I had the last days from the beginning. Otherwise, the blog is installed correctly.

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 horst
      Wire Mail SMTP

      An extension to the new WireMail base class that uses SMTP-transport

      This module integrates EmailMessage, SMTP and SASL php-libraries from Manuel Lemos into ProcessWire. I use this continously evolved libraries for about 10 years now and there was never a reason or occasion not to do so. I use it nearly every day in my office for automated composing and sending personalized messages with attachments, requests for Disposition Notifications, etc. Also I have used it for sending personalized Bulkmails many times.

      The WireMailSmtp module extends the new email-related WireMail base class introduced in ProcessWire 2.4.1 (while this writing, the dev-branch only).
       
      Here are Ryans announcement.



      Current Version 0.3.0
      get it from the Modules Directory Install and Configure

      Download the module into your site/modules/ directory and install it.

      In the config page you fill in settings for the SMTP server and optionaly the (default) sender, like email address, name and signature.
      You can test the smtp settings directly there. If it says "SUCCESS! SMTP settings appear to work correctly." you are ready to start using it in templates, modules or bootstrap scripts.


      Usage Examples
      The simplest way to use it:
      $numSent = wireMail($to, $from, $subject, $textBody); $numSent = wireMail($to, '', $subject, $textBody); // or with a default sender emailaddress on config page This will send a plain text message to each recipient.
       
      You may also use the object oriented style:
      $mail = wireMail(); // calling an empty wireMail() returns a wireMail object $mail->to($toEmail, $toName); $mail->from = $yourEmailaddress; // if you don't have set a default sender in config // or if you want to override that $mail->subject($subject); $mail->body($textBody); $numSent = $mail->send(); Or chained, like everywhere in ProcessWire:
      $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Additionaly to the basics there are more options available with WireMailSmtp. The main difference compared to the WireMail BaseClass is the sendSingle option. With it you can set only one To-Recipient but additional CC-Recipients.
      $mail = wireMail(); $mail->sendSingle(true)->to($toEmail, $toName)->cc(array('person1@example.com', 'person2@example.com', 'person3@example.com')); $numSent = $mail->subject($subject)->body($textBody)->send(); The same as function call with options array:
      $options = array( 'sendSingle' => true, 'cc' => array('person1@example.com', 'person2@example.com', 'person3@example.com') ); $numSent = wireMail($to, '', $subject, $textBody, $options); There are methods to your disposal to check if you have the right WireMail-Class and if the SMTP-settings are working:
      $mail = wireMail(); if($mail->className != 'WireMailSmtp') { // Uups, wrong WireMail-Class: do something to inform the user and quit echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; return; } if(!$mail->testConnection()) { // Connection not working: echo "<p>Couldn't connect to the SMTP server. Please check the {$mail->className} modules config settings!</p>"; return; } Following are a ...


      List of all options and features


      testConnection () - returns true on success, false on failures


      sendSingle ( true | false ) - default is false

      sendBulk ( true | false ) - default is false, Set this to true if you have lots of recipients (50+)


      to ($recipients) - one emailaddress or array with multiple emailaddresses

      cc ($recipients) - only available with mode sendSingle, one emailaddress or array with multiple emailaddresses

      bcc ($recipients) - one emailaddress or array with multiple emailaddresses

       
      from = 'person@example.com' - emailaddress, can be set in module config (called Sender Emailaddress) but it can be overwritten here

      fromName = 'Name Surname' - optional, can be set in module config (called Sender Name) but it can be overwritten here


      priority (3) - 1 = Highest | 2 = High | 3 = Normal | 4 = Low | 5 = Lowest

      dispositionNotification () or notification () - request a Disposition Notification


      subject ($subject) - subject of the message

      body ($textBody) - use this one alone to create and send plainText emailmessages

      bodyHTML ($htmlBody) - use this to create a Multipart Alternative Emailmessage (containing a HTML-Part and a Plaintext-Part as fallback)

      addSignature ( true | false ) - the default-behave is selectable in config screen, this can be overridden here
      (only available if a signature is defined in the config screen)

      attachment ($filename, $alternativeBasename = "") - add attachment file, optionally alternative basename


      send () - send the message(s) and return number of successful sent messages


      getResult () - returns a dump (array) with all recipients (to, cc, bcc) and settings you have selected with the message, the message subject and body, and lists of successfull addresses and failed addresses,


      logActivity ($logmessage) - you may log success if you want

      logError ($logmessage) - you may log warnings, too. - Errors are logged automaticaly
       
       
      useSentLog (true | false) - intended for usage with e.g. third party newsletter modules - tells the send() method to make usage of the sentLog-methods - the following three sentLog methods are hookable, e.g. if you don't want log into files you may provide your own storage, or add additional functionality here

      sentLogReset ()  - starts a new LogSession - Best usage would be interactively once when setting up a new Newsletter

      sentLogGet ()  - is called automaticly within the send() method - returns an array containing all previously used emailaddresses

      sentLogAdd ($emailaddress)  - is called automaticly within the send() method
       
      Changelog: https://github.com/horst-n/WireMailSmtp/blob/master/CHANGELOG.md
       
    • By Robin S
      An experimental module for adding images to a field via pasting one or more URLs.
      Add Image URLs
      Allows images to be added to an images field by pasting URLs.

      Usage
      Install the Add Image URLs module.
      A "Paste URLs" button will be added to all image fields. Use the button to show a textarea where image URLs may be pasted, one per line. Images are added when the page is saved.
       
      https://github.com/Toutouwai/AddImageUrls
    • By netcarver
      This module provides a very simple interface to a set of named counters. You simply call a single function, next('name'), to pull the next value out of a counter - or to set it up if it does not yet exist. Next() takes a few extra parameters to allow you to increment by values other than 1 or to start at a certain number.
      This provides some similar functionality to the built-in page naming feature of PW, and to this module recently posted by Stikki but I think it offers a little more flexibility than either. Having said that, I do like the simplicity of Stikki's new auto-increment module.
      Module Availability
      Here is my module on Github.
      Here it is in the module repository.
      Example Usage
      Here's how this module can be used to title and name a new page by adding a couple of simple hooks to site/ready.php. This example applies to new pages using a template called 'invoice' that can be quick-added to the page tree. In order to get the following to work, you must edit the template that will be the parent of the 'invoice' template and setup the template for children to "invoice" and set the "Name Format for Children" field to something other than the default blank value (I use  title  as my value.)
      <?php /** * Function to recognise our special template. */ function isInvoiceTemplate($template) { return ($template == 'invoice'); } /** * Pre-load the page title for invoice pages with a unique value * which includes a counter component. */ $pages->addHookBefore("Pages::setupNew", function($event) { $page = $event->arguments(0); $is_invoice = isInvoiceTemplate($page->template); $no_inv_num = $page->title == ''; if ($is_invoice && $no_inv_num) { $counter_name = 'WR-' . date('Y'); $number = $this->modules->get('DatabaseCounters')->next($counter_name, 10, 5000); $page->title = $counter_name . '-' . sprintf("%06u", $number); } }); /** * Prevent ProcessPageEdit from forcing an edit of the name if we got here * through a quickAdd from ProcessPageAdd. We can do this because we * preset the title field in the Pages::setupNew hook. */ $pages->addHookAfter("ProcessPageEdit::loadPage", function($event) { $page = $event->return; $is_invoice = isInvoiceTemplate($page->template); $is_temp = $page->hasStatus(Page::statusTemp); if ($is_invoice && $is_temp) { $page->removeStatus(Page::statusTemp); $event->return = $page; } }); Note, the above code + module is one direct solution to the problem posted here by RyanJ.


      Version History
      1.0.0 The initial release.
    • By flydev
      PulsewayPush
      Send "push" from ProcessWire to Pulseway.
       
      Description
      PulsewayPush simply send a push to a Pulseway instance. If you are using this module, you probably installed Pulseway on your mobile device: you will receive notification on your mobile.
      To get more information about Pulseway, please visit their website.
      Note
      They have a free plan which include 10 notifications (push) each day.
       
      Usage
      Install the PulsewayPush module.
      Then call the module where you like in your module/template code :
      <?php $modules->get("PulsewayPush")->push("The title", "The notification message.", "elevated"); ?>  
      Hookable function
      ___push() ___notify() (the two function do the same thing)
       
      Download
      Github:  https://github.com/flydev-fr/PulsewayPush Modules Directory: https://modules.processwire.com/modules/pulseway-push/  
      Examples of use case
      I needed for our work a system which send notification to mobile device in case of a client request immediate support. Pulseway was choosen because it is already used to monitor our infrastructure.
      An idea, you could use the free plan to monitor your blog or website regarding the number of failed logins attempts (hooking Login/Register?), the automated tool then block the attacker's IP with firewall rules and send you a notification.
       

       
      - - -
      2017-11-22: added the module to the modules directory
       
    • By cosmicsafari
      Hi all,
      Just wondering if its possible to just add some basic output to my modules config page.
      I was wanting to output a bulleted list of some information which I will be pulling from a third party.
      Retrieving the data is fine i'm just not sure how to output it to the config page?
      From what I can see in the link below, it only seems like you can append form items to the page.
      https://processwire.com/blog/posts/new-module-configuration-options/