kongondo

Module: Blog

Recommended Posts

Hi,

I really like this module.

I was wondering if it is possible to add featured image field to blog posts? I'm sure it is possible but don't know in which template file should I add new image field so it is available in all posts as featured image right after title of post.

Thanks.

Share this post


Link to post
Share on other sites

Welcome to the forums @DarkwaveSurfer,

Glad you are finding the module useful. The template would be 'blog-post'. But you already have an image field in that template, so why add another? In addition, Blog already has a featured image feature. Sorry the docs are not up to date. Please have a read from this post forward..You have fine-grained control where to show your featured image, whether it comes from the image field or the RTE.

 

  • Like 1

Share this post


Link to post
Share on other sites

@kongondo

Thanks for the reply. I'm new with php and Processwire so I need a little help.

I managed to show featured image from "images field" in recent posts widget like this (on my Home page):

$blog = $modules->get("MarkupBlog");
$options = array('width'=>350, 'alt'=>'title', 'post_small_image' => 1, 'post_large_image' => 1, 'post_comments' => 0);
$content = $blog->renderPosts("limit=2", true, $options);
echo $content; 

But image from "images field" doesn't appear when I enter Blog post or in Blog page (list of all posts). How do I show image on those pages?

Also, can the featured image be placed after the post title? At the moment it is before title.

Thanks.

 

Share this post


Link to post
Share on other sites

@DarkwaveSurfer,

Please see post:

post_small_image only works when the second parameter of renderPosts() is true (like in your case, so it should work...hmmm). Try removing the post_large_image from the options if you are using post_small_image. I haven't looked at the module in a while so I'll need to re-educate myself with some of the options :-X:P. Have you tried post_small_image => 2? That should display (IIRC) the featured image after the post title.

  • Like 1

Share this post


Link to post
Share on other sites

Hi, firstly thanks for the awesome module!

Just wondering if I install using the second format style so everything is housed in a '/blog' directory... can I then move that blog directory from the root without wrecking anything? My site structure is along the lines of www.root.com/resources/blog/

Much appreciated,

Brett

 

Share this post


Link to post
Share on other sites

Hi @Barido. Welcome to the forums. Glad you find the module useful. That should be fine since MarkupBlog finds the 'main' Blog pages by their IDs (e.g. Blog, Blog Posts, Blog Settings, etc). You will want to backup everything first before attempting that move though, just in case...

Cheers,

/k

Share this post


Link to post
Share on other sites
On 29/10/2016 at 10:31 AM, kongondo said:

Thanks @kongondo - Had a few issues with the 3.0 install when comments were disabled. Looks like someone has brought that up on the GIT page though. Might try again when/if it gets legit 3.0 compatibility. Using a custom solution for now.

 

Share this post


Link to post
Share on other sites
On 11/10/2016 at 6:55 AM, BitPoet said:

Always happy to help :)

For anybody who feels daring and wants to try it, you can find the patched module here until kongondo finds the time to test my changes. Use at your own risk ;)

 

For me, it works perfect, congratulations.

  • Like 1

Share this post


Link to post
Share on other sites

Ok, I am looking for the option to put the class='post-byline' after the content of the post.

I found the code, but I don't know where to change the variable $option.

$author = $options['post_author'] == 1 ? "<span class='author'>" . $options['post_author_text'] . " " . "<a href='{$page->authorURL}'>{$page->authorName}</a></span> " : '';
$date = $options['post_date'] == 1 ? "<span class='date'>" . $options['post_date_text'] . " " . $page->blog_date . "</span>" : '';

I found the way the change it using the "hard way". I mean by deleting the $options['post_author'] == 1 and everything but I would like to know where is that option.

Thanks in advance.

Share this post


Link to post
Share on other sites

Could I use Hanna Code inside the blog post?

I am trying to use some and the post doesn't recognize them.

I looked for in this topic but I didn't find anything useful... maybe I am not using the right words. Sorry for the inconvenience.

Share this post


Link to post
Share on other sites
10 hours ago, antoiba86 said:

Could I use Hanna Code inside the blog post?

Have you added TextformatterHannaCode to the blog_body field's configuration?

  • Like 1

Share this post


