Jump to content

Recommended Posts

Blog 2 is now on dev branch of the project page on GitHub. I have edited post #123 and #124 with links to this effect. 

Version 2.0.1 is coming out soon. I picked up on some broken Markup bugs whilst testing the other day as well as some output redundancy...

Share this post


Link to post
Share on other sites

Clicking 'Like' is not enough. V2 is brilliant - being able to choose the url structure is an absolute killer, and (for me, anyway) being able to not have comments at all from the install process (when/if I get round to migrating my own blog (very neglected) from WP, I intend to use Disqus).

Thank you Kongondo!

  • Like 1

Share this post


Link to post
Share on other sites

@Kongondo I tried Disqus on a site that hasn't launched yet and, having played with it quite extensively, I quite like it. I really will have to bite the bullet and get on with WP -> PW!

Share this post


Link to post
Share on other sites

Yes, I was aware. My main problem is not being able to settle on a way of implementing the site. I had this daft idea of using no JS at all (no jquery or anything) for the front end, just CSS, but there are a few problems that rear up as a result. And then really interesting stuff like http://labs.ft.com/2014/09/polyfills-as-a-service/ (don't know if it has been mentioned hereabouts before) come along and really beg to be used...

Share this post


Link to post
Share on other sites

@kongondo

Hello Kongondo

Firstly, Thank you for showing me the way as to how to upgrade. I did so successfully and even learned as to how to 'Cleanup' and then successfully re-install from within the module page one of the 4 options.

I'm sorry to be a pain but I'm simply not finding my way as to render a post on the homepage without things like: 

Posts 1 to 1 of 1  
0 (referring to comments)
and also e.g. Posted by bernard, 23 SEPTEMBER 2014 3:24 PM
 
I tried just about everything but I'm not doing it right so after struggling for the whole day could you please show me how to get ONLY the title, blog_body and an image out of a situation like:
				<? $blog = $modules->get("MarkupBlog");
					$category = $pages->get(1452);
					$posts = $pages->find("blog_categories=$category");
					echo $blog->renderPosts($posts,true); ?>

I really looked everywhere but I simply don't understand how to put 1+1 together. Silly hé

Thank you in advance  :-[

Bernard

 

Share this post


Link to post
Share on other sites

@Bernard,

Currently there is no way to do that via the Blog API. Simply use CSS to hide them. E.g. to hide the 'Posted by Bernard, 23 September 2014 3.24 PM' add this to your style sheet:

.post-byline {
    display: none;
}

:-)

As for image, where is that image coming from? Is it one uploaded via the images field in a blog post or it is embedded in blog_body? If the former, access it normally using PW images API. If the latter, then it should be output with blog_body...

Share this post


Link to post
Share on other sites

@ Kongondo 

Pffiew   wow, now I think I'm starting to see clearer, Kongondo. So I guess the same for: 

.num-comments-icon {
     display: none;
} 

=> in your tutorial I see no class for 'Posts 1 to 1 of 17' - Can this be hidden too? (actually this is the most disturbing one ... imho)

Concerning the image(s),  I want to pull one image out of the images field of the blog post and render it above the blogpost and the rest of the images, a little deeper in the page where you see 'Hoogtepunten van de laatste match'

Thank you, Kongondo for stopping me to look in the wrong direction!

EDIT:

- Hiding 'num-comments-icon' and 'post-byline' works perfectly (newbees will love me reading this) yet for the <h3 >e.g. ''Posts 1 to 1 of 17" I'm still in the dark as how to make it disappear too.

- Images: The intro to the blog-post resides in the middle of the home-page with lots of content from different sources around it. Just like I tried to get 'title' and 'blog_body' without success, how do I tell the PW images API not to look in $page->etc but in the post being generated by the MarkupBlog? I'm feeling so close to the answer yet I'm still flopping around generating tons of Error Notifications in my mailbox. Am I dreaming for the impossible or should I just forget about this?

