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

Share this post


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.

Share this post


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

Share this post


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 :-).

Share this post


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

Share this post


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. 

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

Good idea, ta. I'll have to link to the image from somewhere (maybe Github or my site) since we can't add images to modules directory

Share this post


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)

Share this post


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! :)

Share this post


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

Share this post


Link to post
Share on other sites

Hi @Kongondo,

I just knew you'd have a "secret" answer :)

Cheers!

Share this 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!

Share this post


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!

Share this post


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.

Share this post


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

Share this post


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

Share this post


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:

Share this post


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

Share this post


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.

Share this post


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

Share this post


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...

Share this post


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. 

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 MoritzLost
      This is a new module that provides a simple solution to clearing all your cache layers at once, and an extensible interface to perform various cache-related actions.
      The simple motivation behind this module was that I was tired of manually clearing caches in several places after deploying a change on a live site. The basic purpose of this module is a simple Clear all caches link in the Setup menu which clears out all caches, no matter where they hide. You can customize what exactly the module does through it's configuration menu:
      Expire or delete all cache entries in the database, or selectively clear caches by namespace ($cache API) Clear the the template render cache. Clear out specific folders inside your site's cache directory (/site/assets/cache) Refresh version strings for static assets to bust client-side browser caches (this requires some setup, see the full documentation for details). This is the basic function of the module. However, you can also add different cache management action through the API and execute them through the module's interface. For this advanced usage, the module provides:
      An interface to see all available cache actions and execute them. A system log and logging output on the module page to see verify what the module is doing. A CacheControlTools class with utility functions to clear out different caches. An API to add cache actions, execute them programmatically and even modify the default action. Permission management, allowing you granular control over which user roles can execute which actions. The complete documentation can be found in the module's README.
      Beta release
      Note that I consider this a Beta release. Since the module is relatively aggressive in deleting some caches, I would advise you to install in on a test environment before using it on a live site.
      Let me know if you're getting any errors, have trouble using the module or if you have suggestions for improvement!
      In particular, can someone let me know if this module causes any problems with the ProCache module? I don't own or use it, so I can't check. As far as I can tell, ProCache uses a folder inside the cache directory to cache static pages, so my module should be able to clear the ProCache site cache as well, I'd appreciate it if someone can test that for me.
      Future plans
      If there is some interest in this, I plan to expand this to a more general cache management solution. I particular, I would like to add additional cache actions. Some ideas that came to mind:
      Warming up the template render cache for publicly accessible pages. Removing all active user sessions. Let me know if you have more suggestions!
      Links
      https://github.com/MoritzLost/ProcessCacheControl ProcessCacheControl in the Module directory

    • By joshua
      This module is (yet another) way for implementing a cookie management solution.
      Of course there are several other possibilities:
      - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/
      - https://github.com/webmanufaktur/CookieManagementBanner
      - https://github.com/johannesdachsel/cookiemonster
      - https://www.oiljs.org/
      - ... and so on ...
      In this module you can configure which kind of cookie categories you want to manage:

      You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience.
      Currently there are four possible cookie groups:
      - Necessary (always enabled)
      - Statistics
      - Marketing
      - External Media
      All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ...
      When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax:
      <script type="optin" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="optin" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The type has to be "optin" to get recognized by PrivacyWire, the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision.
      If you want to give the users the possibility to change their consent, you can use the following Textformatter:
      [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie.
      You can also add a custom link to output the banner again with a link / button with following class:
      <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> This module is still in development, but we already use it on several production websites.
      You find it here: https://github.com/blaueQuelle/privacywire/tree/master
      Download: https://github.com/blaueQuelle/privacywire/archive/master.zip
      I would love to hear your feedback 🙂
      Edit: Updated URLs to master tree of git repo
       
    • By David Karich
      Admin Page Tree Multiple Sorting
      ClassName: ProcessPageListMultipleSorting
      Extend the ordinary sort of children of a template in the admin page tree with multiple properties. For each template, you can define your own rule. Write each template (template-name) in a row, followed by a colon and then the additional field names for sorting.
      Example: All children of the template "blog" to be sorted in descending order according to the date of creation, then descending by modification date, and then by title. Type:
      blog: -created, -modified, title  Installation
      Copy the files for this module to /site/modules/ProcessPageListMultipleSorting/ In admin: Modules > Check for new modules. Install Module "Admin Page Tree Multible Sorting". Alternative in ProcessWire 2.4+
      Login to ProcessWire backend and go to Modules Click tab "New" and enter Module Class Name: "ProcessPageListMultipleSorting" Click "Download and Install"   Compatibility   I have currently tested the module only under PW 2.6+, but think that it works on older versions too. Maybe someone can give a feedback.     Download   PW-Repo: http://modules.processwire.com/modules/process-page-list-multiple-sorting/ GitHub: https://github.com/FlipZoomMedia/Processwire-ProcessPageListMultipleSorting     I hope someone can use the module. Have fun and best regards, David
    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "https://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


×
×
  • Create New...