Jump to content

Recommended Posts

Not directly, its not. But with a custom script it is possible; something to tell Blog about the IDs of your comment related pages and that comments feature is enabled.

Alternatively, if you know what you are doing and TESTING on a development server first, you can directly edit the necessary values in your database using a programme like phpMyAdmin. The code below is from a fully installed blog, in the PW db table 'modules' and the row 'ProcessBlog'. It tells you what is going on.

{"blogFullyInstalled":1,"blogStyle":1,"schedulePages":0,"commentsUse":1,"templateFilesInstall":2,"tagTemplatesFields":"blog","blog":2480,"blog-posts":2481,"blog-categories":2482,"blog-tags":2483,"blog-comments":2484,"blog-widgets":2485,"blog-authors":2486,"blog-archives":2487,"blog-settings":5190,"blog-asc":4017,"blog-dnc":4018,"blog-dc":4019,"blog-rposts":2491,"blog-rcomments":2492,"blog-broll":2493,"blog-tweets":2495,"blog-pauthor":4015}

In your case, you would first need to create the four comments pages and note down their IDs.

blog-comments":2484" - comments (parent of below three)

blog-asc":4017, - always show comments

"blog-dnc":4018, - disable new comments

"blog-dc":4019 - disable comments

There is also the recent comments page to install under widgets.

blog-rcomments":2492

You would also have to create the necessary fields that go with those pages as in a full blog install. 

Then it would be a matter of simply adding the above key/value pairs that have the IDs of your newly created comment page. This would be faster than writing a custom PHP script :-)

You would also need to change this:

"commentsUse":1, in your case the value is '0' - it would need to be changed to '1'

It is not as complicated as it sounds but like I said, you would need to try and thoroughly test on a development install first! If you want to go this route (rather than install afresh), I suggest you fully install blog on a test server and compare the above db values to your current install that's missing the comments feature as well as compare their respective Blog Pages tree....I think that's it really...

  • Like 1
Link to post
Share on other sites

@ kongondo: Thank you for your fast reply.

I will try it out but I am considering making a fresh install because its a new blog with still a couple of artikels. The neccesarry testing should take up at least the same amount of work.

Link to post
Share on other sites

@ kongondo

I’ve been playing around with processblog for a week and uninstalled etc etc.

I finally found out a few things that are going wrong during the install:

1. The processwire install uses this file structure for the default template:

errors
scripts
styles

2. But when installed the source shows:

<link rel="stylesheet" href="/pw/site/templates/css/pocketgrid.css" /><!-- The PocketGrid -->

<link rel="stylesheet" href="/pw/site/templates/css/blog.css" /><!-- Custom Styles -->
 

This means these css files are never accessed. If I copy them manually they work, sort of. My blog looks nothing like the screenshort consisting of only 1 column etc.

Ive installed and re installed in different directories etc, but it makes no difference. I've manually created the css directories and copied the files over into the tempaltes directory which changes some of hte colours/formatting but it's clearly not picking up all the files it needs.

How can I install processblog into processwire to make sure it works?

I can only think that the blog.js etc files aren't being referenced?

tia

Link to post
Share on other sites

Hi @loopyloo. 

Welcome to the forums and thanks for trying out Blog.

If you want to install Blog with the demo content, you have to manually copy over those two CSS files and the blog.js file to some folder in your /site/templates/. If your paths are different, you would have to change them in 'blog-main.inc'. Check in Firebug/Chrome Developer that the files are actually being loaded. In case you missed it, let me also reiterate that the demo Blog is just that - a demo; you will probably want to change it here and there to suit your needs :-).

Link to post
Share on other sites

Hi,

This is a default 2.5.2 processwire install so I havent changed my paths...

So just to be clear I have to change all the referenced files in blog-main.inc before installing ProcessBlog? Or can I change them after? Should blog-main.inc be in the site/templates folder as it's not there in my installation

tia.
 

Edit:

I have reinstalled and can see the blog but the formatting/layout is incorrect. I've moved:

css/pocketgrid.css

css/blog.css

js/blog.js

into site/templates
post-2987-0-43859700-1420031901_thumb.jp

Link to post
Share on other sites

After (but only if necessary - see below). As outlined in the must README :-)

  • If you chose to install the demo Template Files, also manually copy over the /css/ and /js/ folders present in Blog module's folder to your /site/templates/ folder.

+ You have to manually copy over the files CSS + JS files. If you don't copy them to /site/templates/css/ and /site/templates/js/ then, you have to amend the links in blog-main.inc (e.g. you could have copied them to /site/templates/styles/ and /site/templates/scripts/ respectively. 