Link to post
Share on other sites

Hi,
Good to have a forum , i tried to install Processblog for PW3.0 from modules page , it no work.
Than i found  BitPoet version for PW3 here, thanks a lot.

I met some troubles with home page   and  messing with permissions for blog authors.

Is there a way to implement "most popular posts" functionality?

 


 

 


 

Share this post


Link to post
Share on other sites
40 minutes ago, ak1001 said:

Is there a way to implement "most popular posts" functionality?

That depends on the exact definition of "most popular". If its just the number of  visitors for each post, you could add a visit_counter field to the blog_post template and include the code shown in this post in blog_post.php which increments the counter with each new view per session:

Then you could simply run a selector with "template=blog-post, sort=-visitor_counter, limit=x" to show the top x most visited posts. To get it visible:

  • use one of the templates like blog-recent-posts
  • copy it and its PHP file to blog-popular-posts
  • adapt the selector in the PHP file like above
  • create and publish a page "Popular Posts" for the new template
  • and finally add "blog-popular-posts" to the $template array in blog-main.inc (line 16) so it shows up in the navigation

(untested!)

  • Like 2

Share this post


Link to post
Share on other sites

Update: Blog 2.4.0

Changelog

  1. Fixed SQL error thrown when comments disabled and accessed blog dashboard. Thanks @justb3a
  2. Added capability to copy demo JS and CSS files on blog install as well as remove them on uninstall.
  3. Full compatibility with ProcessWire 2.8.x and ProcessWire 3.x. Thanks to @BitPoet
Happy then to announce that I've tested and can confirm that Blog is compatible with ProcessWire 2.8.x and ProcessWire 3.x 
  • Like 5

Share this post


Link to post
Share on other sites
2 hours ago, kongondo said:

Happy then to announce that I've tested and can confirm that Blog is compatible with ProcessWire 2.8.x and ProcessWire 3.x 

@kongondo and @BitPoet, thank you guys VERY much for this—v3 compatibility, brilliant! ^_^

Share this post


Link to post
Share on other sites

Hi @kongondo 

I'm trying to install the blog, and have read all the installation instructions and following them to the T, but somehow I'm getting stuck after the second step. When I press the "run install wizard" button it doesn't show me the blog dashboard, instead it says "The process returned no content."

For installation I'm choosing

  • Style 1
  • Enabling comments
  • Template files with demo blog
  • RTE in quick post

When I want to uninstall I don't see the "cleanup" in the blog menu either.

What am I doing wrong? Please help.

Share this post


Link to post
Share on other sites

@MaryMatlow. Not a great start, eh? :). I can't recall having seen such an error before in respect of Blog. What's your ProcessWire version? PHP version, etc? What does the PW error log say? With debug on, do you get any errors? You could also check errors with Tracy (a different module) if you have it installed.

Share this post


Link to post
Share on other sites

Oops! I upgraded to the latest version of Blog and get this fatal error, the site and admin is down:

Fatal error: Cannot redeclare class BlogPublishDate in /Applications/XAMPP/xamppfiles/htdocs/xxxxxxx/site/assets/cache/FileCompiler/site/modules/ProcessBlog/BlogPublishDate.module on line 23
Compile Error: Cannot redeclare class BlogPublishDate (line 23 of /Applications/XAMPP/xamppfiles/htdocs/xxxxxxx/site/modules/ProcessBlog/BlogPublishDate.module) 

 

Share this post


Link to post
Share on other sites

I'm not sure I follow. What do you mean you upgraded to the latest version of Blog. I assumed this was your first time installing Blog, hence had the latest version already? Did you follow the normal upgrade process or did you create a second blog folder under /site/modules/? If you have two Blog folders in there, that would lead to the the 'redeclare' error. Since you have the Fatal Error alongside the Compile Error, I don't think it is a compile issue, but a 'two-folders' issue. Perhaps you have a /site/modules/processblog/ and a /site/modules/blog/? If that's not the case, could you clear your cache (Refresh button when in Modules view). You might need to do that several times. 

