Jump to content

Module: Blog


kongondo

Recommended Posts

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
Link to comment
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.

 

Link to comment
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
Link to comment
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

 

Link to comment
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

Link to comment
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.

 

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...

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?

 


 

 


 

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
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.

Link to comment
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) 

 

Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
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►

 

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
×
×
  • Create New...