Have you confirmed that the files are being loaded in the browser. If your answer is yes, then the problem I suspect is that the default PW install _init.php and/or _main.php files are interfering with the rendering. It has happened to me before :-). I always use the PW blank install so I don't tend to notice this much. 

If blog-main.inc wasn't copied to over to /site/templates/ it means you did not install Blog with demo content :-)

Maybe send some screenshots of your settings when you initially set up blog (step 1 in the module config) + what your frontend looks like. 

Link to post
Share on other sites

HI,

I was literally about to post the same thing, this second.

Here is what has happened if anyone else is experiencing this issue:

1. Install XAMMP on windows

2. Install bitnami processwire. Here is where we have the first problem. The bitnami processwire install does NOT allow you to choose which site template and installs the intermediate site template by default. You CANNOT choose an empty site.

3. If you do a manual install of processwire you can install a blank site.

4. When you install processblog, copy over the CSS and JS folders, or edit the blog-main.inc to point to the where you have copied the new files.

5. Edit EACH template file in the BLOG section (Admin > Setup > templates > files >

tick the checkbox " Disable automatic append of file: _main.php"

then the blog will work.

6. To make things additionally confusing (to a beginner) :-) the intermediate site template has home/about links as does the blog and the blog jumps back to the main site intermediate template.  The home / about / links are completely different.

To reiterate, the Bitnami processwire install does not allow a blank site template.

 

post-2987-0-27032000-1420033150_thumb.jp

  • Like 1
Link to post
Share on other sites

Good detective work...Just to reiterate:

1. This is about Blog AND Demo content

2. If one wishes, they can use the _main.php with Blog Demo files but they would have to set that up themselves... (I should do a tutorial about this)

:D

Link to post
Share on other sites

No problem, Just took me a week to figure out what was going on. When I did a manual install I noticed I could choose site template whereas the Bitnami processwire installer didn't.

What would be really helpful is if in the ProcessBlog page on the module download ...

http://modules.processwire.com/modules/process-blog/

...you put a screenshot of what the blog should look like. (eg above picture in post) I could not figure out what the blog was supposed to look like so kept modifying things trying to get it to work. If i had an image to refer to I would have known straight away something was wrong.  To those familiar with processwire/css/php it would have been apparent but I am completely new to processwire :-)

thanks

Link to post
Share on other sites

Thanks for the help! I think processwire is great and your blog is a great step as it saves so much work.

Oh also may be a good idea to add it to the first screenshot in this forum section as you have the admin pages but not what it looks like at the front end.

I know the video has a finished site (last link), but it wasn't clear what a default site would look like)

Link to post
Share on other sites

Hi @Kongondo,

Happy New Year to everyone!

When using renderPosts with "small" set true, the text that is output takes any headings in the post (h2's in my case), strips the h2 elements, leaving the rendered h2's innerText in-line with the body copy.

The headings are not meant to be read in-line and as a result, what is output in the summary rendering doesn't read very well. 

As everything is output in a single paragraph, I guess I need to have the headings completely stripped out of the copy. I can't believe this hasn't happened before - any thoughts, recommendations?

Cheers! :)

Link to post
Share on other sites

@Gazley,
 
Yes, it has happened before and we've dealt with it as shown here using 'post_small_allowable_tags'. Specify and configure that as you wish in your renderPosts() third argument $options.

//holds string of HTML tags for strip_tags $allowable_tags. Needs to be in format '<code><p><img>'
$options = array('post_small_allowable_tags' => '<h2><img>',//etc..);

Sorry, still haven't gotten round to updating the docs! So, that post #207 is your go to post :-)

Link to post
Share on other sites

Hi @Kongondo,

Just a heads-up, I'm noticing that the markup returned by renderPost "small" returns an uneven set of <p> elements. In my case, the markup encounters a ... </p> which is followed later on by <p> .... </p>.

I noticed this by passing the code into a DOM parser that was choking on the uneven elements.

Can you confirm you see this too?

Cheers!

Link to post
Share on other sites

Hi @Kongondo,

Sorry my previous post was a "red-herring". The <p> were balanced. The problem is that now I am allowing 'h2' elements through, the blog markup code is wrapping the 'h2' element pairs in 'p' tags which is in-turn causing the DOM parser to choke.

I assume that from the HTML DOM perspective, you cannot have a heading element inside a paragraph element?

Cheers!

Link to post
Share on other sites

Hi @Kongondo,

This appears to be a slightly more tricky problem than originally anticipated. I thought I had a workaround to the issue by stripping out the embedded 'h2' elements from inside the paragraphs and replacing them with an empty string. This worked until I tested with different posts with differing text and headers. I ended up hitting the same issue again with the DOM parser choking because the post truncating code that makes the post "small" did not take account of the need for a closing 'h2' element and inadvertently trims the small post string with a now malformed 'h2' element (it has a <h2> but no </h2>). This means that my parsing RegExp fails because it aims to replace <h2>...</h2> and of course, the </h2> may have been trimmed by "smallification". In any event, I'm still left with a paragraph that contains an <h2> that isn't closed which I still incorrectly formed HTML.

I hope this makes sense! :)

