Jump to content

Module: Blog


kongondo

Recommended Posts

Hi kongondo,

Sorry to bother you with a question and thanks if you get any time to answer ^_^

If I use the Auto-publish from... field and its date-picker the field gets populated like this

2016-05-16 hh24:05:ss

on clicking Save and keep unpublished I see a session warning/info

Session: The parsed time was invalid (value='2016-05-16 hh24:05:ss', format='Y-m-d H:i:s')

I can manually clean the format or delete out all but the date and all is OK.

Blog is 2.3.9 and PW is 2.7.3

If there is more I can tell you or you'd like me to try something then I'd be only too happy to.

Thanks in advance for any pointers on if I can fix this somehow (I looked at settings of the publish_from field etc but it looks like template blog is overwriting them and when I check there there it looks like they're locked down (not that I would lightly go around editing such an area). Cheers, -Alan

Edit: PS it looks like the Save and keep unpublished cleans the field to something like 2016-05-12 00:05:00 and so I guess the session warning is for my info and the sanitizing of the field chose some defaults from the 'bad' data. Hope that made sense :/

Hi Alan,

Sorry for the delay in getting back to you. The issue you are seeing is coming from the third-party module SchedulePages. As you are aware, in order to use the auto-(un)publish feature, one has to install this module. However, looking at these lines in the module code, I noticed that whereas it sets a date output and input format, it does not exclusive set a time input format (hence the  hh24:06:ss that you are seeing). The solution is simple. Edit the two fields 'publish_from' and 'publish_until'. Specifically, visit their 'Input' Tab and select both a Date and Time Input Format.

post-894-0-39186500-1464967899_thumb.png

  • Like 1
Link to comment
Share on other sites

Thank you very much!!!

it works when i'am inside the posts. It does'nt show up in the overview, but that is not important for now. :)

post-3507-0-13952500-1464967991_thumb.pn

As others said before, thank you for this wonderfull blog module! And thank you very much for your fast help!

  • Like 1
Link to comment
Share on other sites

Hi kongondo, thank you very much for the super-helpful answer and NO sweat re time gone by. I wasn't sure I'd written the post very clearly anyway so felt bad for maybe not being clear enough. Thanks again! Cheers ^_^

Link to comment
Share on other sites

@Marcel...what you do mean by the 'overview'? blog-posts page [the one with a summary of several posts] and/or the blog landing page? Anyway, it wouldn't work properly there since the count wouldn't be unique to each post...However, there could be other ways around that too, e.g. grabbing one post at a time in a foreach loop and replacing the post body for each...

Link to comment
Share on other sites

Sorry guys for this question but I do not get along with the current sample blog template. I'm not a programmer but more man for CSS and Design.

I once simply a pure HTML page via include integrated into the blog-main.inc and in the _main.php.

This should both unify the whole <head>.

As long as I took everything great only on the home page and thus not the blog. But once I / went to / blog was the <header> as double.

How can I round unify fit. So all that belongs to its place and get out of it, no Server Error's.

https://processwire.com/talk/topic/7403-module-blog/page-32#entry117498

How should I get a basic template for my projects best build it again?

Me is not so clear as the related files, currently seems the _main.php to be parsed and yet this then handed over to the blog or main.php?

Since I am not alzu good programmer I do not know how I currently best so should build a basic template. The whole with _init.php etc I am very unknown. Also, what functions as currently produced.

@csaeum,

I have read your post several times but wasn't able to figure out what you were asking. Please clarify, maybe with some code and/or pictorial examples, thanks..

Link to comment
Share on other sites

  • 1 month later...

Hey everyone. First off, totally new to PW. Fed up with WP's BS (delivered by the truckload) and testing all sorts of CMS/CMF systems. PW comes up in the discussion a lot. Not totally new to PHP or the relevant markup languages, but rusty.

