Am I able to create a taxonomy/term/%/x view path using the term alias? - drupal

I have enabled the built in taxonomy/term/% view
I have created a display with path /taxonomy/term/%/test
I also have a URL alias setup on the taxonomy/term path to be /fruits/apple
So I would expect this to work /fruits/apple/test would display my view.
When I browse to this path I get Page not found.
If I browse to the un-aliased path ie /taxonomy/term/156/test it works.
Should the alias work like this?
Ive tried every combination I can think of. Reenabled the view, created new displays, removed all other displays etc

Try this: Path redirect. If itsn't help, rewrite engine help to you.

Try sub-pathauto module.
This module extends that behavior by also matching known sub-paths and
replacing them with their respective alias.
For example, if user/1 is aliased to users/admin, this module rewrites
the link to the user contact page user/1/contact to use the aliased
URL users/admin/contact instead.

Related

ASP.Net pages relative paths?

I have a website which i run localy and the path on the browser is
"http://localhost:3184/basel/index.aspx"
I have a menu which contains various hyperlinks and one of them is:
//This will evaluate to http://localhost:3184/basel/en/open-account/index.aspx.
The hyperlink will redirect me the page above, After that when i try to click the same link again on the menu, the path of the page is the following:
"http://localhost:3184/basel/en/open-account/en/open-account/index.aspx"
Why is it that the path have duplicated, i have been struggling for a while but can't seem to figure this out, Any solution ?
Try this:
Using the tilde creates an application-relative path.
What is in your code behind? If the A tag is being set dynamically (maybe something like this myHyperlink.NavigateURL += "en/open-account/index.aspx";) then each time the page is loaded the URL will have a new value appended to the end.
Maybe check the code behind to see if this URL is being manipulated there? If you've already done so, my apologies :)
Use Page.ResolveUrl() method. If the relativeUrl have an absolute URL, the URL is returned unchanged. If the relativeUrl have contains a relative URL, that URL is changed to a relative URL that is correct for the current request path, so that the browser can resolve the URL

View not working with url alias

My view is working with
www.localhost/drupal/node/13
but not with
www.localhost/drupal/challenge/13
I have changed the node/13 to challenge/13 using URL alias. Even my page path settings are:
challenge/%
It is just linking to its node rather than displaying the view.
Can someone please help?
Your two alias settings are conflicting with eachother ... Views is trying to stake a claim to challenge/13, but your alias table is saying "No, no, no. challenge/13 is supposed to point to node/13"
URL aliases have the last say in deciding where a URL points, so the URL ends up sending you to node/13
If you delete the alias entry via admin/build/path/list and rebuild your menus, it should work correctly.

iis7 url rewrite - optional querystring parameters

I'm using the iis7 URL Rewrite module and it's working fine, except for two things. Being new to this, I might be missing something obvious.
1) My URL gets converted from
www.mysite.com/search.aspx?fName=John&sName=Smith
to www.mysite.com/John/Smith. This works fine, but if I add a trailing / , a few images on the site disappear, wheras a few don't. (They're all in the same location). However, the search results are fine.
2) Is it possible to make cerain querystrings optional? Server side, this is implemented (i.e. if nothing is entered, then assume a default value). But how would this work with the URL rewrite module?
e.g. www.mysite.com/John would search for John and use a default value for the sName parameter.
Thanks for any help.
I can't help with the optional query string parameters I'm afraid, but the images one should be fairly easy:
How are you declaring the image paths in your markup? If you are using relative paths (i.e. src="../Images/someimage.png" then adding a trailing slash to the URL is telling the browser that the /Images/ folder is under the folder /John/ instead of being at the root of the site.
If you are using HTML <img /> tags, you should prefer a virtual path: src="/Images/someimage.png" - this tells the browser to request the image path from the root of your site.
If your application isn't running in the root of the site, you can also use the ResolveUrl method that is part of the page and control object tree, this allows you to pass in a virtual path of the form ~/Images/someimage.png and the framework will work out what the correct path should be.

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!

Drupal paths in themes

On certain pages drupal_get_path isn't working correctly (or it is and I've got the wrong function)
The base path is wrong
Example:
Image is supposed to be at
http://domain.com/sites/all/modules/pecapture/images/headline_dontmissout.jpg
But when on
http://domain.com/node/9
The URL is
http://domain.com/node/sites/all/modules/pecapture/images/headline_dontmissout.jpg
The same happens on the page
http://domain.com/admin/build/ and block edit page
How do I get the right path?
added base_path() to beginning of my paths...
base_path (http://api.drupal.org/api/base_path), if you use php code.
In html case, just add "/", like: /sites/all/modules/pecapture/images/headline_dontmissout.jpg
One problem: if you work on subfolder (Drupal installed in internal folder of main site): http://domain.com/subfoldersite, it will not correct, becase will remove "subfoldersite".

Resources