I haven't tested Blog in 3.0.39, but did test in 3.0.42 so maybe that is not the issue. Please refresh the cache and try reinstalling. This time, install without enabling comments. Secondly, could you confirm that Blog components are installed, i.e. blog_xxx_fields and blog-xxx-templates. 

 

  • Like 1

Share this post


Link to post
Share on other sites

Ok, here's how it is. I had downloaded the Blog module some months ago and had been installing/uninstalling it. When in the "Upgrades" tab under Setup I was an available upgrade for the Blog I went ahead with it and the error occurred. You were right, it was the "two folders" problem. Anyway, I have deleted all the folders and files related to the Blog, have downloaded the latest version from GitHub and tried installing it, After the first step it gives me the following error:

Cannot install Blog templates. Some template names already in use. These are: blog, blog-archives, blog-authors, blog-categories, blog-category, blog-links, blog-post, blog-recent-posts, blog-recent-tweets, blog-tag, blog-tags, blog-widgets, blog-widget-basic, blog-settings, repeater_blog-links.

Cannot install Blog fields. Some field names already in use. These are: blog_body, blog_categories, blog_quantity, blog_date, blog_files, blog_headline, blog_href, blog_images, blog_links, blog_note, blog_summary, blog_tags, blog_small.

Is there a way to delete the templates and fields in one go? Or is there a way around this error. Thanks so much for your help.

Share this post


Link to post
Share on other sites

For now, maybe a manual upgrade is what you need, exactly what you are doing. 

Use this gist to cleanup, via the frontend as follows: 

  1. Copy the code into a template file
  2. Login as superadmin
  3. In the frontend, visit a page that uses that template and follow the instructions
  4. Revert your template file to what it was before step #1

I suggest you also clear your file compilter. You can then install Blog. There are no changes in the latest version that would stop Blog from installing (compared to the older version). In fact, the newest version was one to make it compatible with PW 3.X. Let us know how it goes. 

  • Like 1

Share this post


Link to post
Share on other sites

@kongondo When I run the cleanup script, it gives me this error:



User Error
Exception: Can't delete Page 1266 because it has one or more children. (in /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/PagesEditor.php line 986)

#0 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Pages.php(487): ProcessWire\PagesEditor->delete(Object(ProcessWire\Page), false, Array)
#1 [internal function]: ProcessWire\Pages->___delete(Object(ProcessWire\Page))
#2 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(374): call_user_func_array(Array, Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___delete', Array)
#4 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pages), 'delete', Array)
#5 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/site/assets/cache/FileCompiler/site/templates/featureList.php(155): ProcessWire\Wire->__call('delete', Array)
#6 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/site/assets/cache/FileCompiler/site/templates/featureList.php(155): ProcessWire\Pages->delete(Object(ProcessWire\Page))
#7 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/site/assets/cache/FileCompiler/site/templates/featureList.php(137): BlogCleanup->cleanUpRepeater()
#8 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/site/assets/cache/FileCompiler/site/templates/featureList.php(61): BlogCleanup->cleanUpPages()
#9 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/site/assets/cache/FileCompiler/site/templates/featureList.php(423): BlogCleanup->cleanUp(Object(ProcessWire\InputfieldForm))
#10 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/site/assets/cache/FileCompiler/site/templates/home.php(5): include('/Applications/X...')
#11 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/TemplateFile.php(268): require('/Applications/X...')
#12 [internal function]: ProcessWire\TemplateFile->___render()
#13 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(374): call_user_func_array(Array, Array)
#14 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___render', Array)
#15 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
#16 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/modules/PageRender.module(515): ProcessWire\Wire->__call('render', Array)
#17 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/modules/PageRender.module(515): ProcessWire\TemplateFile->render()
#18 [internal function]: ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent))
#19 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(374): call_user_func_array(Array, Array)
#20 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___renderPage', Array)
#21 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageRender), 'renderPage', Array)
#22 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/WireHooks.php(629): ProcessWire\Wire->__call('renderPage', Array)
#23 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/WireHooks.php(629): ProcessWire\PageRender->renderPage(Object(ProcessWire\HookEvent))
#24 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Page), 'render', Array)
#25 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/modules/Process/ProcessPageView.module(205): ProcessWire\Wire->__call('render', Array)
#26 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/modules/Process/ProcessPageView.module(205): ProcessWire\Page->render()
#27 [internal function]: ProcessWire\ProcessPageView->___execute(true)
#28 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(374): call_user_func_array(Array, Array)
#29 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___execute', Array)
#30 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\ProcessPageView), 'execute', Array)
#31 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/index.php(55): ProcessWire\Wire->__call('execute', Array)
#32 /Applications/XAMPP/xamppfiles/htdocs/yogaspace/index.php(55): ProcessWire\ProcessPageView->execute(true)
#33 {main} search►

 

