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

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

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

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

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)

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

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>

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

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?

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

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

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

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

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 FireWire
      Hello community!

      I want to share a new module I've been working on that I think could be a big boost for multi-language ProcessWire sites.

      Some background, I was looking for a way for our company website to be efficiently translated as working with human translators was pretty laborious and a lack of updating content created a divergence between languages. I, and several other devs here, have talked about translation integrations and have recognized the power that DeepL has. DeepL is an AI deep learning powered service that delivers translation quality beyond any automated service available. After access to the API was opened up to the US, I built Fluency, a DeepL translation integration for ProcessWire.
      Fluency brings automated translation to every multi-language field in the admin, and also provides a translation tool allowing the user to translate their text to any language without it being inside a template's field. With Fluency you can:
      Translate any plain textarea or text input Translate any CKEditor content (yes, with markup) Translate page names for fully localized URLs on every page Translate your in-template translation function wrapped strings Translate modules Fluency is free, and now so is DeepL
      Since this module was first built DeepL has introduced free Developer accounts that allow anyone to start using Fluency at zero cost and beginning with the version 0.3.0 release Fluency now supports free DeepL accounts. As of June 2021 DeepL supports translation to 26 languages and continues to offer more!
      Installation and usage is completely plug and play. Whether you're building a new multi-language site, need to update a site to multi-language, or simply want to stop manually translating a site and make any language a one-click deal, it could not be easier to do it. Fluency works by having you match the languages configured in ProcessWIre to DeepL's. You can have your site translating to any or all of the languages DeepL translates to in minutes (quite literally).
      Let's break out the screenshots...
      When the default language tab is shown, a message is displayed to let users know that translation is available. Clicking on each tab shows a link that says "Translate from English". Clicking it shows an animated overlay with the word "Translating..." cycling through each language and a light gradient shift. Have a CKEditor field? All good. Fluency will translated it and use DeepL's ability to translate text within HTML tags. CKEditor fields can be translated as easily and accurately as text/textarea fields.

      Repeaters and AJAX created fields also have translation enabled thanks to a JavaScript MutationObserver that searches for multi-language fields and adds translation as they're inserted into the DOM. If there's a multi-language field on the page, it will have translation added.

      Same goes for image description fields. Multi-language SEO friendly images are good to go.

      Creating a new page from one of your templates? Translate your title, and also translate your page name for native language URLs. (Not available for Russian, Chinese, or Japanese languages due to URL limitations). These can be changed in the "Settings" tab for any page as well so whether you're translating new pages or existing pages, you control the URLs everywhere.

      Language configuration pages are no different. Translate the names of your languages and search for both Site Translation Files (including all of your modules)

      Translate all of the static text in your templates as well. Notice that the placeholders are retained. DeepL is pretty good at recognizing and keeping non-translatable strings like that. If it is changed, it's easy to fix manually.

      Fluency adds a "Translate" item to the CMS header. When clicked this opens up a modal with a full translation tool that lets the user translate any language to any language. No need to leave the admin if you need to translate content from a secondary language back to the default ProcessWire language. There is also a button to get the current API usage statistics. DeepL account owners can set billing limitations via character count to control costs. This may help larger sites or sites being retrofitted keep an eye on their usage. Fluency can be used by users having roles given the fluency-translate permission.

      It couldn't be easier to add Fluency to your new or existing website. Simply add your API key and you're shown what languages are currently available for translation from/to as provided by DeepL. This list and all configuration options are taken live from the API so when DeepL releases new languages you can add them to your site without any work. No module updates, just an easy configuration. Just match the language you configured in ProcessWire to the DeepL language you want it to be associated with and you're done. Fluency also allows you to create a list of words/phrases that will not be translated which can prevent items such as brands and company names from being translated when they shouldn't

       
      Limitations:
      No "translate page" - Translating multiple fields can be done by clicking multiple translation links on multiple fields at once but engineering a "one click page translate" is not feasible from a user experience standpoint. The time it takes to translate one field can be a second or two, but cumulatively that may take much longer (CKEditor fields are slower than plain text fields). There may be a workaround in the future but it isn't currently on the roadmap. No "translate site" - Same thing goes for translating an entire website at once. It would be great, but it would be a very intense process and take a very (very) long time. There may be a workaround in the future but it isn't on the roadmap. No current support for Inline CKEditor fields - Handling for CKEditor on-demand hasn't been implemented yet, this is planned for a future release though and can be done. I just forgot about it because I've never really used that feature personally.. Alpha release - This module is in alpha. Releases should be stable and usable, but there may be edge case issues. Test the module thoroughly and please report any bugs via a Github issue on the repository or respond here. Please note that the browser plugin for Grammarly conflicts with Fluency (as it does with many web applications). To address this issue it is recommended that you disable Grammarly when using Fluency, or open the admin to edit pages in a private window where Grammarly may not be loaded. This is an issue that may not have a resolution as creating a workaround may not be possible. If you have insight as to how this may be solved please visit the Github page and file a bugfix ticket.
      Requirements:
      ProcessWire  3.0+ UIKit Admin Theme That's Fluency in a nutshell. A core effort in this module is to create it so that there is nothing DeepL related hard-coded in that would require updating it when DeepL offers new languages. I would like this to be a future-friendly module that doesn't require developer work to keep it up-to-date.
      The Module Is Free
      This is my first real module and I want to give it back to the community as thanks. This is the best CMS I've worked with (thank you Ryan & contributors) and a great community (thank you dear reader).
      DeepL Developer Accounts
      In addition to paid Pro Developer accounts, DeepL now offers no-cost free accounts. Now all ProcessWire developers and users can use Fluency at no cost.
      Learn more about free and paid accounts by visiting the DeepL website. Sign up for a Developer account, get an API key, and start using Fluency today.
      Download & Feedback
      Download the latest version here
      https://github.com/SkyLundy/Fluency-Translation/archive/main.zip
      Github repository:
      https://github.com/SkyLundy/Fluency-Translation
      File issues and feature requests here (your feedback and testing is greatly appreciated):
      https://github.com/SkyLundy/Fluency-Translation/issues
       
      Thank you! ¡Gracias! Ich danke Ihnen! Merci! Obrigado! Grazie! Dank u wel! Dziękuję! Спасибо! ありがとうございます! 谢谢你!

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