Anyway, installed the blog module, at first with templates and sample blog, then went to the site to view "Example Post" and got two pages in one. Literally, the page was output twice (from DOCTYPE to </html>). Used the cleanup to start again, and just did blank template files. Got a normal page, but with nothing more than the default extra menu items. So I copied the contents of module's `blog-post.php` to the site's template blank file created on install. Get a little more markup in the page that way, but no actual post or other settings (i.e., the Author name still displays as the default "Author Name").

Using the latest stable branch of PW v2 (got errors with one of the dependencies using v3 NS) with the intermediate profile and Process Blog installed from the admin. Been going through template files and am totally not getting how this works. What I can see is both `site/templates` and `modules/ProcessBlog/template-files` have the template files in them. I can see that the `blog-post.php` file requires `blog-main.inc` at the end. I can see that `blog-main.inc` contains a full HTML page and echoes the `$content` variable in an appropriate place.

What I don't see is `$content` containing the actual content. I also don't see how the template file `blog-post.php` contains a full HTML page, and why it includes a second one as well.

Gotta be missing something here. Sorry for the noob question.

Edit: Sorry, forgot to specify _main.php is the file containing the complete page markup and is being appended to every template, as set in the main config file. I can unset that and only the blog post shows, but of course no styling shows. Of course, I can handle fixing that, but it's screwing with my understanding of the platform having to fix that on a demo setup of PW and the Process Blog. That, at least, should just work, albeit at a very basic level.

Guess I'm just not getting the flow here. Any help appreciated.

Link to comment
Share on other sites

Hi @Bryson.

Welcome to ProcessWire and the forums. Thanks for using Blog.

At the moment, the Blog module is not compatible with version 3 of ProcessWire. Once we have a stable release of PW 3, I'll work on making them play nice together. The missing dependency is Fancybox which has been dropped in PW 3/2.8 in favour of Magnific. 

As for the double/two pages in one, I think you are seeing that because you tried to use one of the site profiles that ship with PW (e.g. default or beginner profiles) together with the demo template files that ship with the Blog module. They will clash. If you want to use one of those profiles, I suggest you copy and paste code from Blog demo template files into the profile's template files. It might be easier though, when installing ProcessWire, to instead use the blank profile. I recommend this to whoever wants to learn from scratch since you are starting off a clean slate. However...

Let's start with the basics first. ProcessWire allows you to build your websites exactly how you want them. This means no one template file approach is forced on you. There are different ways to structure your template files as explained in these tutorials. The template files that come with the Blog module and the code in them are just examples to get you started. They use the so-called delayed output. Of course you can choose to use the examples or even start from scratch. 

What you see in /Blog/template-files/ are its demo template files I refer to above. On install, if you selected to install Blog with the demo content, they are copied over to /site/templates/

Default Name: For security reasons, Blog does not output your name (which is actually your ProcessWire log in name) as the author of Posts. Instead, you need to edit the user and use the Title field to input your author names...e.g. 'Prince Charles'.

Sorry, my answer seems to be a bit jumbled up. Here's what I'd advice you though:

I suggest you get to know how ProcessWire works first by reading the basic docs, especially how to use the API. Using the Blog module to learn about ProcessWire may be a bit advanced for people new to the system. Secondly, have a read about the various templating strategies. You will then be able to tell where $content comes from :-). Finally, if you have some knowledge of PHP, I suggest you install ProcessWire with the blank profile. It will help you learn better IMHO...I know this is not for everyone, but I like starting from a clean slate. You can then use whatever templating strategy you wish.

Let us know if you need further help...

 

 

  • Like 2
Link to comment
Share on other sites

@kongondo Much appreciated. Found my way to the templates style info last night and that cleared the waters a bit. Knew where $content was being set, and why, just threw me because it wasn't outputting (obviously because _main.php was being called after the blog templates). The "demos" I've set up to toy around with probably clouded things for a first look.

