-
Posts
7,529 -
Joined
-
Last visited
-
Days Won
160
Everything posted by kongondo
-
Excellent Blog you got there Dave. Nice, simple and clean...
-
Minor updates to renderNextPrevPosts(). Added ability to add custom link texts e.g. <<Older entries Newer entries>> Updated post above.
-
Upcoming update: Blog version 2.2.1. (dev) Summary of Changes: All main methods that render HTML output are now configurable via a parameter/argument $options These changes allow much greater control of your Blog features' layout/output. I will provide examples later but most of the below is hopefully self-explanatory. Please note these changes supersede those introduced in version 2.1.1 and 2.1.0 (some name changes to array indices + some additions). None of the changes will break your existing install if you are using the stable Blog branch. However, if you updated to 2.1.1 on the dev branch, AND started using some of its new optional features, some minor modifications to template files could be required (i.e, following the examples shown in 2.1.0, e.g. for renderPosts(), $featuredImage parameter is now $options and covers all aspects of rendered posts, not just featured images. E.g. to display a featured image on a summarised post, use array('post_small_image'=>xxx) as shown below. I have updated the dev branch for testing/comments, thanks. I will update the docs once I merge to master branch. New Default Options in MarkupBlog Methods renderPosts() //default options for various aspects of posts $defaultOptions = array( 'post_count' => 1,//0=off, 1=on - for the count in: Posts 1 to 5 of 15 'post_count_text' =>$this->_('Post'),//e.g. Posts 1 to 5 of 15 'post_not_found' => $this->_('No posts found.'),//message when no posts found 'post_author' => 1,//display name of post author: 0=off,1=top(below post-headline),2=bottom(in post-foot) 'post_author_text' => $this->_('Posted by'),// 'post_date' => 1,//display post's date: 0=off,1=top(below post-headline),2=bottom(in post-foot) 'post_date_text' => '',//e.g. Posted by author 'on' date 'post_more_text' => $this->_('View More'),//for $small posts - link text to full post 'post_categories' => 2,//display post's categories: 0=off,1=top(below post-byline),2=bottom(in post-foot) 'post_categories_text' => $this->_('Categories:'),//e.g. 'Categories', 'In', 'Filed under', etc 'post_tags' => 2,//display post's tags: 0=off,1=top(below post-byline),2=bottom(in post-foot) 'post_tags_text' => $this->_('Tags:'),//e.g. 'Tagged', 'Related', etc 'post_small_allowable_tags' => '',//holds string of HTML tags for strip_tags $allowable_tags. Needs to be in format '<code><p><img>' 'post_small_headline_tag' => 'h4', 'post_large_headline_tag' => 'h2', 'post_comments' => 1,//show comments info? 0=off,1=comments count top,2=comments count bottom,3=comments count top & bottom 'post_zero_comments_text' => $this->_('No comments yet'), 'post_comments_text' => $this->_('Comment,Comments'),//title in anchor comments icon + post-foot comments text, e.g. '2 Comments' or '1 Comment'. Must be in 'singular,plural' format 'post_comments_label' => $this->_('Comments:'),//this appears in post-foot, e.g. 'Comments': 2 Comments //## featured images ## 'post_image_alt' => 'description',//defaults to $image->description. Otherwise other stated field on the page, e.g. = 'title' 'post_image_tag' => 'featured',//string: image tag to look for in blog_images//@@todo - need translation here? //** small/truncated post featured image ** 'post_small_image' => 0,//display post's featured image: 0=off,1=top(above post-headline),2=bottom(first item in post-body) 'post_small_image_width' => '',//no width manipulation of featured image if this is blank or 0 'post_small_image_height' => '',//no height manipulation if this is blank or 0. Note, if size is true and both width and height > 0, use size() instead /*size: - image will be resized to exact dimensions -> $img = $image->size($x, $y) - where $x = 'width' and $y = 'height'*/ 'post_small_image_size' => false,//if 'size' = true AND both width and height > 0, this kicks in //** large/full post featured image NOTE: for full posts, to avoid duplication we only pull image from blog_images ** 'post_large_image' => 0,//display post's featured image: 0=off,1=top(above post-headline),2=bottom(first item in post-body) 'post_large_image_width' => '',//no width manipulation of featured image if this is blank or 0 'post_large_image_height' => '',//no height manipulation if this is blank or 0. Note, if size is true and both width and height > 0, use size() instead 'post_large_image_size' => false,//if 'size' = true AND both width and height > 0, this kicks in ); renderTags() //default options for tags $defaultOptions = array( 'tags_posts_text' =>$this->_('post,posts'),//come in the format 'singular,plural' for e.g. 1 'post' ); renderCategories() //default options for categories $defaultOptions = array( 'categories_posts_text' =>$this->_('post,posts'),//come in the format 'singular,plural' for e.g. October 5 'posts' 'categories_not_found' => $this->_('No categories to display.'),//message when no posts found 'categories_more_text' => $this->_('View More'),//link text to view all posts in that category ); postAuthor() //default options for author widget $defaultOptions = array( 'author_text' => $this->_('Author'),//text next to author title|name 'author_thumb_width' => 100,//no width manipulation of author thumb if this is blank or 0 'author_thumb_height' => '',//no height manipulation of author thumb if this is blank or 0 'author_thumb_alt' => 'title',//defaults to $author->title. Otherwise other stated field on the page, e.g. = 'title' or if 'description' then $image->description ); renderNextPrevPosts() //default options for next/prev posts $defaultOptions = array( 'prev_post' => '<',//tag/text for previous post, e.g. «, «, etc, i.e. << >>, etc 'next_post' => '>',//tag/text for next post, e.g. ›, etc 'prev_post_text' => 'title',//if title or not empty: will show title of the prev post. Otherwise show specificed text, e.g. 'Older entries' 'next_post_text' => 'title',//if title or not empty: will show title of the next post. Otherwise show specificed text, e.g. 'Newer entries' ); renderComments() - was already configurable; here showing new additions only //ADDITIONAL default options for comments $defaultOptions = array( 'comments_success' => $this->_('Thank you, your submission has been saved.'), 'comments_error' => $this->_('Your submission was not saved due to one or more errors. Try again.'), 'comments_text' => $this->_('Comment,Comments'),//comments text, e.g. 2 'Comments' or 1 'Comment' next to comments count (div#comments). Must be in 'singular,plural' format 'comments_list_empty' => $this->_('No comments found.'), 'comments_list_reply_text' => $this->_('replied to'), 'comments_by_text' => $this->_('Comment by'), 'comments_post_text' => $this->_('Post a comment'), 'comments_prev_text' => $this->_('Back'), 'comments_next_text' => $this->_('Next'), ); renderArchives() //default options for archives $defaultOptions = array( 'archives_posts_text' =>$this->_('post,posts'),//come in the format 'singular,plural' for e.g. October 5 'posts' 'archives_month_view_all_text' => $this->_('View All'),//'view all' that month's archives if limit set on amount to list );
-
Chris, Here, we never touch the core ...You don't need to change anything in /wire/. Whatever you change there will get overwritten on upgrade In a hurry, but have a look at this post: https://processwire.com/talk/topic/7981-update-ckeditor/?p=77847 You playground's at /site/modules/InputfieldCKEditor/, e.g. config.js
-
Tyssen, Although 'pub' is a forum for discussing 'anything', MODx has its own support forums which are better suited to answer the type of question you have raised and probably would do it faster and maybe even more accurately given its members use the product on a daily/regular basis.
-
@Dazzyweb.. <h1> versus <h2>: I'll see whether to include this in the renderPosts() $options. Of course <h1> should not be the case if outputting more than one post on a single page! Your other questions should be answered in the following (I hope). Social Media Icons I did a lot of thinking regarding how to implement social media icons in both $small and full posts (whether single or a list). I bounced a few ideas around: 1. Create a Social Media Icons Widget Seemed OK on paper, maybe with repeaters. But, there's several social networking services/sites out there as well as many approaches to include them (buttons) in one's website. OK, it mainly involves using javascript but Twitter's and G+ are different. So are FBs, etc. We don't want to be messing with that in the GUI. So, I shelved this idea. It would be impossible to cater for all the different Social sites and the approaches to implement their icons/buttons. Twitter alone has 'share', 'follow' blah blah... 2. Include SMI using Hanna Code. Great! Great I thought. One could include the buttons anywhere in their blog_body. However, this wouldn't work for $small posts. This is because these are rendered after passing through strip_tags() which was stripping out everything so would strip out Hanna Codes output markup as well. It reminded me about this post. Of course strip_tags() has a second parameter for $allowable_tags! So at the API level, I have now made this configurable in renderPosts() $options. The dev can specify which tags they want not to be stripped out - e.g. place an image at the top of your post that you want to be rendered with the $small post (currently it would be stripped out). Use the feature with caution of course! In addition it would be very tedious adding Hanna Code tags in each and every post! OK, maybe one could automate this using Hanna Code API but don't know if that would work. Ideally, we want to add our icons at the template file level...I think... 3. Developer to include SMI in their template files! At first I thought this would only work great for single posts. Render the single post and include the SMI beneath the post. This would not work well for a list of posts, whether full or $small. But aah, ProcessWire is OOP! We can manipulate objects on the fly! So, we can 'inject' some extra input into our objects properties or even create new ones and output those. Now, I would really love to hear what the other seasoned devs think about this (see code below). Any issues using this approach? Is there a better way? If posts fetched and manipulated this way were limited to some small number, would there still be issues? So, this is what I came up with so far in my limited tests, seems to work well (especially in conjunction with $allowable_tags). Here, we add a Twitter Share Button. I am not sure $post->url is working fine though (relative url?). A count of tweets should be showing next to the button (see screenshot below). I haven't read up properly on how to implement the Twitter buttons. Have a read here (twitter dev). <?php $posts = $pages->find('template=blog-post, limit=10'); foreach($posts as $post) { $socialMedia = ' <a href="https://twitter.com/share" class="twitter-share-button" data-size="large" data-url="' . $post->url . '"> Tweet </a>'; //we manipulate each $post object's blog_body property. we add twitter 'share' button $post->blog_body = $socialMedia . $post->blog_body;//prepend social media code to $post->blog_body } //CALL THE MODULE - MarkupBlog $blog = $modules->get("MarkupBlog"); //main content $content = $blog->renderPosts($posts, true);//$posts is a PageArray; true means truncate post ?> <!-- in our HTML in appropriate places --> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); </script> <div> <h1 id="headline">Testing Social Media Icons</h1> <?php echo $content;?> </div> Notice here we've allowed <img><a> in the summarised post. Other than this, I have almost finished making renderPosts() highly configurable using $options - e.g. ability to change 'View More' to whatever you want, e.g. 'Continue Reading'; List a post's tags/categories (separately) or not and whether to list them at the top of the post or at the bottom; change 'Posted by' to whatever you want or not include this info, etc.
-
You mean to manually remove the module? You can use the API: $modules->uninstall("ProcessPageDelete"); Or delete the module's row in 'modules' table in the db using phpMyAdmin or similar...
-
@Suntrop, Just to echo what Joss has said and I realise my post above was probably ambiguous.... CKEditor the module is a core module and lives in /wire/modules/Inputfield/InputfieldCKEditor/ - Don't touch this However, custom settings should be done/placed in /site/modules/InputfieldCKEditor/. Here you will find the following files + folder README.txt mystyles.js config-body.js config.js plugins contents-inline.css contents.css Read the contents of those files + see these guides for how to customise your CKEditor https://processwire.com/blog/posts/august-2014-core-updates-2/#upgrades-to-ckeditor https://github.com/ryancramerdesign/ProcessWire/tree/dev/site-default/modules/InputfieldCKEditor http://www.flamingruby.com/blog/processwire-weekly-13/#1-1 http://www.flamingruby.com/blog/processwire-weekly-13/#1-2
-
@dazzyweb, thanks for the ideas. I am hesitant to approach the issue in this fashion. I feel it will produce some layer of complexity (text output formatting) to achieve something that can already be achieved out of the box with the current Blog. If there is to be any 'complexity', that should be left to the dev (e.g. the $options in renderPosts()) rather than to everyday editors using the GUI to post articles. Like I stated earlier, the featured image, post-headline visibility, etc features are easily achievable via using the $options in renderPosts(). Maybe once I have posted the working code you'll see how much easier it is to achieve the layout you want. Alternatively, there is also the option of using HannaCode to output code where you want. I will also make it possible to toggle the visibility of post-by-line, post-categories and post-tags in the code I am working on. The unresolved issue is the social media buttons but we'll get to that eventually. Cheers
-
@Chris, thanks for reporting back and @Adrian for resolving this. Although I was sure this anomaly was not coming from Blog, it is good to get a confirmation
-
The problem with a module like this is that it is unlike WP with its many themes which have different layouts .. For #1: I think you can easily pull that off with CSS. What I will need to add however, is the option to also output a featured image for a full single post [blog-post.php] (currently I have implemented this for $small posts only). Same as the current implementation, one will have the choice for that to be output either above the post-headline or below the post-body. In your case you'd probably go for 'above' post-headline and using CSS you can place your headline on top of the featured image. I'll try show you example CSS on how to do it... For #2: I will need to think about how those can be implemented (forum any/all ideas welcome, thanks!). I think it is an important feature. This will probably have to be implemented on the GUI side. It will have to be configurable, i.e. what social media sites to show, their icons, etc...This feature may have to wait for a while though...I want to get it right... Thanks for the ideas.
-
@dazzyweb, I don't follow: Are you talking about a full post as output e.g. in blog-post.php or are you talking about summary of posts, e.g. on blog-posts.php? If the latter, I have already implemented that as per your request yesterday. What is a featured banner photo in this case? Where is it coming from? Can you show me some examples/illustrations please? Without jQuery or similar you can't at the moment. Again, are you talking truncated ($small) posts or full posts or full listed posts (e.g. on blog.php)? I'd like to see some illustrations/examples though...
-
@toothpaste, Yes, it is technically possible to call items twice but wholly unnecessary . Btw, if you did that, there is no need to call $modules->get('MarkupBlog') twice. Calling it once is enough on the same template file. Anyway, back to the issue. You can easily achieve what you asked - having two posts (or 3 or 10 or whatever) side by side by just using CSS. All blog posts are wrapped in divs as follows: <div class="posts"> <div class="post">Post number 1</div> <div class="post">Post number 2</div> <div class="post">Post number 3</div><!-- etc, etc. --> </div><!-- end parent div.posts--> What you want to do is to target the div.post with CSS to make them float side by side. Now, directly targeting div.post in your CSS may obviously affect other instances of div.post elsewhere (e.g. in blog-post). So, what you want to do is probably to wrap div.posts in your custom div like so: <div id="wrapper"> <div class="posts"> <div class="post">Post number 1</div> <div class="post">Post number 2</div> </div><!-- end parent div.posts--> </div><!-- end parent div#wrapper--> You can then easily target each div.post with your CSS.
-
I always use this 'trick'
-
There is the Schedule Pages module....for auto-expiring...but not moving... ...but you can achieve that with a simple module/hook. But Date Archiver looks like it will do what you want...
-
OK, I have had a rethink in respect of the second request here (post-by line below post body) and the first issue here... . Similar to renderComments() where you can customise comments' visibility status texts, I am working on making the currently hard-coded 'posted by', 'posts 1 to 1 of 20', 'view more', etc (including their visibility and position where applicable) customisable. The 3rd argument of renderPosts() will now be Array $options and will cater for various aspects of the rendered post. If you have any requests please post them here and I will consider them, thanks.
-
Upcoming Update: Blog version 2.1.1 (dev) Update as per request to allow user to control position of featured image - either above post-headline or below post-body. Default is, if present, output featured image below post-body. To output a featured image above the post-headline, include the 'key'=>'value' pair 'position'=>'above' in the $featuredImage options array, .e.g. $featured = array('tag'=>'thumb', 'width'=>550, 'position'=>'above'); echo $blog->renderPosts("limit=5", true, $featured); For new readers, also refer to the original Blog 2.1.0 post above. Feature available in the dev branch for testing, thanks. Screenshot
-
Yes ; isn't that what this module is already doing? No ......Here's why... {also see the G thing...}
-
@Chris, Sorry about your troubles. This is very strange. It has not been reported before nor have I experienced it. Blog does not touch your PW 'user' credentials at all. Please clarify a few things: Can you confirm what version of Blog you are running? It may sound silly, but confirm when you are trying to log back in, are you using your username or Blog's display name? Do you get any error messages when you try to log back in? What are those messages? Are you logging back in as an Admin?
-
What happened to the screens in the first post?
-
Featured image above post-headline I'll mull over this one but can probably add a position=>above//below in $featuredImage options. Just to be sure, you mean something like this or this or this yes? post-byline below the post-body This one I am not sure about whether I want to change the current behaviour..
-
Find most efficient solution for storing multiple values in a field
kongondo replied to gebeer's topic in General Support
Cool insight @sforsman... -
Find most efficient solution for storing multiple values in a field
kongondo replied to gebeer's topic in General Support
Ye...just finished grepping it...