Menu path in Pathauto - drupal

How do I get pathauto under Drupal 7 to generate a URL alias by the full menu path?

Just an update in case anyone comes across this with a more recent version of Pathauto/Token. This worked for me:
[node:menu-link:parents:join-path]/[node:menu-link]

I ended up using:
[node:menu-link:parent:url:path]/[node:menu-link]
Heavy caution though: If the node does not have a menu link, you'll end up without an automatically aliased page. On the bright side, this might make you aware of orphan pages. (Consider it a feature!)
Note that using the pattern:
[node:menu-link:url:path]/[node:menu-link]
will only give the node's menu link, not that of the parent (which would be needed to reference the parent's path).
Or the pattern:
[node:parent:url:path]/[node:menu-link]
throws an error in my instance of Drupal 7 about invalid tokens (even though I have the token module installed).

[node:menu-link:parent:url:path]/[node:title]
If the node is not in the menu, then it does not create an alias. Otherwise this seems to work for n-tier menus.

I think it has to be this pattern now:
[node:menu-link:url:path]/[node:menu-link]
"path" instead of "alias"

You'll need to install the contrib Token module as well -- although a lot of the features of Token are part of core in D7, some of the edge case tokens (like the full menu path of a given node) aren't provided by core automatically.
With that installed, I believe that [node:menu-link:parent] or [node:menu-link:parent:url] should work.

The pattern that works for me is the following:
[node:menu-link:parent:url:alias]/[node:menu-link]
I also intalled the Token module like Eaten suggested. Don't know if [node:menu-link:parent:url:alias] is part of core or lives in contrib.

If you're attempting to make aliases for pages that are 3rd level or deeper, for example:
Home page
> Level 1 page
> Level 2 page
> Level 3 page
and you want the alias for Level 3 page to look like http://domain.com/level-1/level-2/level-3, I got it to work for me by setting my pattern to:
[node:menu-link:parent:parent:parent:title]/[node:menu-link:parent:parent:title]/[node:menu-link:parent:title]/[node:title]
Notice that I added :parent to the token, and for the first one I added it twice.

Enjoy!
[node:menu-link:parents:join-path]/[node:title].html

This is the solution I use:
[node:menu-link:parents:join:/]/[node:menu-link]
It will separate parent menu items with a dash. That is what I need.

For anyone who stumbles upon this answer, and wonders how to add this:
Configuration > Search and Metadata > URL aliases, then create under "Patterns" tab.

Related

Drupal 7:Pathauto patterns from menu structure hierarchy

I'm trying to create a Pathauto pattern which looks like "Drupal root/parent_menu_item_name/node_title" where "node_title" is a child of "parent_menu_item_name" in the menu hierarchy.
I've tried many different variations, and nothing works. I've tried the suggestions in Menu path in Pathauto, and none of them works at all. It just ends up outputting the node-title, with nothing before it.
I've got the latest versions of the Token and Pathauto modules installed.
I believe this question has been answered by Kenan:
Kenan's answer
[node:menu-link:parent:url:path]/[node:title]
It works for me, so I'm very happy!
The token combination [node:menu-link:parent:url:alias]/[node:menu-link] shall work with the following modules :
token : 7.x-1.0-beta3
pathauto: 7.x-1.0-rc2
The token patterns seem to vary depending on the version of the token module.
This token uses the menu titles of each parent item to build a url:
[node:menu-link:parents:join-path]/[node:title]
So if you have nested content titled: The Future -> Doc Brown -> Flux Capacitor
The above token will print out:
/the-future/doc-brown/flux-capacitor
This combination works perfectly for me
[node:menu-link:parents:join-path]/[node:menu-link:title]
with the latest token (7.x-1.5) and pathauto (7.x-1.2).
This works for me (for book type nodes): [node:menu-link:parent:title]/[node:title]
Found on: http://www.metachunk.com/blog/drupal-7-path-auto-menu-pattern

redirect to a page is not working properly in asp .net which is inside sub folder