As I said, I'm rusty, so after finding those tuts you referenced I started over with the basic install (direct output). Closer to what I'm used to with WP and removes some hurdles. The blank profile sounds like a great option, but also a very large and empty canvas to start with (talk about a mental block). Will definitely go from scratch once I tinker a good bit, like when I start converting some other designs of mine to PW. Actually, got the direct output version installed and immediately started converting it to delayed output. haha

Regarding PW 3, you may have already added this to your list of mods needed for the upgrade, but it worked okay until I tried to view the Posts list in the backend (dashboard, cats, tags, etc. worked). Forget the exact error now, but it was a "format() on null" error. Didn't check the frontend when I saw it so idk what's over on that side, just started over with PW 2.7. Was a gamble anyway (saw the lack of comp. listed).

Thanks for the thoughtful (very) reply.

Link to comment
Share on other sites

  • 2 weeks later...
On 7/26/2016 at 3:40 AM, kongondo said:

At the moment, the Blog module is not compatible with version 3 of ProcessWire. Once we have a stable release of PW 3, I'll work on making them play nice together. The missing dependency is Fancybox which has been dropped in PW 3/2.8 in favour of Magnific. 

 

  • Like 1
Link to comment
Share on other sites

Hi,

Thanks for the great module! I'm currently in the process of moving our old blog to a new PW page, I'm looking forward to use your blog module.

For migrating the old posts, I've encountered one problem: I do not seem to be able to predate the blog posts. As soon as I save the post, the date jumps to todays date. I guess I could change the dates in the database, but it would not be very convenient to do that everytime we need to edit an old post (for example because some links change). 

Is there any way to make the date field "passive" and just take what it is given? :P I hope you can understand my question regardles of my bad English.

 

Thanks!

Link to comment
Share on other sites

  • 1 month later...
41 minutes ago, csaeum said:

After finally the 3.0.35 in a short time finished, I wanted to ask whether now the ProcessBlog is soon available for this too.

Or can you look at the beta or download and report bugs?

It will be available...eventually :-)...I have quite a number of modules to maintain so there has to be a pecking order, I am afraid, and my pro modules come first, naturally. I would appreciate it if users could help me by testing and reporting any bugs in the GitHub repo. For instance, I know we have to switch to magnific. Many thanks.

Link to comment
Share on other sites

to complete uninstall run this:


foreach($fields->find('name%=blog_') as $f) {
	foreach ($f->getFieldgroups() as $fg) $fg->remove($f)->save();
  $fields->delete($f);
}
foreach($templates->find('name%=blog-') as $t) {
  $templates->delete($t);
}
foreach($fieldgroups->find('name%=blog-') as $fg) {
  $fieldgroups->delete($fg);
}
foreach($roles->find('name%=blog-') as $r) {
  $roles->delete($r);
}
//$permissions->delete($permissions->get('name=blog'));

 

Link to comment
Share on other sites

15 hours ago, kongondo said:

It will be available...eventually :-)...I have quite a number of modules to maintain so there has to be a pecking order, I am afraid, and my pro modules come first, naturally. I would appreciate it if users could help me by testing and reporting any bugs in the GitHub repo. For instance, I know we have to switch to magnific. Many thanks.

I should have a pull request for magnific support and to fix some raw markup issues ready tomorrow evening.

  • Like 1
Link to comment
Share on other sites

12 hours ago, hellomoto said:

to complete uninstall run this:



foreach($fields->find('name%=blog_') as $f) {
	foreach ($f->getFieldgroups() as $fg) $fg->remove($f)->save();
  $fields->delete($f);
}
foreach($templates->find('name%=blog-') as $t) {
  $templates->delete($t);
}
foreach($fieldgroups->find('name%=blog-') as $fg) {
  $fieldgroups->delete($fg);
}
foreach($roles->find('name%=blog-') as $r) {
  $roles->delete($r);
}
//$permissions->delete($permissions->get('name=blog'));

 