Share this post


Link to post
Share on other sites

What is page with ID 1266. Is it a repeater page? Is it maybe in the trash? Either way, delete it manually and try again. 

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
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public:
       
      Download & Docs: https://gitlab.com/baumrock/RockPdf
       
      You can combine it easily with RockReplacer: 
       
    • By Soma
      LogMaintenance
      A simple ProcessWire module to give some maintenance control over log files. I found myself often having lots of log files for different things that can grow more or less quickly to a size where they can be difficult to maintain. The built in Logger of PW does a good job of giving you the possibility to delete or prune logs. But it has to be done manually and sometimes a log grows into millions of lines, which makes it often impossible to even prune it as it's too large.
      LogMaintenance uses LazyCron to run the maintenance task and there's several settings you can setup on a global or per log basis.
      Archive: will create zip files for each log file in logs/archive/ folder and add the log each time the maintenance is run to a subfolder containing the datetime.
      Lines: keeps logs to a certain number of lines 
      Days: keeps the log to a certain number of days
      Bytes: keeps the log to a certain amount of bytes
      Each setting is checked from top down, the first setting to contain something is used. So if you check the "Archive" option, all other settings are ignored and logs are archived everytime the LazyCron is executed. If you want to keep your logs to a certain amount of bytes just leave all other settings to 0 or blank.
      Per Log Settings
      There's a textarea that you can use to setup a config for a specific log file one per line. All the logs you define here ignore the global settings above. The syntax for the settings is:
      logname:[archive]:[lines]:[days]:[bytes] 
      errors:1:0:0:0 // would archive the errors log messages:0:10000:0:0 // will prune the errors log to 10000 lines  
      The module can be found on github for you to check out. It's still fresh and I'm currently testing.
      https://github.com/somatonic/LogMaintenance
    • By teppo
      Fieldtype Page IDs is a third party Fieldtype that, simply put, stores Page references as integers (Page IDs).
      This fieldtype was built as a quick and dirty workaround for Page Reference fields' inability handle self-references due to circular reference issues. A project I've been working on for a while now includes a combination of RepeaterMatrix content blocks and tagging/categorization system that would've resulted in a lot of duplicate pages (and plenty of unnecessary manual work for content editors) had I used built-in Page Reference fields, and thus a new Fieldtype felt like the most sensible approach.
      Fieldtype Page IDs was designed to be loosely compatible with Page References in order to make conversions between the two feasible, but it is quite limited feature wise:
      largely due to the fact that stored values are actually just integers with no connection to Pages whatsoever some advanced selectors and related features are not supported, and page values can't be directly accessed configuration settings are limited to the bare essentials (selector string and Inputfield class) only a handful of Inputfields (AsmSelect, Checkboxes, Text) are (currently) supported Anyway, in case you need to store Page IDs (and Page IDs only) and are happy with the limitations mentioned above, feel free to give this Fieldtype a try. It has been working fine for me in one particular project, but hasn't been tested that much, so please tread carefully – and let me know if you run into any issues.
      GitHub repository: https://github.com/teppokoivula/FieldtypePageIDs
      Modules directory: https://modules.processwire.com/modules/fieldtype-page-ids/
    • 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:
      I've updated the module to 0.0.4. I removed the instructions from this forum, so I don't have to maintain it on multiple places. Just checkout the readme on github 🙂
      If you have questions or like to contribute, just post a reply or create an issue or pr on github. 
    • By franciccio-ITALIANO
      Hi, in wordpress homepage we can put a list of LAST ARTICLES AND COMMENTS.
      Can I do same thing with processwire?
      If yes, how?
      There is a tutorial?

      Thanks!