Cheers.

Link to post
Share on other sites

@Gazley,
 
Yes, you are right about what elements can be nested in what. Thanks for helping me rethink this.
 
For the benefit of others, below is a lengthy explanation + the solution I propose (you can skip right to it :-))
 

HTML does not allow nesting of <p> (or other block level elements):
Because a paragraph is a paragraph .. and that's how HTML is defined (and HTML is not XML).
Any <p> (or other block-level element) will implicitly close any open <p>.
Per 9.3.1 Paragraphs: the P element of the HTML 4.01 specification:
The P element represents a paragraph. It cannot contain block-level elements (including P itself).

 
Resources:
http://www.w3.org/TR/html401/struct/text.html#h-9.3.1
http://stackoverflow.com/questions/12015804/nesting-p-wont-work-while-nesting-div-will
http://ckeditor.com/forums/Support/Nested-paragraph-tags.
http://webtips.dan.info/nesting.html - old but good
http://www.iamchristinabot.com/blog/20110519/why-do-nested-html-paragraphs-break-css/
http://stackoverflow.com/questions/4291467/nesting-block-level-elements-inside-the-p-tag-right-or-wrong
 
Explanation:
First the code in MarkupBlog.module

//MarkupBlog Line #933
//notice the surrounding '<p></p>' tags
if($small) $out .= "<p>" . $page->summary . "… <a class='more' href='{$page->url}'>" . $options['post_more_text'] . "</a></p>";

In your template file e.g. 'blog-posts.php', assuming you have this code:

$options = array(
   'post_small_image' => 3,//here for array illustration only
   'post_small_image_width' => 250,//ditto
   'post_small_allowable_tags' => '<h2>',  
);

//render a limited number of summarised posts
$content .= $blog->renderPosts("limit=5", true, $options);//passed $options to renderPosts()

Example content entered in your 'blog_body'

<p>This is my paragraph that I am going to test.</p>
<p>Here comes a second paragraph.</p>
<h2>And here comes a h2 we will allow through.</h2>
<p>This is another paragraph.</p>
<p>Our final paragraph.</p>
<h2>A second h2 to allow.</h2>

1. Output without 'post_small_allowable_tags'

<p>This is my paragraph that I am going to test. Here comes a second paragraph. And here comes a h2 we will allow through. This is another paragraph. Our final paragraph. A second h2 to allow</p>

