I've just started to use this module, and now I am stuck without knowing how to make breadcrumbs for some pages that are not content, taxonomy or views.
More precisely I need to make crumbs for pages based on the "blog/130" pattern, where 130 is a user ID. This system path isn't a view, so I have to use custom paths to get to it. Using pathauto, I've turned these "blog/[uid]" paths into "forum/blogs/[username]".
Assuming that I can catch the right URL's with the wildcard character, how do I access variables for the specific user in the title and path fields? Using PHP I could extract these based on the URL, but I can't really pass any variables on to the title/path fields where I need them?!
Am I just missing something, or could this module need support for passing variables from the PHP field on to the title/path fields?
Comments
Comment #1
MGN commentedWhen you say they are not "content" do you mean they are not nodes? It seems like they ought to be nodes, and if they are you can setup the breadcrumb using the custom_breadcrumbs module - just click on the 'node' tab at /admin/build/custom_breadcrumbs and pick the "blog" node type.
(I could be wrong on the types of pages you are creating, so if you are not using the core blog module, explain how you are creating these "blog" pages, what contrib module you are using etc.)
If [username] refers to the page's author, you should be able to get what you are looking for by using some of the following tokens:
[author-uid] Node author's user id
[author-name] Node author's user name
I think there are other ways (using tokens for custom fields, profile fields, etc.) to do this. Perhaps other users can contribute their suggestions.
The breadcrumb visibility field accepts php just to determine whether a given breadcrumb should be displayed or not. It wasn't intended for the use you are suggesting. But generally this module manages to accomplish the same thing by using tokens (i.e. write the php to deliver the token, then use the token in custom breadcrumbs, and other modules). Note that you can also develop your own tokens using the Token starter kit.
Comment #2
rsm08 commentedThe pages I'm referring to aren't nodes. They're just pages created by custom functions. The "blog/[uid]" path is created by the core blog module I think, and the returned page isn't related to any specific node - it just displays a list of node teasers.
When no node is in the context, the tokens are unusable. Nobody knows that the number in the path is a uid, so the user tokens aren't available.
Anyway, tokens are though novice friendly a very cumbersome way to accomplish things. I can't figure out on top of my head how to make tokens based on pathauto url parts, and it seems to me that it would be easier to make a separate function that re-writes the breadcrumbs for these pages. But this could be avoided if your module made the url parts available. It should be fairly easy to implement.
I know that right now the php field is only for figuring out whether to re-write the breadcrumb, but why not give it more function by allowing it to pass a value to use in the re-written url?
Comment #3
MGN commentedOne possible feature (disabled by default, and only for roles assigned use php in custom breadcrumbs privledges) would be to allow php in the titles and paths (rather than trying to do it in the breadcrumb visibility section). Here is the idea (Drafted for the README.txt file):
Does this approach sound like it would be useful? Is there a better way? I am currently testing this, but thought I should check to see if this makes sense before moving it into 6.x-2.x-dev for testing.
Comment #4
MGN commentedI've now implemented this in custom_breadcrumbs 6.x-2.x-dev.