I have sub folders says X,Y,Z. I'm making menu list dynamically using 'ul', 'li' tags based on user rights. Inside 'li' tag i have 'a href="#"' tag. The tag 'a' filled from database dynamically.
The problem is the tag 'a' has link X/home.aspx. When i click first time this works since it is available. second time 404 page not found error arising. The link become X/X/home.aspx. Obviously this structure is not available. So, how to redirect.
Thanks
I don't know exactly how your href is continually being added to in this specific scenario (it's a bit of a pitfall in a number of areas, sometimes when using custom controls, etc.), however, you should qualify all of your links from the root by using a prefixed forward-slash (/, i.e. /x/home.aspx).
But we're not done, ASP.NET can transform these too, in other scenarios, so you might want to use the tilde+forward-slash prefix (~/, i.e. ~/x/home.aspx); this indicates the root of the virtual directory where the site is housed.
In this way, regardless of which level of the sites directories you are in, the links always refer to a full path, so to speak.
Your hrefs are relative from the page not from the root of your site...
So do not use "x/home" but use "/x/home".. or use "~/x/home"
Probably you are appending the directory.
If you click for 3rd time you get X/X/X/home.aspx?
Post your code in order to get more help.
Use Page.ResolveUrl
Page.ResolveUrl("~/x/home.aspx")

Theming view, block id

I've created a block in a view, but in de source code that block has the folowing id:
block-views-Work-block_1
'Work', is the name of the view but i identifies the block by 'block_1', isn't there a way to change this to the name of the block for example?
When i see block_1 in my css file it isn't really clear what it is.
In Views 3, you can change that under Basic Settings -> Machine Name.
It doesn't appear to be possible to change the machine name in Views 2.
as keva says, Views 3 has the Ability to change display ids. if this feature is really important to you, go ahead and install Views 3. note that the latest release version is alpha quality. you might try the 6.x-3.x-dev version, which should have more bugs fixed (but possibly also new ones introduced).

Umbraco Admin UI not showing Tree Nodes thumbnail

When installing an Umbraco site, I changed my umbraco admin url from '/umbraco/' to '/myadminurl/', even before I went through the install process.
Just like it's documented, I changed in the web.config the keys 'umbracoReservedPaths' and 'umbracoPath' to match my new admin url.
Installed and everything is working fine, except for one thing:
All the nodes in the trees in all sections aren't showing any thumbnails. There used to be a win folder thumb before each tree node, but now it's just empty, except for the 'packages' node in the developer section, and for the recycle bin thumb.
Am I missing anything else I should had changed?
Thanks!
Lee Kelleher answered my question in the Umbraco forum here.
The answer is that it looks like the image reference for the tree icons are hard-coded to use the "/umbraco" path.
2 options:
Manually create the path to the image? The CSS is specifically looking for...
/umbraco/images/umbraco/sprites.png
Change the reference in the CSS, (rule for ".tree.tree-umbraco li a") ...
/umbraco_client/Tree/Themes/umbraco/style.css
Cheers!

Add a Drupal menu item with a hard coded path to a view that accepts arguments?

I have a view page that accepts a taxonomy term id as an argument at /foo/%bar. I want to add several menu items to the primary links in the form of /foo/actual-bar.
Whenever I try to do this I get the error message "The path '/foo/actual-bar' is either invalid or you do not have access to it."
How can I add such menu items?
Thanks,
Finbarr
Off the top of my head I believe there are a couple ways to do this:
Use absolute URLs (http://yoursite.com/foo/actual-bar) in the menu, which should bypass the check.
Define the links in a custom module using hook_menu()
It does seem to me that there should be a better way to achieve this, but these two options should at least get your going in the short term.
Another way would be to set the url in the view to foo/% it makes the argument required and the 6.x menu system will then see it as a valid URL.
However, just /foo will no longer be a valid URL, so you may need to create another page display in the view to accommodate the URL with no argument.
i recommend set path in such way: /foo/%/bar
so you can access it via: /foo/actual/bar
Oddly, I have a custom module that defines a hook_menu but the menu UI won't allow me to enter it into the system.
Had to do the absolute path solution... though I sure don't like it!

Resources