2. Output with 'post_small_allowable_tags'
In the second output, since you have allowed <h2> (it doesn't matter whether they came first or in-between other text in your content), this is what line #933 will send to the browser:

<p>.....<h2>........</h2>..........<h2>........</h2>..</p>;

As stated, that is invalid code and the browser will remedy it. The next block level element will be used to close the first <p> or the browser will self-close it (empty <p></p>). So, what you will end up with in the browser is:

<p></p><h2>....</h2>some free untagged text<h2>....</h2></p>.

Although the browser (view source) will seemingly also place an empty <p></p> at the end of the text, in fact, it will just be a closing </p> without an opening <p>. The W3C validator will then give you the error 'No p element in scope but a p end tag seen.'
 
For comparison, if you allowed an inline element, e.g. <img> tag instead

$options = array('post_small_allowable_tags' => '<img>');

This would be output correctly since an <img> is an inline element. The output would be:

<p>Some text<img>More text<a>Read More</a></p>.

Hopefully this long explanation will help inform decisions about how to use the solution I envisage.
 
Solution
I will make what HTML element (or not) to surround a blog excerpt (blop post small) with configurable (add to $options). So:

  • Let user decide whether to surround post excerpt with <span>,<p>, nothing, etc. since they know what tags they will be making 'allowable' (inline vs block level).
  • The option will apply whether using 'post_small_allowable_tags' or not.
  • Default will be to surround with <p>.
  • An empty value passed to the option will mean 'do not surround the excerpt with anything'.
  • I will also add a class to that tag, e.g. <p class='post-excerpt'>...</p> to aid with more specific style-targeting.

Hope to update this soon. The update should not break any existing installs since it will default to the current use of <p></p> tags.

  • Like 2
Link to post
Share on other sites

Hi kongondo, thank you for the awesome module!
 
I have just installed the module on a site I am currently developing and am now getting an issue when I go to the blog control panel I get the following error:
 
FieldtypeComments: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'field_blog_comments_votes' already exists

There was another error stating that field_blog_comments did not exist when I first went to the blog control panel but that one has cleared and the table does exist.

But I can't seem to figure what is the issue with this error. Have tried removing and uninstalling and then re-installing to no avail.

Any help would be greatly appreciated.

Many Thanks,

Alex

Link to post
Share on other sites

Hi Alex,

Thanks for trying out Blog.

Most likely you are hitting the limits of xdebug.max_nesting_level=100; so the Blog wizard is not completing the installation.

Please check out these posts to see if they resolve your issue:

Link to post
Share on other sites

Thank you for the reply! Much appreciated.

So I did a cleanup, then removed field_blog_comments_votes which didn't get deleted from the DB and then did an uninstall of the blog module, then increased the limit of xdebug.max_nesting_level to 200 in php.ini and then tried a re-install and got the same/similar issues at the same point. Have attached a screenshot if you get chance to take a look.

Sorry for the trouble.

post-2189-0-97678900-1420507724_thumb.pn

Link to post
Share on other sites

Thank you for the reply! Much appreciated.

So I did a cleanup, then removed field_blog_comments_votes which didn't get deleted from the DB and then did an uninstall of the blog module, then increased the limit of xdebug.max_nesting_level to 200 in php.ini and then tried a re-install and got the same/similar issues at the same point. Have attached a screenshot if you get chance to take a look.

Sorry for the trouble.

Yeah i had those issues, What i did was usually use ProcessMigrator and revert or delete those fields using ProcessBatcher as deleting one by one takes time.

Link to post
Share on other sites

Yea I didn't need to use the batcher because there was only 1 table not removed from the DB. All fields were removed fine.

Just need to try and figure out what is up with these errors at my post above now

Link to post
Share on other sites

@Alex,

I am wondering whether it is because of this? field_blog_comments_votes. This is the latest comments module. I haven't tried it out with Blog and seems like I should. The error suggests it has something to do with it (i.e. it is not being uninstalled, I think). Have you confirmed in your db that the field is actually removed before trying to reinstall Blog? Same goes for the other tables. Meanwhile I'll find some time to try out Blog with the latest comments module...

Link to post
Share on other sites

Yea each time the field sticks in the DB so I manually remove it before trying again.

Have just tried re-installing again now but it's all gone mental now and am getting about 28 or so errors now. Ahhhhh. 

Dunno what's happening. Haha. 

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 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 !)
      Github: https://github.com/romaincazier/FieldtypeQRCode
      Modules directory: https://processwire.com/modules/fieldtype-qrcode/
      This is a simple module I made so a client could quickly grab a QR Code of the page's url in the admin.
      There's not much to it for now, but if need be you can output anything using a hook:
      $wire->addHookAfter("FieldtypeQRCode::getQRText", function($event) { $event->return = "Your custom text"; }) You can also output the QR code on your front-end by calling the field:
      echo $page->qr_code_field; The module uses the PHP library QR Code Generator by Kazuhiko Arase. When looking for a way to generate a QR Code in PW I came across @ryan's integration in his TFA module. I'm not very familiar with fieldtype/inputfield module development so I blindly followed @bernhard (great) tutorial and his BaseFieldtypeRuntime. At some point I'll take a deeper look to make a module on my own.
      Some ideas for improvements :
      add the ability to choose what to ouput : page's url / editUrl / file(s) / image(s) / ... allow to output multiple QR codes ?
    • By Chris Bennett
      https://github.com/chrisbennett-Bene/AdminThemeTweaker
      Inspired by @bernhard's excellent work on the new customisable LESS CSS getting rolled into the core soon, I thought I would offer up the module for beta testing, if it is of interest to anyone.

      It takes a different approach to admin styling, basically using the Cascade part of CSS to over-ride default UiKit values.
      Values are stored in ModuleConfig Module creates a separate AdminThemeTweaker Folder at root, so it can link to AdminThemeTweaker.php as CSS AdminThemeTweaker.php reads the module values, constructs the CSS variables then includes the CSS framework Can be switched on and off with a click. Uninstall removes everything, thanks to bernhard's wonderful remove dir & contents function.
      It won't touch your core. It won't care if stuff is upgraded. You won't need to compile anything and you don't need to touch CSS unless you want to.

      It won't do much at all apart from read some values from your module config, work out the right CSS variables to use (auto contrast based on selected backgrounds) and throw it on your screen.
      You can configure a lot of stuff, leave it as it comes (dark and curvy), change two main colors (background and content background) or delve deep to configure custom margins, height of mastheads, and all manner of silly stuff I never use.

      Have been developing it for somewhere around 2 years now. It has been (and will continue to be) constantly tweaked over that time, as I click on something and find something else to do.
      That said, it is pretty solid and has been in constant use as my sole Admin styling option for all of those 2 years.

      If nothing else, it would be great if it can provide any assistance to @bernhard or other contributor's who may be looking to solve some of the quirkier UiKit behavior.
      Has (in my opinion) more robust and predictable handling of hidden Inputfields, data-colwidths and showIf wrappers.
      I am very keen to help out with that stuff in any way I can, though LESS (and any css frameworks/tools basically) are not my go.
      I love CSS variables and banging-rocks-together, no-dependency CSS you can write with notepad.



       

    • By opalepatrick
      I see old posts saying that repeaters are not the way to go in Custom Process Modules. If that is the case, when using forms (as I am trying to do) how would one tackle things like repeat contact fields where there can be multiple requirements for contact details with different parameters? (Like point of contact, director, etc) or even telephone numbers that have different uses?
      Just for background I am creating a process module that allows me to create types of financial applications in the admin area (no need to publish any of this, pure admin) that require a lot of personal or company information.
      Maybe I am thinking about this incorrectly?
    • By HMCB
      I ran across a reference to IftRunner module. The post was 6 years ago. I cant find it in available modules. Has it been pulled?
    • By tcnet
      PageViewStatistic for ProcessWire is a module to log page visits of the CMS. The records including some basic information like IP-address, browser, operating system, requested page and originate page. Please note that this module doesn't claim to be the best or most accurate.
      Advantages
      One of the biggest advantage is that this module doesn't require any external service like Google Analytics or similar. You don't have to modify your templates either. There is also no Javascript or image required.
      Disadvantages
      There is only one disadvantage. This module doesn't record visits if the browser loads the page from its browser cache. To prevent the browser from loading the page from its cache, add the following meta tags to the header of your page:
      <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> How to use
      The records can be accessed via the Setup-menu of the CMS backend. The first dropdown control changes the view mode.

      Detailed records
      View mode "Detailed records" shows all visits of the selected day individually with IP-address, browser, operating system, requested page and originate page. Click the update button to see new added records.

      Cached visitor records
      View modes other than "Detailed records" are cached visitor counts which will be collected on a daily basis from the detailed records. This procedure ensures a faster display even with a large number of data records. Another advantage is that the detailed records can be deleted while the cache remains. The cache can be updated manually or automatically in a specified time period. Multiple visits from the same IP address on the same day are counted as a single visitor.

      Upgrade from older versions
      Cached visitor counts is new in version 1.0.8. If you just upgraded from an older version you might expire a delay or even an error 500 if you display cached visitor counts. The reason for this is that the cache has to be created from the records. This can take longer if your database contains many records. Sometimes it might hit the maximally execution time. Don't worry about that and keep reloading the page until the cache is completely created.
      Special Feature
      PageViewStatistic for ProcessWire can record the time a visitor viewed the page. This feature is deactivated by default. To activate open the module configuration page and activate "Record view time". If activated you will find a new column "S." in the records which means the time of view in seconds. With every page request, a Javascript code is inserted directly after the <body> tag. Every time the visitor switches to another tab or closes the tab, this script reports the number of seconds the tab was visible. The initial page request is recorded only as a hyphen (-).

      Settings
      You can access the module settings by clicking the Configuration button at the bottom of the records page. The settings page is also available in the menu: Modules->Configure->ProcessPageViewStat.
      IP2Location
      This module uses the IP2Location database from: http://www.ip2location.com. This database is required to obtain the country from the IP address. IP2Location updates this database at the begin of every month. The settings of ProcessPageViewStat offers the ability to automatically download the database monthly. Please note, that automatically download will not work if your webspace doesn't allow allow_url_fopen.
      Dragscroll
      This module uses DragScroll. A JavaScript available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability in view mode "Day" to drag the records horizontally with the mouse pointer.
      parseUserAgentStringClass
      This module uses the PHP class parseUserAgentStringClass available from: http://www.toms-world.org/blog/parseuseragentstring/. This class is required to filter out the browser type and operating system from the server request.
×
×
  • Create New...