Your post is misleading (by omission) :). For more than 2 years now Blog module has shipped with its own 'clean up utility' hence no need for such manual intervention unless one didn't follow the explicit uninstall instructions

Link to comment
Share on other sites

12 hours ago, BitPoet said:

I should have a pull request for magnific support and to fix some raw markup issues ready tomorrow evening.

Thanks. I'll appreciate some backward compatibility though (i.e. I will not be namespacing any of my modules but will let the compiler do its work)...

Link to comment
Share on other sites

Hello everyone.  First off I am totally new to PW and if I am sincere to program, I was assigned PW like a little project on my studies but I love it.
I wanted to start a blog but I get an error I dont' quite understand. When I try to enter to post in the blog section from the admin panel. I get this error:

Quote

 

Error: Call to a member function count() on a non-object (line 1355 of /var/www/virtual/iesceliaciclos.org/htdocs/antonioibanez/processwire/site/modules/MarkupBlog/ProcessBlog.module) 

This error message was shown because: you are logged in as a Superuser. Error has been logged. 


 

 

The other items of the submenu are ok and I don't receive any error bt there yes. I have the last version of PW.

Link to comment
Share on other sites

@antoiba86: Welcome to the ProcessWire forums! Are you using ProcessWire 3.x?

I'm currently working on making the blog module compatible with the latest PW versions, and I also encountered this error. It is caused by something that goes wrong in the install routine, which fails to assign the blog_files field to its template. I'm working on it and have an idea about its cause, but I haven't tracked it down completely, and there are a few other issues (mainly the switch to jQuery magnific popups) I'm working on as well since a lot has changed under PW's hood.

The blog module should work on PW 2.7, though, which is also linked on the download page, so setting up your blog site on 2.7 and upgrading everything once the blog module has been adapted and tested on 3.x (give that a week or two) might be an option.

  • Like 2
Link to comment
Share on other sites

1 hour ago, BitPoet said:

@antoiba86: Welcome to the ProcessWire forums! Are you using ProcessWire 3.x?

I'm currently working on making the blog module compatible with the latest PW versions, and I also encountered this error. It is caused by something that goes wrong in the install routine, which fails to assign the blog_files field to its template. I'm working on it and have an idea about its cause, but I haven't tracked it down completely, and there are a few other issues (mainly the switch to jQuery magnific popups) I'm working on as well since a lot has changed under PW's hood.

The blog module should work on PW 2.7, though, which is also linked on the download page, so setting up your blog site on 2.7 and upgrading everything once the blog module has been adapted and tested on 3.x (give that a week or two) might be an option.

Thank you for your reply. But can I downgrade PW without problem? I have the ProcessWire 3.0.35 so I don't know but I would like to try the blog.

Link to comment
Share on other sites

@antoiba86: I don't think downgrading is really an option. But I've already got the magnific and markup issues sorted and am working on the issue with the blog_files field, so a 3.0-compatible version is around the corner.

@kongondo: as I've got a few sites running on 2.8, I try to stay clear of namespaces anyway :)

  • Like 4
Link to comment
Share on other sites

Quick update: it turned out that the problem of blog_files not being added to the template is due to $this->files somehow having become a reserved variable. It holds an instance of WireLog instead of the blog_files field created earlier, though I haven't spotted the part in the core where this happens yet. However, changing $this->files to $this->blogfiles fixed the problem. I'm now going to run some tests. Stay tuned.

  • Like 3
Link to comment
Share on other sites

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

