Jump to content

kongondo

PW-Moderators
  • Posts

    7,479
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. Update: Blog version 2.3.3 In addition to the very clear instructions on how to uninstall Blog (README), I have added an even clearer textual reminder/warning in Blog's module configuration screen to first run the in-built Cleanup Utility before uninstalling the module. Committed to master...(including the new renderRelatedPosts()method discussed a couple of posts up.) See next post about a utility to help when disaster strikes, aka, despite the very visible new warning text and despite the clear instructions you somehow find yourself with Blog components left in your hands having made the mistake of first uninstalling Blog and now you can't reinstall it without going through some very tedious manual cleanup....
  2. @LostKobrakai, I suggest you add this to the modules directory if/when you can? I think it is a useful addition, thanks!
  3. @LostKobrakai, Your implementation is very nice actually. I have just tried it but its not working for me. I am just seeing an unstyled multilple select field. I'll test further later to find out what's going on...
  4. An alternative would be to base this on the current relevant pagefields, then float-left those asmSelect <li></li> coupled with some CSS styles and you are good to go...
  5. In my book, web design is part and parcel of development ...frontend development...
  6. It allows you to save settings for a field on a per template basis. Let's say for a template called 'flats' you want the label of that field to be 'Available'. On another template, , called 'agents', you can reuse the same field but give it a different label, e.g. 'Premium'... You can also edit context settings when editing the list of fields when editing a template. Hover your mouse over the label of the field and an arrow will appear. Click on that, it opens a modal and you can set 'in context' changes there. Recent changes to PW (can't remember version) introduced the ability to save lots (all?) field settings on a per template basis. This is a really powerful feature, like many others in PW
  7. This is basically an aesthetics issue? So instead of this listing of selected pages in your page field in page edit mode: Tag 1 Tag 2 Tag 3 Tag 4 You want... Tag1, Tag 2, Tag 3, Tag 4..... Beaten by @LostKobrakai...again! That is exactly what I wanted to suggest... Edit 2: Using jQuery Autocomplete (that is what is used in some page fields) multiple..., there is no need for typing complete tags by hand; They would be auto-suggested as illustrated here: http://jqueryui.com/autocomplete/#multiple and lined up horizontally...
  8. If max files = 0, then your images fields is an array and also needs to be looped or grab an image using $image->first() or $image->eq(2) if you only want a single image. Am surprised that the url was output though...hmmm.. Try the following... //Loop through Carousel repeater on this page foreach($page->Carousel as $Slider){//note that repeater items are just pages. So $Slider is a page 'with fields' //loop through the images array foreach($Slider->Slider_Graphic as $graphic) {//foreach image field in each $Slider page... echo $graphic->url; echo $graphic->description; } }
  9. Thanks for sharing. Just cross-referencing with this other similar topic: https://processwire.com/talk/topic/4125-raspberry-pi-with-apache-and-processwire/
  10. That's the beauty of ProcessModules...you can pretty much throw anything at it and it will output it....plain HTML, whatever. I have had a quick look at the code and it's pretty much plain HTML in many places...added to that, some CSS to style it...
  11. Just a by the way, alternatively, with the latest addition to the core, where two modules with the same name can co-exist.....you can copy the module and make changes to the hard-coded stuff....
  12. Nice one Felix! Thanks for the write-up too... <btw>oh, the NHS [uK] is great but much simpler to understand compared to the German labyrinth-of-a-health-system </btw>
  13. Well this is not true...at least not if you followed the instructions to the letter . The instructions are very clear. There is no need to manually uninstall anything in Blog 2. Uninstall is a two step process (i). Use the Cleanup first (ii) Uninstall the module https://github.com/kongondo/Blog#uninstall To remedy your situation, you need to delete the role 'blog-author'.
  14. Is this already live? Are you not able to reinstall and select style 2?
  15. Worked for me with the following code (but - see below): <?php $small = ''; $large = ''; if (count($page->images)) { $i = 1; foreach ($page->images as $img) { $thumb = $img->size(200,150); $small .= '<li><a href="#pic' . $i . '"><img alt="" src="' . $thumb->url . '" /></a></li>'; $large .= '<div><a name="pic' . $i . '"></a><img alt="" src="' . $img->url . '" /></div>'; $i++; }//end foreach $page->images as $img }//end if count $page->images ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo $title; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" /> <style type="text/css"> #gallery { width: 600px; overflow: hidden; position: relative; z-index: 1; margin: 100px auto; border: 2px solid #003C72; } #navigation { list-style: none; padding: 0; margin: 0; float: left; } #navigation li { padding: 0; margin: 0; float: left; clear: both; } #navigation li a img { display: block; border: none; } #navigation li a { display: block; } #full-picture { width: 500px; height: 375px; overflow: hidden; float: left; } </style> </head> <body> <h1><?php echo $page->title; ?></h1> <div id="gallery"> <ul id="navigation"><?php echo $small?></ul> <div id="full-picture"><?php echo $large?></div> </div> </body> </html> However, as you can see in the discussions on the link you provided, there was an issue with page scrolling. An alternative version was provided here For the updated coded, the following code worked for me (I had to tweak the CSS because I used large images). You might want to resize your images using ProcessWire rather than CSS. You can see the demo here (expires in 7 days): http://aluminum-nue.lightningpw.com/gallery/ <?php $slides = ''; $navigation = ''; if (count($page->images)) { $i = 1; foreach ($page->images as $img) { $slides .= '<div id="slide' . $i . '"></div>'; $slides .= '<img src="' . $img->url . '" alt="" />'; $navigation .= '<a href="#slide' . $i . '">' . $i . '</a>'; $i++; }//end foreach $page->images as $img $default = '<img class="default" src="' . $page->images->first()->url . '" alt="" />'; }//end if count $page->images ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo $title; ?></title> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" /> <style type="text/css"> #image-slider { margin: 0 auto; width: 1500px; } #navigation { margin: 5px 0 0 0; text-align: center; z-index: 10; } #navigation a { text-decoration: none; background: #003C72; padding: 2px 6px; color: #FFFFFF; display: inline-block; } #navigation a:hover { background: #0182C4; } #slides { height: 980px; overflow: hidden; position: relative; } #slides img { position: absolute; top: 0; left: -500px; } #slides img { z-index: 1; opacity: 0; /* animation */ transition: all linear 400ms; -o-transition: all linear 400ms; -moz-transition: all linear 400ms; -webkit-transition: all linear 400ms; } #slides div { display: none; position: fixed; } #slides div:target + img { left: 0; z-index: 5; opacity: 1; } #slides img.default { left: 0; z-index: 5; opacity: 1; } #slides div:target ~ img.default { z-index: 1; opacity: 0; left: -500px; } </style> </head> <body> <h1><?php echo $page->title; ?></h1> <div id="image-slider"> <div id="slides"> <?php echo $slides?> <?php echo $default?> </div> <div id="navigation"><?php echo $navigation?></div> </div> </body> </html>
  16. Update: Blog version 2.3.2 Additions Thanks to idea by @justb3a, I have added a new method renderRelatedPosts() to MarkupBlog. The method returns a PageArray of posts related to the post currently being viewed or the specified blog post/page. (if related posts found, otherwise returns null). It takes four arguments as follows: renderRelatedPosts(Page $post = null, $relatedBy = null, $limit = null, $sort = null) 1. $post: The post whose related posts will be returned. Defaults to the current page if none specified. 2. $relatedBy: This sets the criterion for determining how other posts are related to the current post. There are 3 possible options here: a. $relatedBy = 1: posts are related by both tags AND category. This means that in order to be considered as related to the specified post, the posts to be returned must have at least one tag and at least one category in common with the specified post. This is the default relation criterion. b. $relatedBy = 2: posts are related by tags ONLY. Means that at least one tag has to match the specified post's tags. c. $relatedBy = 3: posts are related by categories ONLY. Means that at least one category has to match the specified post's categories. 3. $limit: Number of related posts to retrieve. Defaults to 3 posts. 4. $sort: This determines the related posts to prioritise in the find. It is especially useful when you set a $limit. It defaults to sort by blog_date DESC, meaning latest posts. You can use any other valid ProcessWire sort value, e.g. sort by title, sort by 'most commented on posts' [see example below], sort by random, etc. The method returns no markup and its output can be used in a variety of ways. Examples #RELATED POSTS ##1. used in conjuction with MarkupBlog's renderNav() ##similar to 'Related Categories' in the left-hand navigation in demo Blog 'blog-post.php' template file //CALL THE MODULE - MarkupBlog $blog = $modules->get("MarkupBlog"); //use defaults. Related posts limited to 3, related to this post by BOTH tags AND categories, ordered by blog_date DESC $related = $blog->renderNav(__('Related Posts'), $blog->renderRelatedPosts()); //use renderNav() markup echo $related; //find the 'most commented on' posts related to this post by category $related = $blog->renderNav(__('Related Posts'), $blog->renderRelatedPosts(null, $relatedBy=3, null, '-blog_comments.count')); //find 7 posts, ordered Alphabetically by title, related to this post by tag $related = $blog->renderNav(__('Related Posts'), $blog->renderRelatedPosts(null, $relatedBy=2, $limit=7, 'title')); ##2. used outside blog-post.php or even outside Blog pages $post = $pages->get(2550); //find 5 random posts related to the specified post by BOTH tags AND categories $related = $blog->renderNav(__('Related Articles'), $blog->renderRelatedPosts($post, null, $limit=5, 'random')); //find the 3 'least commented on' posts related to the specified post by tags $related = $blog->renderRelatedPosts($post, $relatedBy=2, null, 'blog_comments.count'); //find 3 posts related to the specified post by tags AND categories $related = $blog->renderRelatedPosts($post); //use custom markup foreach($related as $r) echo $r->title . '<br>'; Screenshot Currently in dev branch only for testing.
  17. Good catch; sorting by 'most commented on related posts' cannot be the default since not everyone will have activated Blog Comments. I have changed the default to sort by latest post...
  18. Regarding "Related Posts", I have been able to implement this using one line of code , OK, not quite but I have chosen a different route from the previously suggested code. Thanks for the inspiration and ideas though! I will wrap this in a new renderRelatedPosts() method in MarkupBlog. In case you are wondering, the most important line of code is this: $related = $pages->find("template=blog-post, blog_categories=$page->blog_categories, blog_tags=$page->blog_tags, id!=$page->id, limit=3, sort=-blog_date"); I'll post details later but I will make this configurable in the new method, i.e. add options to find related posts by 'tag' OR by 'category' OR 'by both tag AND category'. There will also be an option for limit as well as sort, i.e. if limiting, e.g. to 3 related posts, what's the criteria for your '3 most important related posts'? The default will be 'most commented on related posts' sort by latest posts (blog_date). Then, similar to the 'Related Categories', 'Related Tags' and 'See also' output that you can see in the demo Blog template files running on the left hand side navigation, one will simply need to use the method renderNav() to display Related Posts as follows in the template file 'blog-post.php': $subNav .= $blog->renderNav(__('Related Posts'), $related); Just wanted to post these ideas before I finalise the code in case there is something I am missing? Thanks.
  19. Glad you got it sorted. I'm confused though. Going by your first post and subsequent discussions, I thought you wanted the year/month to be part of your posts' URL. Watching your video, it seems not. You are using the year/month/ in the archives URLs only while your posts have 'normal' URLs.
  20. There's no bug! - See post below. It works just fine. In your video, one can see that in the Input tab, you have selected the radio option: No date/time picker . I have tested it and it works just fine...If that is selected, then you get no time when you create a page. Select option 2 or 3 and you should be fine. Date/time picker on button click Date/time picker on field focus Here's a screen from your video..
  21. if $page->hotelisim is a Multiple page field, then use count() instead (because it returns an array).. if(count($page->hotelisim)) { //do your foreach stuff here } else { echo 'Please ask'; }
×
×
  • Create New...