It was my plan that every time a new post gets added to the blog in a specific category (in my case: a soccergame of the main team + pictures) THEN  the center piece my home page would automatically change as well (small intro to the blog + lots of pictures)

Share this post


Link to post
Share on other sites

I have added a posts-count class to the <h3>

Concerning the image(s),  I want to pull one image out of the images field of the blog post and render it above the blogpost and the rest of the images, a little deeper in the page where you see 'Hoogtepunten van de laatste match'

This is a bit vague. I am not sure exactly where you want that image above the blogpost. Do you mean above post title ('Fanions - K.F.C. Heist - Nieuwpoort') or just below it? If you want it above, that means you want the image before the post is rendered ($small post from what I can see). That means, you have to call that image in your template file. That is tricky because you need to programmatically  fetch one image from the post that you have rendered. It is not impossible though but I need to know your situation better.

  1. How many posts will you be outputting at a time in that 'middle' area of the home page
  2. How will you be calling that post? The latest added post? A specific one?
  3. You said there will be multiple images per post, which image are you interested in? The first one? The last one? A random one? A specific one?

Assuming you will be calling only 1 post, the latest published one, and outputting its first image...

/*find the latest post and pass that as a Page or even a string to renderPosts(). You could even just call renderPosts("limit=1, true") but we want to use the Page later to grab the image*/
$post = $pages->get('template=blog-post, sort=-blog_date');

#get and output your first image
$image = $post->blog_images->first();
if($image) echo "<img src='$image->url'>";

#render your 'small' post
$blog = $modules->get("MarkupBlog");
echo $blog->renderPosts($post, true);
  • Like 1

Share this post


Link to post
Share on other sites

Updated Blog to version 2.0.1 on dev branch.

Main changes

  • Corrected an oversight whereby comments whose post pages were set to not show comments, i.e. 'disable comments', were still visible when viewed in 'comments' page and 'recent comments' widget. Now, only admin users will be able to see such comments in the 'comments' page and 'recent comments' widget
  • In respect of the above comments, when viewed on the 'comments' page, similar to those tagged 'SPAM' or 'PENDING', they are now tagged as 'HIDDEN'. As stated, these are only visible to admin users. Of course if a post's comments are subsequently set to be shown, these will be visible to all users and the HIDDEN tag will be removed since they are no longer hidden :-)

Share this post


Link to post
Share on other sites

Hi Kongondo,

If you check back now you'll see the first fruit of how you really helped me. OH yes, the road will be long for me to really grasp the basic simplicity of the PW API, selectors, etc etc &co but at least I managed to render content and pictures from a blogpost on 2 separate locations in the middle of my homepage     >:D AMAZING !!

Sure, I will keep going through trial and error but at least you (once more) showed me the path to follow ..  

For 'Fanions - K.F.C. Heist - Nieuwpoort' I put the following:

<!-- Column -->
<div class="col-1-4">
<h3>Heet van de naald</h3>
<div class="mosaic-block circle">
<? $blog = $modules->get("MarkupBlog");
$category = $pages->get(1452);
$posts = $pages->find("blog_categories=$category");
$post = $pages->get('template=blog-post, sort=blog_date');
$image = $post->blog_images->first();?>
<div class="mosaic-backdrop">
<img src="<?php if($image) echo $image->url; ?>" alt="Mock" /></div>
</div>
<? echo $blog->renderPosts($posts,true); ?>
</div>

=>> AND FOR "Hoogtepunten van de laatste match" I changed the $variableNames as I intend to eventually pull random pictures out of many posts and limit them to 8 or 12 or so 

