Jump to content

Joss

PW-Moderators
  • Posts

    2,862
  • Joined

  • Last visited

  • Days Won

    47

Everything posted by Joss

  1. Very neat, Diogo Or you just wrap the entire lot in a function that has very minimal markup that can be bent with CSS and then shove it into your template: <div class="myBigContainer"> <?php loadPageRubbish(); ?> </div>
  2. You need to download it and install it from the modules section of the site. http://modules.processwire.com/modules/process-export-profile/ What I suggest, however, is download and install the Modules Manager. Then you will be able to install modules direct from that manager, including the profile exporter. http://modules.processwire.com/modules/modules-manager/
  3. Move is the thing that has messed up my nice action button idea. The JS for it seems to be very path specific, so when I did my nice drop down with inevitable additional markup, it no longer knew where it was. I must admit, it would be nice to just grab and move items in the same way as you can with template fields - lots quicker. What I would love to do (but I cant work out how) is layout each item like so (going from left to right across the table row) Expand - a familiar Arrow Title - Clicking on it goes straight to edit, if that is allowed Actions Icon - Opens a little drop down for delete, publish/unpublish, new, copy, etc Move - a move symbol. grab and move immediately rather than click and then move as a separate action Personally I would split those so the action and move icons are to the far right of the row. This takes into account the things people do most often while making additional options the same number of clicks as now. Apart from speeding up some operations, That also compresses down better in small viewports.
  4. What a lovely thing - nice one!
  5. In my huge team of one, I work like Pete - I design away from the final environment, even if that means pencil and paper. The results of that I put into the system. But in reality, just like my proper job of a composer/sound engineer/producer, the system has become very blurred with creative people doing technical jobs and technicians doing creative jobs. When I first started in the seventies, this was only just happening really - there were still the sound engineers who got fussy about non-engineers touching the faders (especially in the BBC which was stuffed with idiotic union members who were not even good sound engineers). But the technology changed this with the result that a lot of professional music is composed at home by untrained engineers - and it is good stuff too! The whole point about languages like PHP is that as natural languages they are meant to be easy to use by non technical users. They are intentionally designed to blur the boundaries to make the design process more coherent. Now, obviously keeping some separation makes debugging much easier and allows for redesign without changing the mechanics, but I don;t think that means there should be no trespassing at all on each others territory. Personally, I don't see a problem with that as long as the end product goes through some QC and fulfils the brief. Also, on a purely selfish note, I am only just beginning to get my head around PW as it is - without learning yet another syntax! (Old brain does not absorb stuff as easily as it used to) Joss
  6. Okay, far too late at night for this! But, since it is returned as an array, I suppose you could use array_search to find the key and then use the key to return the field data. Umm something like that! try here: http://php.net/manual/en/function.array-search.php (Soma is floating around - he will know)
  7. Well, I am too knackered to give it a proper work out - I have it set to ID anyway, because that probably is more sensible. I now need to make a list of all my various sort options to see if I have gone a bit over the top. I need something that is the search equivalent of the lifts in Hitch Hikers guide to the Galaxy. They had a prescient mode so they could predict what floor you would be waiting at before you knew yourself, so there was always a lift waiting for you when you arrived. Instead I tend to end up with the idiots video recorder: Records the programme you didn't want to see and then plays it back when you are not there... Joss
  8. Too late - found the problem. Title was fine, accidentally having the page field set to multiple wasn't Actually, title is not a problem in this particular case. I was going to use ID (and I might still do for consistency), but in fact if I change the title of the category, it is changed for the category select too, so they will always match. (I tried it to check) The problem only comes up if you are actually saving the title somewhere as a string.
  9. This is a case of editing far too late at night! Although my page field was just a single select, on the details tab it was set for multiple - so was saving every change .... DOH! All working nice and sweetly now.
  10. HI Wanze Well, it doesn't break it, but doesn't cure it either. The post_category_select is a page field that selects using the title. But both versions seem to work. So I am still stuck
  11. Not my parents! But my categories. I have a category template into which I call two functions: getFeaturedPostsbyCategory() getPostsbyCategory() The functions are absolutely identical except the featured posts one has this: $thisCategory = wire("page")->title; $posts = wire("pages")->find("post_category_select=$thisCategory, post_featured_category=1"); and the other one has this: $thisCategory = wire("page")->title; $posts = wire("pages")->find("post_category_select=$thisCategory, post_featured_category=0"); Okay, now the weird stuff! I have these categories in a tree: Category 1 -- Category 1 2 ---- Category 1 2 3 I create a post and select (through a page single select dropdown) the category "Category 1 2" If it is not featured, it only appears in the page for Category 1 2 However, If I check the Featured checkbox, it now appears in Category 1 2 AND Category 1! If I create a post and select category 1 2 3 and make it featured it now appears in category 1 2 3 AND category 1 2 (but NOT category 1) So,when featured the articles appear in both their own category and the parent category. WHY? This has me completely stumped. Joss ========================== A couple of notes: This does not happen with posts that are NOT featured (so post_featured_category=0). They just appear in their correct category and do not sneak around with their Category's parent! The category tree is created as viewable pages in the Pages list. Nothing special about them. Not stored anywhere strange The posts are all stored under a single hidden page called Posts. Here are the two functions in full: <?php // Get featured posts by category function getFeaturedPostsbyCategory(){ $thisCategory = wire("page")->title; $posts = wire("pages")->find("post_category_select=$thisCategory, post_featured_category=1"); $featuredColumns = wire("page")->post_featured_columns; if($featuredColumns == 2){ $featuredColumn = "span6"; }elseif ($featuredColumns == 1) { $featuredColumn = "span12"; } else { $featuredColumn = "span12"; } foreach ($posts as $post) { $out .="<div class='{$featuredColumn}'>"; if("$post->primaryimage"){ $out .="<a href='{$post->primaryimage->url}' class=''>"; $out .="<img src='{$post->primaryimage->getThumb("listingthumbnail")}' class='pull-left' />"; $out .="</a>"; } $out .="<a href='{$post->url}'><h3>{$post->title}</h3></a>"; $out .="<div class='post-byline'><i class='icon-time'></i> {$post->date} - Written By: {$post->createdUser->user_firstname} {$post->createdUser->user_lastname}</div>"; $out .=$post->summary; $out .="</div>"; } return $out; } // Get posts by category - does not include featured posts function getPostsbyCategory() { $thisCategory = wire("page")->title; $postColumns = wire("page")->post_columns; if($postColumns == 1){ $columns = "span12"; }elseif ($postColumns == 2){ $columns = "span6"; }elseif ($postColumns == 3) { $columns = "span4"; }else{ $columns = "span12"; } $posts = wire("pages")->find("post_category_select=$thisCategory, post_featured_category=0"); $out = " "; foreach ($posts as $post) { $out .="<div class='{$columns}'>"; $out .="<h3>{$post->title}</h3>"; $out .="</div>"; } return $out; } ?>
  12. Pete, any chance of a new "like" button. Basically, I want one that says: "I like this. I don't understand a bloody word of it and I cant get it to work, but I do like it." I have needed that a couple of times today.....
  13. Some of this you are talking about is more about what your post templates are up to - which fields they are using. Some will be common - title, maybe a main image, a summary perhaps. But then you will have specifics like price. Now, you will probably create different templates for each type of post, so that is not an issue. In the category, you can do two things. You can either create specific category templates for each post type, or you can use just the one template and test to see if specific fields that you need to display on the category exist. If your price field exists, then display it. If it doesn't then dont. That sort of thing. The main thing that will make you decide whether to have different category templates is if the layout for each subject matter needs to look very different - which is quite possible. As to whether you need different category templates for top level or sublevel within any particular tree, I don't think you do, to be honest. I am sort of beginning to answer some of your questions with a profile I am working on. It is a blog on steroids! I only have one category template, but I am putting a few controls in it using fields. (You have to bear in mind that I am using Bootstrap and my controls are aimed at that framework) So, for instance, I can change how many columns in the category template the posts are listed over. I have added a "featured category" checkbox on posts so I can have featured in each category that are always at the top of the page. (I also have a featured global which I will use for the home page - when I get there!) All my main post types have common fields, so I can list any type of post within one category. Because it is a blog, I can select whether in each category (or sub category - it is all the same) I make it look more like a blog layout or more magazine style. And there are some other bits. So, I can actually change some basic display elements on a category by category basis without changing the template. I am mostly doing this to prove I can, to be honest, rather than for any amazing reason. This is me learning still.
  14. With Processwire there are no directories in the admin. It is all pages. Pages can be used for anything (not just a page full of information). They can be used as a placeholder, or an option for a select (using the page field), or as an actual container for data. Your articles are pages, your categories are pages, your tabs are pages. What makes them different is that you would use a particular template to reflect what that page needs to achieve. Those templates may not have a template file associated with them - you only need to do that if you are formatting the data held in that page AND calling the page directly. (You can get information from another page by using $pages rather than $page) All pages do have relationships to parents and children, and using their template, you can dictate how that relationship works. For instance if you had a hidden page called "Posts" under home, and it had a template called "Post-Placeholder" which had no fields other than the title field, then you can set the template so that any children of "Posts" had to have a particular template - your "news" template, for instance. So you can limit the choices to make the system more manageable. It is up to you what a page is pretending to be, if you like! Just play with multiple pages and templates and you will soon see how you can relate them together and therefore how you can design just about any structure you need.
  15. Yeah, the sub menu issue is really going to upset a lot of people (in fact, it already has) They are focussing so much on mobile that they are ignoring the rest. People trying to use TB for e-commerce (which inevitably has a complex structure) are feeling particularly annoyed, I would imagine. I will end up doing solutions for both, I suspect. A lot of the things will cross over, but some wont. Also, I suspect you will see a lot of people using v3 but using a different menu system, as happened before they introduced sub menus. Having said that, even last week, going by one post I found, they were still undecided over the entire issue. On the row-fluid issue, yes I know they are not interested - which is why little JQuery solutions are so useful. The other work-round is to remove the left margin value all together. But then (as I have found out before) you spend a lot of time trying to get space back between things again.
  16. Oh, good luck ... Forms is my next port of call, I guess!
  17. Hi Sakkoulas By article types I mean I have created different templates to suit certain ideas. A standard blog type article, a Photo Post where the images is the most important issues, perhaps a review style template or a recipe ... anything really. A Page Field is a field type in ProcessWire that allows you to select one or more pages from the page tree. That means you can use it for including one page within another, or use pages to create select options or, in this case, to relate one page to another as you would with categories or tags and so on. This is an incomplete Wiki article about the page field showing how it can be used to create selects. But it will give you a clue about its greater use. http://wiki.processwire.com/index.php/Page_Field I am not sure what you mean about directories ... Joss
  18. Hi Onjegolders That is fine if it is the fourth item, but depending on what the span you are using of each item, it might be the second, third, fourth, sixth.... For the profile I am working on, you can set how many objects per row, so it will vary. Also, your grid may extend over several rows. Admittedly, this only works if you elements are equal, but it works with all the elements. I haven't used Foundation and I wont for the moment. I haven't finished creating Bootstrap profiles yet!
  19. There is an issue with the Twitter Bootstrap Thumbnails markup - basically, if they go to a second row it breaks, because the first item on the second row has a margin-left value which knocks the entire system off course. I have found the following bit of JQuery which solves the problem. It is better than using CSS as with CSS you have to work out the child, and older browsers don't understand that. The jquery works out which is the first item in the row and adds an additional class. The class needs to be in your style sheet somewhere, obviously. /* Put this in your style sheet */ .first-in-row { margin-left: 0 !important; }​ This is the JQuery for the thumbnails /** * Adds 0 left margin to the first thumbnail on each row that don't get it via CSS rules. * Recall the function when the floating of the elements changed. */ function fixThumbnailMargins() { $('.row-fluid .thumbnails').each(function () { var $thumbnails = $(this).children(), previousOffsetLeft = $thumbnails.first().offset().left; $thumbnails.removeClass('first-in-row'); $thumbnails.first().addClass('first-in-row'); $thumbnails.each(function () { var $thumbnail = $(this), offsetLeft = $thumbnail.offset().left; if (offsetLeft < previousOffsetLeft) { $thumbnail.addClass('first-in-row'); } previousOffsetLeft = offsetLeft; }); }); } // Fix the margins when potentally the floating changed $(window).resize(fixThumbnailMargins); fixThumbnailMargins(); I have modified the code to work for normal divs. This is useful where you might have posts in divs and in a grid - the same problem happens as with Thumbnails. In this case, the containing row-fluid div must have the additional class "theposts" added to it. /** * Adds 0 left margin to the first post on each row that don't get it via CSS rules. * Recall the function when the floating of the elements changed. */ function fixThepostMargins() { $('.row-fluid.theposts').each(function () { var $theposts = $(this).children(), previousOffsetLeft = $theposts.first().offset().left; $theposts.removeClass('first-in-row'); $theposts.first().addClass('first-in-row'); $theposts.each(function () { var $thepost = $(this), offsetLeft = $thepost.offset().left; if (offsetLeft < previousOffsetLeft) { $thepost.addClass('first-in-row'); } previousOffsetLeft = offsetLeft; }); }); } // Fix the margins when potentally the floating changed $(window).resize(fixThepostMargins); fixThepostMargins(); The original post about this can be found here: https://github.com/twitter/bootstrap/issues/3494 - Posted by a chap called Sanjo Joss
  20. Umm, except I am getting a bit stuck on it - I am definitely doing something wrong or leaving something out here....
  21. Which ever system you use, there will be customisation needs. There are several group style applications out there, but they are all going to be pretty general. The choice is between do you start with something that covers some of what you want, has a lot you might not need, but you can hack to add the functionality, or do you just start from scratch. If the latter, then PW would be a good choice, I suspect, probably with the addition of the Form Builder to make the creation of the form elements easier (but you could also do this by hand). The advantage with the first method is that you will already have some of the collaborative system in place as a starting point. The advantage of the ProcessWire route is that although it will be more work, you will get a more precise application designed to work exactly as you want.
  22. A quick note unrelated to the above. There is an issue with Twitter Bootstrap (and probably other responsive frameworks) that the max width of 100% messes up Jcrop. However, this can be solved by adding: #bd img { max-width: none !important; } To somewhere. And it is all better again.
  23. Okay, I think I am getting there! Thanks. I might work with you on a little tutorial for this. It is a really useful plugin that means better control of some items - but beginners like me might be a little bit out of their depth with it! Thanks again Joss
  24. Okay, update. Created a new field. Save Left all settings as default. Added it to template. It did not work. =========== Saved new field - leaving the settings as default. It now works. Changed settings. Still works. Not sure why I cannot get the other field to work, however. Something odd has happened during set up, I suppose, some combination that I have done.
×
×
  • Create New...