Joss
PW-Moderators-
Posts
2,869 -
Joined
-
Last visited
-
Days Won
47
Everything posted by Joss
-
Yeah, the URL is right, it is the breadcrumb that is wrong. Or rather, the breadcrumb is accurately showing the real path to the post, rather than the fake one we have created for it.
-
Ah, that is not what I am getting. On the politics category page I am getting: domain.com/news/politics and the breadcrumb home > news (I could add the "politics" with an extra <li> but I haven't added that to your code.) When I click on a post, the url is: domain.com/news/politics/politic-post but the breadcrumb is: Home > Content Management > Posts > Political Post My URL segment code at the top of the category page is: if($input->urlSegment1){ //get the post $post = $pages->get("/content-management/posts/$input->urlSegment1/"); if(!$post->id) throw new Wire404Exception(); echo $post->render(); }else{ Category....
-
Well, actually it in in my header since it really needs to work through all the site. The trick is to make it work so it follows the false logic imposed by our URL segments. Actually, it gets worse than that. If you search for a post, then click on its link, you are back to square one. So, I suppose the ultimate bread crumb solutions will go something like this: Check if there is a category/page field (or whatever is the relevence for that particular site structure). In my case it would be looking for a value in post_category_select. If the field exists and there is a value, then that value is what we want to be the parent - work your way up the list and print out the breadcrumb trail If no value, then this is not a post, it must be something in the main site tree, so use normal breadcrumb system. That takes away the emphasis from the referring page, and introduces rules that are relevant to the actual viewed page. Maybe adding URL segments to that would not be helpful - or maybe a way. Not sure.
-
HI Diogo, Still no luck. Remember I am rendering the output from having identified the post. So, I am assuming that once it is being shown in its own template, the post has no knowledge of where it comes from. On that basis, maybe it needs to take the category path with it so that can be added to the breadcrumb?
-
Ryan okay, that is a neat title for a wiki page! Do you mind if I shorten it a little?? As for the breadcrumbs, the trouble with that is that is assumes a specific template and I am trying to avoid that - as you said, it can become too specific to a particular site. The only reason I though about bread crumbs, is if you are doing this to make your site more logical, there is a very good chance you are using bread crumbs too. So the two do go kind of hand in hand.
-
Hi Diogo Didn't work. The problem is that as soon as you hit the link, you jump over to the original path
-
Unfortunately, I am not a graphic designer. However, if you need a serious copywriter and composer with 35 years in advertising...... (and you don't mind a remote worker)
-
Just thinking about what Ryan says about the real (or perhaps old) place for the line should be so that the devs also take care of html and css as well as serverside leaving the designer to come up with the concept. Working like that does open the doors for great design to be sourced from outside of the web design world, bringing in some of the older or more specialised but brilliant designers that have not got involved because they know nothing about html (and have no time/interest in learning) Years ago I applied for a job doing sound for a games company. My CV includes sound credits on several feature films, work on massive launches for X-Files movie and British Airways, sound-effects design for TV, film, radio drama (which is probably more applicable) and more, and voice director on thousands of productions. Plus, I am a credited music editor and composer. BUT, I don't know any C++ or C# and so on. Sorry, said the idiot at the company, noting my lack of programming skills, we don't see what relevance your experience has to games. Their loss (and their subsequent game sounded awful), but it did demonstrate how easy it is to lose out on valuable knowledge, skills and creativity if you put the importance of technology above the needs of the product. So, perhaps Ryan's observation has huge relevance even today. Personally I still believe the pencil and paper is still the most powerful concept design tool there is.
- 74 replies
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
Yeah sure - any ideas what I should call it? And any thoughts on a breadcrumb code that builds on this? It is the one, rather glaring hole in the solution
-
Just a thought about legalities, on certain sites there may be either a legal requirement or necessity to keep old versions for ever. For instance, records about users may be required to kept so that changes in user details are recorded, and news sites may want to keep old versions in case of legal disputes over the accuracy of published information.
-
The next trick, of course, is make the breadcrumbs work in the same way!
-
Hi Diogo I have just written this up on the wiki at the end of Ryan's URL Segments post. Can you pretend you don't know how it works and check if it makes sense? http://wiki.processwire.com/index.php/URL_Segments#Example_-_Using_URL_Segments_to_link_catgories_to_posts
-
I forgot about the existence of render() Thanks a million both of you. My boostrap/themable/ultra blog profile is now one step closer!
-
Ah, okay, I am beginning to understand how this works now. I am suffering from reading too many posts about this and it has turned to mush. So.... I now return the post title on a blank page. Do I put all my post template code at that point, or do I use the post template in some other way? Thanks chaps!
-
Where I am getting confused is that I am starting with a FIND to get the array of posts that have this category as the one selected in post_category_select. I have an array variable called $posts and I am looping through that, as in my original post. That is all working fine and I am listing posts correctly. What I cant work out is how to translate what you guys are saying into my foreach loop so that it actually links to my post. This is probably me not understanding how the UrlSegments system is meant to work. Joss
-
Thanks Thomas, unfortunately that does not work. Although it looks right, there isn't actually a post at /news/politics/political post. So it just does nothing because it has nothing to link to. That is why I need to use URL segments (I think).
-
This should be interesting. I tried to modify that file my self to see the implications, but all I managed was to scare next doors cat EDit: Okay, I think mine is still another issue. Well, worth a try!
-
Hi Thomas The problem is my URLs rather than finding the posts. Because the actual posts are stored out of the tree, my category URL is: domain.com/news/politics/ But my political post which is linked to the politics category is domain.com/content-management/posts/political-post So I want to end up with: domain.com/news/politics/political-post Joss
-
Hi Soma - can I test this somehow? I am wondering whether it is the same issue that effected by actions button, because that also meant that when you selected "move" you hadn't actually selected the row first (which I hadn't thought about before).
-
I cant speak from the web development world, but having been in the advertising, film and music worlds for 35 years I can speak for the web's great ancestors. I think there is a huge difference between specialisation and isolation. In the industry I come from, although we do have dedicated technical roles, most roles are specialisations out of choice from people that start from pretty much the same point - a runner, mostly! So, the the recoding engineer, voice over director, video editor, film writer, producer, advertising creative director, could have all been the same person originally. That sort of evolutionary career path produces something that is vital in some of the huge, multi-million dollar projects I have been involved with over the years (often just in tiny way) We all understand what each other does. That does not mean we could do each other's jobs, but we can bring our particular specialisation as a perspective. So as a sound person, I might pick up a visual edit that has not worked. An editor might notice a glitch on the sound track that I have missed. This is all despite the fact that the unions over the years have tried to stop people knowing (let alone doing) each others work. So, basically I believe that there should be a team - between the client, the developer and the designer (and possibly the often neglected marketing/pr guru). And although each should bring their specialisation to the table, they should appreciate each other's perspectives and career-informed opinions. To communicate those it helps if they understand each others work. And if that means the designer phoning the developer and saying "how can I grab that bit of data so I can play with it," then all the better. Sometimes treading on each other's toes is the beginning of being able to dance together... Joss (2013)
- 74 replies
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
(Note, this might be aimed at the overworked Soma, simply because he has done posts on this before! - http://processwire.com/talk/topic/2519-nested-categories/?hl=segment#entry24077 ) I am trying to work URL segments into a function for getting posts belonging to categories in a tree. This is my current code (with some rubbish kicked out) function getPostsbyCategory() { $thisCategory = wire("page"); $posts = wire("pages")->find("post_category_select=$thisCategory, post_featured_category=0"); foreach ($posts as $post) { echo "<a href='{$post->url}'><h4>{$post->title}</h4></a>"; echo "</div>"; } } The actual posts are to be found at /content-management/posts/POST-NAME - so the post name is three down. The templates can vary. The categories are in the normal page hierarchical structure and all have the same template of "category" with URL segments on. I am assuming that I need to capture the url segment within the foreach, but I have confused myself as to how and what to do with it. My attempts have so far only thrown errors, so I wont even repeat those here. Any clues would be very nice! Joss
-
I have never seen any flat rate taxes (the only other kind) applied to goods, at least not those sold online. We used to have a window tax, but that was abolished a couple of centuries ago. There can be two ways of including the tax, either as an addition or as part of the price. Really this is down to best practice and local laws. In the UK, when selling retail, the price you quote MUST include VAT. When selling wholesale to companies, it is normal to quote the price without the VAT since the buying company can probably claim it back. The way round it is to have a Price box, a dropdown for the tax (with a default or you will annoy people who have hundreds of products to add), and then a check box for "price excludes tax." Again, the other way around in annoying since most ecommerce is retail and therefore includes tax. As for the regional variations, I am not sure how that works. I suspect it is sometimes taken care of by the payment gateway, because I often find that that is the point when it changes. But I am really not sure at all. By the way, this is interesting, because the client for whom I have just re-templated his site wants to jump to a new solution in 18 months or so. His is a very basic shop (as in, it is all hard goods and nothing complicated), but he has 13,000 products spread across about 10,000 categories. So we might have a big challenge in the future! Joss
-
HI Soma First works perfectly - and I have learned a lot from that, thanks Second one was more problematic. It didn't do anything initially, but I have changed is slightly because in your foreach I think you mean $posts not $page->children? Changing it worked but I ran into a problem when I tried it on a page that is at the end of branch - it kind of listed everything including most of the contents of the British library! So I added an IF which I think is right? Anyway, here is the final function getChildCategoriesPosts($page=null) { if(!$page) $page = wire('page'); $out = ''; $categories = wire("pages")->find("has_parent=$page,template=category"); if($categories->count()){ $posts = wire("pages")->find("post_category_select=$categories, sort=-modified, limit=10"); if($posts->count()){ foreach($posts as $post) $out .= "<li><a href='{$post->url}'>{$post->title}</a></li>"; } else { return "<li>No Posts found/p>"; } } return "<div><ul>$out</ul></div>"; } Thanks again!
-
How to package a site to install it on another machine?
Joss replied to demhan's topic in Getting Started
ummm Try uninstalling the module Forget that - I just read your post properly