Jump to content

Module: Blog


kongondo

Recommended Posts

1 hour ago, heliumrotator said:

Only the configuration looks very ugly. I don't know if this your new style or an accident. I saw that better in the official video:

The very ugly configuration is the new style (since a couple of versions back). What you saw in the (old) 'official' video is the old style.

Welcome to the forums 🙂.

Link to comment
Share on other sites

Thank you for fast you reply.

My first thought was that I did something wrong. For hours I've been looking for the fault. Until I realized that there is no fault. I would never have thought that it should look like this.

Is there a way to get the old style back?

   
Link to comment
Share on other sites

Hi all,
I am using the blog module, and I love it. Thank you @kongondo.
I have created some posts with featured images and it seems to work fine.
The featured image is displayed above the post-headline.
But if I chose a category and take a view at the blog-category template, the featured image is not displayed at the posts which are belongs to the category.
Probably I forgot something to set?

Thanks in advance for the help.

 

Blog/MarkupBlog: 2.4.2

ProcessWire 3.0.42. 

Link to comment
Share on other sites

  • 1 month later...
2 hours ago, MaryMatlow said:

I have added a Repeater field in the blog_post template. But when I go to Quick Post to add a post I don't see the Repeater field in the editor. Am I missing anything?

Currently, such 'user-added' fields are not supported in Quick Post. They can only be accessed when you edit the blog page normally. Maybe it's something I need to think about.

Link to comment
Share on other sites

On 5/29/2018 at 1:42 PM, St3f4n said:

But if I chose a category and take a view at the blog-category template, the featured image is not displayed at the posts which are belongs to the category.
Probably I forgot something to set?

Sorry, @St3f4n. I forgot to answer your question! Use post_large_image option for featured image in a non-summarised (i.e. large/full) post and post_small_image option for featured image in a small/summarised post (e.g. in the default blog-category template file). Does this help?

Welcome to the forums 🙂.

Link to comment
Share on other sites

17 hours ago, kongondo said:

Currently, such 'user-added' fields are not supported in Quick Post. They can only be accessed when you edit the blog page normally. Maybe it's something I need to think about.

Thanks @kongondo

Is there a way to add a new post other than "quick post'? I can see the Repeater field when I edit an existing post, but how do I access it when creating a new post?

Link to comment
Share on other sites

1 hour ago, MaryMatlow said:

Is there a way to add a new post other than "quick post'?

Yes, but only via the normal PW page tree.  Posts are just PW pages that use the template blog-post. I don't know what Blog style you used, but just add a child page to whoever the parent of pages using blog-post is. If using style 1 of Blog, then the parent should be the page Posts and it uses the template blog-posts. Adding a child to that parent page should automatically select the template blog-post for the children being added (i.e. individual posts).

Link to comment
Share on other sites

3 hours ago, kongondo said:

Yes, but only via the normal PW page tree.  Posts are just PW pages that use the template blog-post. I don't know what Blog style you used, but just add a child page to whoever the parent of pages using blog-post is. If using style 1 of Blog, then the parent should be the page Posts and it uses the template blog-posts. Adding a child to that parent page should automatically select the template blog-post for the children being added (i.e. individual posts).

Yes, of course. Thank you @kongondo 🙂

Link to comment
Share on other sites

  • 2 weeks later...
On 1/20/2015 at 9:44 AM, kongondo said:

Pretty much, but with a few additions as well. I have created a Gist of the renderPosts() function here:

1

Hi kongondo, I've been trying to make this plugin work for two straight days and I'm not having much luck. 

I'm a bit of a noob when it comes to PHP but I'm usually able to stumble my way through. Can you provide an updated Gist? I'm thinking maybe this one is just too old and won't work with the latest version of your plugin. It seems like copying the renderPosts function to my _func.php file (instead of editing MarkupBlog.module) is the best way to do it so that my changes aren't overwritten when the plugin is updated. I've read this forum over and over, I hate to bother you but the documentation doesn't seem to be complete yet.