Edit: Link removed since my changes have been merged into the official module. Please keep on walking, there's nothing to see here... ;)

  • Like 4
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 Robin S
      This module lets you add some custom menu items to the main admin menu, and you can set the dropdown links dynamically in a hook if needed.
      Sidenote: the module config uses some repeatable/sortable rows for the child link settings, similar to the ProFields Table interface. The data gets saved as JSON in a hidden textarea field. Might be interesting to other module developers?
      Custom Admin Menus
      Adds up to three custom menu items with optional dropdowns to the main admin menu.
      The menu items can link to admin pages, front-end pages, or pages on external websites.
      The links can be set to open in a new browser tab, and child links in the dropdown can be given an icon.
      Requires ProcessWire v3.0.178 or newer.
      Screenshots
      Example of menu items

      Module config for the menus

      Link list shown when parent menu item is not given a URL

      Advanced
      Setting child menu items dynamically
      If needed you can set the child menu items dynamically using a hook.
      Example:
      $wire->addHookAfter('CustomAdminMenus::getMenuChildren', function(HookEvent $event) { // The menu number is the first argument $menu_number = $event->arguments(0); if($menu_number === 1) { $colours = $event->wire()->pages->findRaw('template=colour', ['title', 'url', 'page_icon']); $children = []; foreach($colours as $colour) { // Each child item should be an array with the following keys $children[] = [ 'icon' => $colour['page_icon'], 'label' => $colour['title'], 'url' => $colour['url'], 'newtab' => false, ]; } $event->return = $children; } }); Create multiple levels of flyout menus
      It's also possible to create multiple levels of flyout submenus using a hook.

      For each level a submenu can be defined in a "children" item. Example:
      $wire->addHookAfter('CustomAdminMenus::getMenuChildren', function(HookEvent $event) { // The menu number is the first argument $menu_number = $event->arguments(0); if($menu_number === 1) { $children = [ [ 'icon' => 'adjust', 'label' => 'One', 'url' => '/one/', 'newtab' => false, ], [ 'icon' => 'anchor', 'label' => 'Two', 'url' => '/two/', 'newtab' => false, 'children' => [ [ 'icon' => 'child', 'label' => 'Red', 'url' => '/red/', 'newtab' => false, ], [ 'icon' => 'bullhorn', 'label' => 'Green', 'url' => '/green/', 'newtab' => false, 'children' => [ [ 'icon' => 'wifi', 'label' => 'Small', 'url' => '/small/', 'newtab' => true, ], [ 'icon' => 'codepen', 'label' => 'Medium', 'url' => '/medium/', 'newtab' => false, ], [ 'icon' => 'cogs', 'label' => 'Large', 'url' => '/large/', 'newtab' => false, ], ] ], [ 'icon' => 'futbol-o', 'label' => 'Blue', 'url' => '/blue/', 'newtab' => true, ], ] ], [ 'icon' => 'hand-o-left', 'label' => 'Three', 'url' => '/three/', 'newtab' => false, ], ]; $event->return = $children; } }); Showing/hiding menus according to user role
      You can determine which menu items can be seen by a role by checking the user's role in the hook.
      For example, if a user has or lacks a role you could include different child menu items in the hook return value. Or if you want to conditionally hide a custom menu altogether you can set the return value to false. Example:
      $wire->addHookAfter('CustomAdminMenus::getMenuChildren', function(HookEvent $event) { // The menu number is the first argument $menu_number = $event->arguments(0); $user = $event->wire()->user; // For custom menu number 1... if($menu_number === 1) { // ...if user does not have some particular role... if(!$user->hasRole('foo')) { // ...do not show the menu $event->return = false; } } });  
      https://github.com/Toutouwai/CustomAdminMenus
      https://processwire.com/modules/custom-admin-menus/
    • By tcnet
      This module for ProcessWire sends a notification email for each failed login attempt. Similar modules exists already in the module directory of ProcessWire. However, this module is designed to notify, even if specified user doesn't exist.
      Settings
      The settings for this module are located in the menu Modules=>Configure=>LoginFailNotifier.
      Notification email
      Specifies the email address to which the notification emails should be sent.
        Email subject
      Specifies the subject line for the notification email.
        Post variables
      Specifies the $_POST variables to be included in the notification email. Each variable must be separated by a comma. For example: login_name,login_pass
        Server variables
      Specifies the $_SERVER variables to be included in the notification email. Each variable must be separated by a comma. For example: REMOTE_ADDR,HTTP_USER_AGENT
      Link to ProcessWire module directory:
      https://processwire.com/modules/login-fail-notifier/
      Link to github.com:
      https://github.com/techcnet/LoginFailNotifier
    • By Fokke
      ProcessWire 3.x markup module for rendering meta tags in HTML document head section. Note that this module is not a full-blown SEO solution, but rather a simple tool for rendering meta tags based on module configuration. Adding custom meta tags is also supported.
      Built-in meta tags
      The following meta tags are supported out-of-the-box:
      Document title consisting of page title and site name Character set Canonical Viewport Description Keywords Hreflang tags Open Graph og:title og:site_name og:type og:url og:description og:image og:image:width og:image:height Twitter meta tags twitter:card twitter:site twitter:creator twitter:title twitter:description twitter:image Facebook meta tags fb:app_id The full documentation with configurable options can be found here: https://github.com/Fokke-/MarkupMetadata
       
      Requirements:
      ProcessWire>=3.0.0 PHP >=7.1 Installation using Composer
      composer require fokke/markup-metadata Manual installation
      Download latest version from https://github.com/Fokke-/MarkupMetadata/archive/master.zip Extract module files to site/modules/MarkupMetadata directory.
    • By m.sieber
      ITRK-Service for ProcessWire
      Module for the automated transfer of imprint, data protection declaration and terms and conditions from IT-Recht Kanzlei to your ProcessWire installation
      What is ITRK Service for ProcessWire?
      ITRK-Service for ProcessWire is a free module for ProcessWire CMS. It provides an interface to the update service of IT-Recht Kanzlei, via which the legal texts of your online presence are automatically updated. In this way, the texts remain legally secure and warning-proof in the long term. Imprint, data protection declaration, revocation and general terms and conditions are currently supported.
      You can find our documentation (in german language) here: https://www.pupit.de/itrk-service-for-processwire/dokumentation/

      Download: https://www.pupit.de/itrk-service-for-processwire/
      Github: https://github.com/pupit-de/pwItrkServiceConnector
    • By LuisM
      Symprowire is a PHP MVC Framework based and built on Symfony using ProcessWire 3.x as DBAL and Service-Provider
      It acts as a Drop-In Replacement Module to handle the Request/Response outside the ProcessWire Admin. Even tough Symfony or any other mature MVC Framework could be intimidating at first, Symprowire tries to abstract Configuration and Symfony Internals away as much as possible to give you a quick start and lift the heavy work for you.
      The main Goal is to give an easy path to follow an MVC Approach during development with ProcessWire and open up the available eco-system.
      You can find the GitHub Repo and more Information here: https://github.com/Luis85/symprowire
      Documentation
      The Symprowire Wiki https://github.com/Luis85/symprowire/wiki How to create a simple Blog with Symprowire https://github.com/Luis85/symprowire/wiki/Symprowire-Blog-Tutorial Last Update
      16.07.2021 // RC 1 v0.6.0 centralized ProcessWire access trough out the Application by wrapping to a Service https://github.com/Luis85/symprowire/releases/tag/v0.6.0-rc-1 Requirements
      PHP ^7.4 Fresh ProcessWire ^3.0.181 with a Blank Profile Composer 2 (v1 should work, not recommended) The usual Symfony Requirements Features
      Twig Dependency Injection Monolog for Symprowire Support for .env YAML Configuration Symfony Console and Console Commands Symfony Webprofiler Full ProcessWire access inside your Controller and Services Webpack Encore support Caveats
      Symfony is no small Framework and will come with a price in terms of Memory Usage and added Overhead. To give you a taste I installed Tracy Debugger alongside to compare ProcessWire profiling with the included Symfony Webprofiler

      So in a fresh install Symprowire would atleast add another 2MB of Memory usage and around 40ms in response time, should be less in production due to the added overhead of the Webprofiler in dev env
       
×
×
  • Create New...