<ul class="col-1-1 thumb-gallery super-list variable-sizes clearfix" id="thumb-gallery">
<!-- Start Thumbnail -->
<? $postimgblog = $pages->get('template=blog-post, sort=blog_date');
$imageblog = $postimgblog->blog_images; 
foreach ($imageblog as $image) { ?>
<div class="col-1-5 element cat-1">
<li><div class="mosaic-block circle"><a href="<?php if($image) echo $image->url; ?>" class="mosaic-overlay fancybox" data-fancybox-group="gallery" title="plock"></a>
<div class="mosaic-backdrop"><img src="<?php if($image) echo $image->url; ?>" alt="plock" /></div></div>
</div></li>
<? } ?>	
</ul> 

=> selectors & co will help me to filter things in time and there is plenty of playing room I guess to fill ALT and TITLE with who knows ... blogtitles, category-names, dates or whatever combination, not so? 

Even though I'm an primate in PW I've got hope everything will work out in time and sweat - THANK YOU AGAIN!

Bernard

ps. how do I make Post x to x of xy post dissapear? And where do I translate things to dutch?

Share this post


Link to post
Share on other sites

Glad you got it sorted. I notice in your code you are retrieving the FIRST post published (sort=blog_date) rather than the LATEST one (sort=-blog_date). Notice the hyphen. Is that intentional? Also, you may want to limit the amount of posts you retrieve in $postimgblog  in case you will have many posts...

As for making Post x of xx disappear, didn't you read my post properly? :-) In the latest Blog 2 update the <h3> now has a class <h3 class=posts-count>

Share this post


Link to post
Share on other sites

Hi Kongondo,

- The omit of the Hyphen was intentional indeed as there only are 2 posts: Yours (when I installed V2) and mine which I postdated to 30/8 or so  :rolleyes: 

I saw your new post appearing but I was writing my previous post to you (and thinking a lot) so .. you solved the post-count problem too hein? For sure this will in future help many noobies to walk a clean road. So happy that even a non-coder like me can be useful for the greater purpose .. 

fyi on my phone the css display: none; didn't catch on but that's my problem to go digging deeper as to which css-file dictates what. Maybe I should just put it in the html (which in the old books is not good practice but .. who cares)

Tomorrow, I will install your new version and also start working towards my final goal (read:dream) for your Blog-system:

For each team under the menu tab 2014-2015 I intend to

  1. Move the trainers from the Info tab to a Trainer tab because:
     
  2. I want to render a Blog category per team under the Info tab (starting with the Fanions as they are the only team with an independent template file (better to experiment where it disturbs on a limited scale)) (Even though the site is not 'officially' open there already are >150++ pageviews/day .. so I have to hurry to get things right - got no choice )
     
  3. If I'm thinking right, blog-post is a landing page only from the home page and the menu on the left of that particular page will lead people to the 'team' pages where the 'info' landing-tab will be  the 'Team category blog page'.
    The other tabs (calendar, trainers, players) should co-exist I hope  --even on a smartphone-- like they do now. 
    Even more so  --IF I understand PW right-- blog-post.php has the ability to act as an invisible filter to render(echo) whatever content elsewhere -if need be-.

     
  4. Next I want to get comments, pagination etc etc working while the 'tab' eco-system stays 'alive' per team within each 'team page'.
     
  5. Only then If that mechanic works, in principle I can start learning as to how to add a script to every member-page of the club (which already has a hidden info page with many fields) and give them the ability to log into their own profile -> which can be extended for those who have  to become an author in blog-posts, manager, etc etc

​Even though I'm standing on a sandcastle only 200m from the sea while looking at my first PW site as if I where standing on a mountain, --One thing for sure-- The little things I'm doing now would never have been possible without PW and it's people. 

Bernard

Share this post


Link to post
Share on other sites

@kongondo I'm testing the dev branch (URL scheme 3 and comments not installed, per my earlier comments here) and a few problems appear, which seem to be coming mainly or entirely from the markup module and the included template files. Am I better posting here or on GitHub?

Share this post


Link to post
Share on other sites