[UPDATE: I finally got the featured images to work - didn't realize I had to add the "featured" tag to the image - otherwise, I get an error].

Any chance you can provide a working Gist for each of the other properties? IE: categories, authors, archives, comments, tags, next/prev post, etc. -  I would like to modify them to match my theme in the same way I did with renderPosts.

Link to comment
Share on other sites

On 5/24/2018 at 3:49 PM, heliumrotator said:

Is there a way to get the old style back?

Not unless you roll back to previous versions or modify the module itself to your liking (being aware that any future updates will wipe out your changes unless you rename your module class and files).

 

On 7/15/2018 at 1:33 AM, Ben Sayers said:

I've read this forum over and over, I hate to bother you but the documentation doesn't seem to be complete yet.

Welcome to the forums @Ben Sayers. Yes, apologies for the documentation. Despite my best intentions, I've never been able to find time to complete it.

On 7/15/2018 at 1:33 AM, Ben Sayers said:

[UPDATE: I finally got the featured images to work - didn't realize I had to add the "featured" tag to the image - otherwise, I get an error].

Again, sorry about this. Docs should be clearer.

On 7/15/2018 at 1:33 AM, Ben Sayers said:

Any chance you can provide a working Gist for each of the other properties? IE: categories, authors, archives, comments, tags, next/prev post, etc. -  I would like to modify them to match my theme in the same way I did with renderPosts.

Not at the moment, I'm afraid. Any reason why you can't/won't use the Blog module itself to render your posts? The demo template files and the present documentation provide examples that should get you going.

Link to comment
Share on other sites

16 hours ago, kongondo said:

Not at the moment, I'm afraid. Any reason why you can't/won't use the Blog module itself to render your posts? The demo template files and the present documentation provide examples that should get you going.

I guess that's where the documentation would come in handy, I just don't understand how to use the Blog module... If I make changes to MarkupBlog.module, won't they be overwritten if I update your plugin in the future? The demo templates seem to be using the delayed output method which I don't know how to use. When I install PW, I use the "Beginner" option with Direct Output (head/foot includes). 

Link to comment
Share on other sites

2 hours ago, Ben Sayers said:

If I make changes to MarkupBlog.module, won't they be overwritten if I update your plugin in the future

Yes, they would be overwritten.

2 hours ago, Ben Sayers said:

I guess that's where the documentation would come in handy, I just don't understand how to use the Blog module

I agree, however, the current Blog API documentation is sufficient to get you started, I would think 🙂.

2 hours ago, Ben Sayers said:

The demo templates seem to be using the delayed output method which I don't know how to use

True, but it shouldn't be a problem because the most important thing for you is to use Blog's own methods. E.g. renderPosts(), renderCategories(), etc. They'll still work irrespective of output method. Hence, the reason I pointed you to the examples in the demo template files.

Maybe if you could explain what exactly you need help with?

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...
On 8/10/2018 at 3:25 PM, DarsVaeda said:

I've just updated my PW to 3.0.98 and installed ProCache. Unfortunately now I'm getting a 404 on all blog pages. Also I see ProCache doesn't even list the blog templates.

Any advice?

Hi @DarsVaeda,

I am totally clueless about this as I've never used ProCache. Could you disable ProCache and see if we can rule out the upgrade to PW 3.0.98 as the cause? Any errors? (use Tracy Debugger)

Link to comment
Share on other sites

I actually just found the error this morning. Whilst uploading something went wrong with file rights of the template. When going to the template it actually states so (that it can't access the template and no pages with that template will be displayed).

But on frontend it's just a 404 and no log entry. Would be nice to get that error as log entry so debugging is a bit easier.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Kongondo,

Thanks for this massive module! I've been away from PW for a while and finding this was a true gem.

How would we render just the Categories list with page count next to it without actual blog entries? Similar to /blog/categories/

I have tried setting the limit without much change:

$blog = $modules->get('MarkupBlog');

//number of posts to list per category
$limit = 0;

//get the categories page. 
$categories = $pages->get('/blog/categories/');

//Render list of categories showing a maximum of 0 posts titles per category
//children = the individual category pages
echo $blog->renderCategories($categories->children, $limit);

I could not see many parameters or examples in the docs.

Thanks so much!

 

Using  ProcessWire 3.0.98 and Blog Module 2.4.2

Edited by biotech
original issue solved
Link to comment
Share on other sites

On 8/29/2018 at 3:22 AM, biotech said:

Thanks for this massive module! I've been away from PW for a while and finding this was a true gem.

Glad you are finding it useful.

On 8/29/2018 at 3:22 AM, biotech said:

How would we render just the Categories list with page count next to it without actual blog entries? Similar to /blog/categories/

Currently, you can't. You can file it as a feature request though. Please file as an issue here.

Edit: Alternatively, you can do this easily yourself like so:

// get the categories page. 
$categories = $pages->get('/blog/categories/');
$out = '';

// @note: optionally limit these if there's lots of posts >>> children('limit=x')
foreach ($categories->children as $category) {
    $categoryPostsCount = $pages->count("template=blog-post, blog_categories=$category, sort=-blog_date");
    // append category title and link
    $out .= "<h3><a href='$category->url'>$category->title</a></h3>";
    $out .= "<span>$categoryPostsCount</span>";
}


echo $out;

 

On 8/29/2018 at 3:22 AM, biotech said:

I have tried setting the limit without much change:

limit controls number of posts returned. A value of zero means do not apply any limit, hence returns all available posts 🙂.

Edited by kongondo
Link to comment
Share on other sites

Hi Kongondo,

Thanks, the "blog/categories/" template makes sense when listing categories over all, my goal above was to generate something short and simple for a side bar listing - your snipped was exactly what I was after, thank you!

Link to comment
Share on other sites

  • 1 month later...

Hello,

This module is great! However I have some issues with outputting the posts on the blog template. I've published a blog post and tried to output the post on the blog page with the following code:

$blog = wire('modules')->get("MarkupBlog");

// main content
$content = '';
//$content .= "<h2>{$page->get('blog_headline|title')}</h2>";
//render a limited number of summarised posts
$content .= $blog->renderPosts("limit=5", true);

This code is provided with the module so I suppose it works. However it just returns that there are no posts found. I also tried to find the posts by myself, not using the module with the following line of code:

$posts = wire('pages')->find("template=blog-post, sort=-blog_date");

But if I try to output the page ID or the title, it returns nothing. 

I double checked the post that the page is published (it is published and not hidden) so in theory I have to find the page but no matter what I do, I can't find the posts.

What am I doing wrong here or can someone point me in the right direction?

Link to comment
Share on other sites

1 hour ago, Harmen said:

This module is great!

Glad you like it.

1 hour ago, Harmen said:

What am I doing wrong here or can someone point me in the right direction?

I'm not sure what's going on. The code looks OK. Do you have debug on? Any errors? Are you able to output other pages? Did you perhaps set some access control on the posts?

By the way, is there any reason you are using wire() inside template files? i.e. $pages->find() and $modules->get() should work just fine without wire() in template files.

Link to comment
Share on other sites

44 minutes ago, kongondo said:

Do you have debug on? Any errors?

I have TracyDebugger up and running. Doesn't throw any errors.

45 minutes ago, kongondo said:

Are you able to output other pages?

Yes, I can output other pages.

45 minutes ago, kongondo said:

Did you perhaps set some access control on the posts?

The page containing the post has normal right, like every other page. Just like the parent of the post and the blog page itself.

47 minutes ago, kongondo said:

By the way, is there any reason you are using wire() inside template files?

Result of some tests I did. There is no specific reason, was just trying some things because I don't know why it isn't working

Link to comment
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 monollonom
      PageMjmlToHtml
      Github: https://github.com/romaincazier/PageMjmlToHtml
      Modules directory: https://processwire.com/modules/page-mjml-to-html/
      A module allowing you to write your Processwire template using MJML and get a converted HTML output using MJML API.
      This is considered to be in alpha and as such needs some testing before being used in production!

      About
      Created by Mailjet, MJML is a markup language making it a breeze to create newsletters displayed consistently across all email clients.
      Write your template using MJML combined with Processwire’s API and this module will automatically convert your code into a working newsletter thanks to their free-to-use Rest API.
      Prerequisite
      For this module to work you will need to get an API key and paste it in the module’s configuration.
      Usage
      Once your credentials are validated, select the template(s) in which you’re using the MJML syntax, save and go visualize your page(s) to see if everything’s good. You will either get error/warning messages or your email properly formatted and ready-to-go.
      From there you can copy/paste the raw generated code in an external mailing service or distribute your newsletter using ProMailer.
      Features
      The MJML output is cached to avoid repetitive API calls Not cached if there are errors/warnings Cleared if the page is saved Cleared if the template file has been modified A simple (dumb?) code viewer highlights lines with errors/warnings A button is added to quickly copy the raw code of the generated newsletter Not added if the page is rendered outside of a PageView Only visible to users with the page’s edit permission A shortcut is also added under “View” in the edit page to open the raw code in a new tab Multi-languages support
      Notes
      The code viewer is only shown to superusers. If there’s an error the page will display:
      Only its title for guests Its title and a message inviting to contact the administrator for editors If you are using the markup regions output strategy, it might be best to not append files to preserve your MJML markup before calling the MJML API. This option is available in the module’s settings.
    • By Marco Ro
      Hi guys!
      I'm a bit anxious because this is the first module I present! (beta modulo) But I will finally be able to share something with the community too! :)
      This is a BETA version of the PayPal payment system called: PayPal Commerce Platform.
      It is an advanced system (Business Pro account is needed) that brings various benefits in terms of fees and above all integrates direct payment with credit/debit cards. 
      The module integrates with Padloper 0.0.2, which is the current installation I'm using.
      This system integrates the classic PayPal buy button, the alternative or local payment method and the new payment system: credit/debit cards that doesn't go through the PayPal account. It is a Stripe-style payment, it connects directly with the bank and integrates 3D security validation.
      I say that it is a BETA because this module currently only works with Sandbox account, to put it live you need to change API url manually (manually for the moment).
      Because this module is not ready for live:
      I would like to have your opinion on how I built the module (is the first one I do). I don't want to share something that is not fish but I need a comparison with someone more experienced than me, for be sure that this is the best way to code the module.
      If you want to try this I created a git, you will find all the instructions for installation and correct operation. (Git has a MIT licensed)
      https://github.com/MarcooRo/processwire-PayPal-Commerce-Platform I hope I did something that you guys can like :)
    • By monollonom
      (once again I was surprised to see a work of mine pop up in the newsletter, this time without even listing the module on PW modules website 😅. Thx @teppo !)
      FieldtypeQRCode
      Github: https://github.com/romaincazier/FieldtypeQRCode
      Modules directory: https://processwire.com/modules/fieldtype-qrcode/
      A simple fieldtype generating a QR Code from the public URL of the page, and more.
      Using the PHP library QR Code Generator by Kazuhiko Arase.

      Options
      In the field’s Details tab you can change between .gif or .svg formats. If you select .svg you will have the option to directly output the markup instead of a base64 image. SVG is the default.
      You can also change what is used to generate the QR code and even have several sources. The accepted sources (separated by a comma) are: httpUrl, editUrl, or the name of any text/URL/file/image field.
      If LanguageSupport is installed the compatible sources (httpUrl, text field, ...) will return as many QR codes as there are languages. Note however that when outputting on the front-end, only the languages visible to the user will be generated.
      Formatting
      Unformatted value
      When using $page->getUnformatted("qrcode_field") it returns an array with the following structure:
      [ [ "label" => string, // label used in the admin "qr" => string, // the qrcode image "source" => string, // the source, as defined in the configuration "text" => string // and the text used to generate the qrcode ], ... ] Formatted value
      The formatted value is an <img>/<svg> (or several right next to each other). There is no other markup.
      Should you need the same markup as in the admin you could use:
      $field = $fields->get("qrcode_field"); $field->type->markupValue($page, $field, $page->getUnformatted("qrcode_field")); But it’s a bit cumbersome, plus you need to import the FieldtypeQRCode's css/js. Best is to make your own markup using the unformatted value.
      Static QR code generator
      You can call FieldtypeQRCode::generateQRCode to generate any QR code you want. Its arguments are:
      string $text bool $svg Generate the QR code as svg instead of gif ? (default=true) bool $markup If svg, output its markup instead of a base64 ? (default=false) Hooks
      Please have a look at the source code for more details about the hookable functions.
      Examples
      $wire->addHookAfter("FieldtypeQRCode::getQRText", function($event) { $page = $event->arguments("page"); $event->return = $page->title; // or could be: $event->return = "Your custom text"; }) $wire->addHookAfter("FieldtypeQRCode::generateQRCodes", function($event) { $qrcodes = $event->return; // keep everything except the QR codes generated from editUrl foreach($qrcodes as $key => &$qrcode) { if($qrcode["source"] === "editUrl") { unset($qrcodes[$key]); } } unset($qrcode); $event->return = $qrcodes; })
    • By Sebi
      AppApiFile adds the /file endpoint to the AppApi routes definition. Makes it possible to query files via the api. 
      This module relies on the base module AppApi, which must be installed before AppApiFile can do its work.
      Features
      You can access all files that are uploaded at any ProcessWire page. Call api/file/route/in/pagetree?file=test.jpg to access a page via its route in the page tree. Alternatively you can call api/file/4242?file=test.jpg (e.g.,) to access a page by its id. The module will make sure that the page is accessible by the active user.
      The GET-param "file" defines the basename of the file which you want to get.
      The following GET-params (optional) can be used to manipulate an image:
      width height maxwidth maxheight cropX cropY Use GET-Param format=base64 to receive the file in base64 format.
    • By MarkE
      This fieldtype and inputfield bundle was built for storing measurement values within a field, rendering them in a variety of formats and converting them to other units or otherwise modifying them via the API.
      The API consists of a number of predefined functions, some of which include...
      render() for rendering the measurement object, valueAs() for converting the value to another unit value, convertTo() for converting the whole measurement object to different units, and add() and subtract() for for modifying the stored value by the value (converted as required) in another measurement. In the admin the inputfield includes a checkbox (which can be optionally disabled) for converting values on page save. For an example if a value was typed in as centimeters, the unit was changed to metres, and the page saved with this checkbox selected, said value would be automatically converted so that e.g. 170 cm becomes 1.7 m.

      A simple length field using Fieldtype Measurement and Inputfield Measurement.
      Combination units (e.g. feet and inches) are also supported.
      Please note that this module is 'proof of concept' at the moment - there are limited units available and quite a lot of code tidying to do. More units will be added shortly.
      See the GitHub at https://github.com/MetaTunes/FieldtypeMeasurement for full details and updates.
×
×
  • Create New...