Github please, thanks. If it turns out they are not bugs, we'll return here :-). Also, let me know which version you installed. There were markup issues involved in the version attached in my post above (I'll delete that now) so you should really be using the Github version (2.0.1).

Share this post


Link to post
Share on other sites

Updated Blog to version 2.0.2. on dev branch

In demo template files, made checking whether commenting feature is installed more foolproof, thanks @DaveP

Share this post


Link to post
Share on other sites

Hi,

This looks cool and I'd like to add it to my new 2.5 site. I couldn't find any reference in this thread to 2.5, although there is mention of 2.4 and up. So, this should be OK to run on a 2.5 site?

Thanks.

Russell.

  • Like 1

Share this post


Link to post
Share on other sites

@kongondo thank you so much for this module, it's exactly what I need for a site I've been wanting to get around to for two years. Now I'm glad I never got the chance before! Your documentation for it is beautiful, as well. I appreciate the time and effort that went into it!

// removed question because I found my answer. ;)

  • Like 1

Share this post


Link to post
Share on other sites

Okay, I think I have a question worthy of typing now...

In my particular case, there are three types of templates for my blog's content, depending on which of four categories it is posted in. Because I'd like to require some of these fields only in certain categories, I don't want to just add the fields and only render them for certain pages because if I require them for posts that won't show them that might annoy my authors. If I don't require them my authors may not include them when I actually need them.

Example:

Category A - Uses Template A with Field Group A (blog posts with lots of extra fields)

Category B - Uses Template B with Field Group B (standard blog post, pretty much what you created as default)

Category C - Uses Template C with Field Group C (no description area, one image with caption and tags, plus title)

Category D - Uses Template B with Field Group B(standard blog post, pretty much what you created as default)

I was hoping that under the settings for each individual category I could pick what type of template their children could use. When I added my Template_A_post to the allowed children for Category A, I was able to edit an existing post from that category and change the template to Template_A_post, but when the blog posts list refreshed, it disappeared. So this is more problematic than just allowing different templates, it seems. Template_A_post is a clone of the blog-post template with a couple extra fields added so far.

Can you suggest a way to do this within the ProcessBlog module without fiddling with the module files themselves? I'm running ProcessBlog 1.3 in PWire 2.5.

As I mentioned before, I have been planning this blog for a while. My original plan (as of early 2013) was to use a different form in FormBuilder to create pages in each category, using specific templates, on form submit.

Update: I can combine my original plan with the new blog module, by creating FormBuilder forms with the information I want and passing it to blog post, which has all custom fields as optional. This might actually work out well, as I could create a whole 'front-end-back-end' for my contributors so I can avoid customizing the admin as much as I thought I might need. Do let me know if you see a way to create custom blog templates directly, though!

Share this post


Link to post
Share on other sites

@Creativejay,

I don't see any easy way to do this out of the box. If I get you correctly, you have two options one of which I doubt will work well.

Option 1.

Similar to what you attempted, change the template 'blog-posts' to allow children that use your other extra 'blog-post' templates, e.g. 'blog-post-a', etc. This will work fine with renderPosts() [a MarkupBlog method] since you can pass it a PageArray of your posts irrespective of their templates. The only problem for you is that renderPosts() will not render your other custom fields since it doesn't know about them. So, this option is pretty much dead in the water unless you customise MarkupBlog's code OR separately echo out those fields in your template file. In addition, your posts that use other custom templates will not be visible in the Blog dashboard (ProcessBlog).

Option 2.

Add your custom fields to the template 'blog-post' and use the module 'Page Edit Field Permission' to hide your custom fields as relevant to your Posts types A - D. In your template files, you will need to echo your custom fields separately from renderPosts(). I think I would go for this option since it requires the least work and you only have 1 template to deal with..In your template file you would only echo out your custom fields if they were not empty.

Both options will survive an upgrade since Blog doesn't recreate fields, templates, etc when you update the module.

Update:

I have just seen your update. Don't know much about FormBuilder so can't comment if your method will work...

Share this post


Link to post
Share on other sites

Hi kongondo

I have just uploaded your module to two sites on lightning.pw

The first was loaded on a default-site profile http://fermium-z0t.lightningpw.com/

Is this what you would expect to see???

If you click on blog in nav again is this what I should get?

The second site was loaded onto a blank profile http://gold-03z.lightningpw.com/

Again is this what you would expect to see???

If I then add /blog to the url http://gold-03z.lightningpw.com/blog/

This is more like what I would expect.

​As a newbie I find it very difficult to continue development with either of these sites.

I found it much easier with the older blog site profile.

I realise that the improvements are worth the extra effort on my part.

Did I possibly not install correctly?

Regards

Allan

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Gadgetto
      SnipWire - Snipcart integration for ProcessWire
      Snipcart is a powerful 3rd party, developer-first HTML/JavaScript shopping cart platform. SnipWire is the missing link between Snipcart and the content management framework ProcessWire.
      With SnipWire, you can quickly turn any ProcessWire site into a Snipcart online shop. The SnipWire plugin helps you to get your store up and running in no time. Detailed knowledge of the Snipcart system is not required.
      SnipWire is free and open source licensed under Mozilla Public License 2.0! A lot of work and effort has gone into development. It would be nice if you could donate an amount to support further development:

      Status update links (inside this thread) for SnipWire development
      2020-01-21 -- Snipcart v3 - when will the new cart system be implemented? 2020-01-19 -- integrated taxes provider finished (+ very flexible shipping taxes handling) 2020-01-14 -- new date range picker, discount editor, order notifiactions, order statuses, and more ... 2019-11-15 -- orders filter, order details, download + resend invoices, refunds 2019-10-18 -- list filters, REST API improvements, new docs platform, and more ... 2019-08-08 -- dashboard interface, currency selector, managing Orders, Customers and Products, Added a WireTabs, refinded caching behavior 2019-06-15 -- taxes provider, shop templates update, multiCURL implementation, and more ... 2019-06-02 -- FieldtypeSnipWireTaxSelector 2019-05-25 -- SnipWire will be free and open source Plugin Key Features
      Fast and simple store setup Full integration of the Snipcart dashboard into the ProcessWire backend (no need to leave the ProcessWire admin area) Browse and manage orders, customers, discounts, abandoned carts, and more Process refunds and send customer notifications from within the ProcessWire backend Process Abandoned Carts + sending messages to customers from within the ProcessWire backend Complete Snipcart webhooks integration (all events are hookable via ProcessWire hooks) Integrated taxes provider (which is more flexible then Snipcart own provider) Useful Links
      SnipWire in PW modules directory (alpha version only available via GitHub) SnipWire Docs (please note that the documentation is a work in progress) SnipWire @GitHub (feature requests and suggestions for improvement are welcome - I also accept pull requests) Snipcart Website  
      ---- INITIAL POST FROM 2019-05-25 ----
       
    • By d'Hinnisdaël
      Happy new year, everybody 🥬
      I've been sitting on this Dashboard module I made for a client and finally came around to cleaning it up and releasing it to the wider public. This is how it looks.
      ProcessWire Dashboard

      If anyone is interested in trying this out, please go ahead! I'd love to get some feedback on it. If this proves useful and survives some real-world testing, I'll add this to the module directory.
      Download
      You can find the latest release on Github.
      Documentation
      Check out the documentation to get started. This is where you'll find information about included panel types and configuration options.
      Custom Panels
      My goal was to make it really simple to create custom panels. The easiest way to do that is to use the panel type template and have it render a file in your templates folder. This might be enough for 80% of all use cases. For anything more complex (FormBuilder submissions? Comments? Live chat?), you can add new panel types by creating modules that extend the DashboardPanel base class. Check out the documentation on custom panels or take a look at the HelloWorld panel to get started. I'm happy to merge any user-created modules into the main repo if they might be useful to more than a few people.
       Disclaimer
      This is a pre-release version. Please treat it as such — don't install it on production sites. Just making sure 🍇
      Roadmap
      These are the things I'm looking to implement myself at some point. The wishlist is a lot longer, but those are the 80/20 items that I probably won't regret spending time on.
      Improve documentation & add examples ⚙️ Panel types Google Analytics ⚙️ Add new page  🔥 Drafts 🔥 At a glance / Page counter 404s  Layout options Render multiple tabs per panel panel groups with heading and spacing between ✅ panel wrappers as grid item (e.g. stacked notices) ✅ Admin themes support AdminThemeReno and AdminThemeDefault ✅ Shortcuts panel add a table layout with icon, title & summary ✅ Chart panel add default styles for common chart types ✅ load chart data from JS file (currently passed as PHP array) Collection panel support image columns ✅ add buttons: view all & add new ✅
    • By Robin S
      This module is inspired by and similar to the Template Stubs module. The author of that module has not been active in the PW community for several years now and parts of the code for that module didn't make sense to me, so I decided to create my own module. Auto Template Stubs has only been tested with PhpStorm because that is the IDE that I use.
      Auto Template Stubs
      Automatically creates stub files for templates when fields or fieldgroups are saved.
      Stub files are useful if you are using an IDE (e.g. PhpStorm) that provides code assistance - the stub files let the IDE know what fields exist in each template and what data type each field returns. Depending on your IDE's features you get benefits such as code completion for field names as you type, type inference, inspection, documentation, etc.
      Installation
      Install the Auto Template Stubs module.
      Configuration
      You can change the class name prefix setting in the module config if you like. It's good to use a class name prefix because it reduces the chance that the class name will clash with an existing class name.
      The directory path used to store the stub files is configurable.
      There is a checkbox to manually trigger the regeneration of all stub files if needed.
      Usage
      Add a line near the top of each of your template files to tell your IDE what stub class name to associate with the $page variable within the template file. For example, with the default class name prefix you would add the following line at the top of the home.php template file:
      /** @var tpl_home $page */ Now enjoy code completion, etc, in your IDE.

      Adding data types for non-core Fieldtype modules
      The module includes the data types returned by all the core Fieldtype modules. If you want to add data types returned by one or more non-core Fieldtype modules then you can hook the AutoTemplateStubs::getReturnTypes() method. For example, in /site/ready.php:
      // Add data types for some non-core Fieldtype modules $wire->addHookAfter('AutoTemplateStubs::getReturnTypes', function(HookEvent $event) { $extra_types = [ 'FieldtypeDecimal' => 'string', 'FieldtypeLeafletMapMarker' => 'LeafletMapMarker', 'FieldtypeRepeaterMatrix' => 'RepeaterMatrixPageArray', 'FieldtypeTable' => 'TableRows', ]; $event->return = $event->return + $extra_types; }); Credits
      Inspired by and much credit to the Template Stubs module by mindplay.dk.
       
      https://github.com/Toutouwai/AutoTemplateStubs
      https://modules.processwire.com/modules/auto-template-stubs/
    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.60
      Composer: rockett/jumplinks
      ⚠️ NOTICE: 1.5.60 is an important security patch-release for an XSS vulnerability discovered by @phlp. It's HIGHLY RECOMMENDED that all Jumplinks users update to the latest version as soon as possible.
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy! 🙂
    • By Robin S
      Add Image URLs
      Allows images/files to be added to Image/File fields by pasting URLs.

      Usage
      Install the Add Image URLs module.
      A "Paste URLs" button will be added to all image and file fields. Use the button to show a textarea where URLs may be pasted, one per line. Images/files are added when the page is saved.
       
      https://github.com/Toutouwai/AddImageUrls
      https://modules.processwire.com/modules/add-image-urls/
×
×
  • Create New...