I'm stuck on (what I think is) a simple views issue.
I have a view with a page display, with a path of:
/mydir/%/%
Some URLs I would hit are:
/mydir/pc/2008/
/mydir/xbox/2007/
/mydir/pc/
%1 and %2 are different CCK fields. When I specify the path with both arguments:
/mydir/pc/2008/
it works great. But the one argument paths:
/mydir/pc/
/mydir/xbox
aren't working at all. I get a 404 page not found (and I did not select the 404 option in my view).
The breadcrumb links on this page:
/mydir/pc/2008/
link to
/mydir/pc/*
which just outputs a * to the screen. Sometimes I've been able to configure it to output all the right stuff with
/mydir/pc/*
but I don't want the * there, I just want
/mydir/pc/
I tweaked all of the argument settings for each argument in every way possible I can imagine, and I can't get my desired behavior, which is that this URL:
/mydir/pc/
just ignores or uses any match for the second argument and matches the first.
Also odd: The preview tool in the view works correctly, if I pass in just pc/ in the arguments box. The URL that is outputted in the views preview ouput is also correct: /mydir/pc/. But if I click on that (after saving), I still get the 404.
What am I doing wrong?
I figured this out. My path setting for the page display on the view was:
apocalypse/%/%
but should have been
apocalypse/%
Related
This is the problem:
I have a menu link which I want to resolve to domain/course/2
This menu link is on a menu bar. The menu bar is visible on all pages of the web site including /home and /course/1
If I code the menu link like this:
href="/course/2"
then that works fine for navigation. However if I am on /domain/app_dev.php/course/1 then that style of doing the links loses the app_dev and I jump into production i.e. I go to domain/course/2 not /domain/app_dev.php/course/2. Not what I want.
However if I code the menu link like this:
href="course/2"
Then that does not break app_dev. However the navigation breaks. Because it is a relative path if I am in /course/1 when I click on that link I end up in /course/course/2 which of course (no pun intended) doesn't exist.
I can see how I can fix this by making my nav bar know what page (directory) it is being loaded on and set the links dynamically. But this feels a bit "hacky".
This must be a v. common problem with Symfony. How is it best solved?
Looks like you are generating links in "hardcode" style, instead of
href="/course/2"
you should use "path" function, so if you have the route name "closure" for your controller action, then you should use
href="{{ path('closure', {id: 2})}}"
Where "id" is expected action parameter. And I suppose you use Twig as template engine
. .
I'm trying to set up IIS 7 to use custom error pages, but I'm running into a problem that I can't seem to get around. I've looked nearly everywhere for an answer to this, and have come up empty.
Here's the deal: I open IIS, go into Error Pages (note: this is a classic ASP environment), and open Edit Feature Settings. I set my path type to Execute URL and set my path (for example purposes, let's say it's "/errors/SomeError.asp"). I also set it to "Custom Error Pages."
For the most part, it seems to be okay, but here's where I run into trouble.
I'm sure you've all seen the errors where your page partially loads, and the error appears in the middle of the page. (For example, you'll see your page template, and somewhere in the middle, you'll see your "Error 500 . . . " blah blah blah.)
The error page I created (the "/errors/SomeError.asp" I mention above) is a full page, complete with template and everything.
When an error occurs mid-page, it does not redirect to my custom error page. Instead, the page is "nested" -- that is, the full page appears right in the middle of the problem page -- so it looks like a full page within a full page.
I want it to go to the error page, not have the error page nested within the page.
How do I get around this?
Thanks in advance.
I just answered my own question.
Instead of setting path type to "Execute URL," I set it to "Redirect." Problem solved.
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.
I am trying to create a Block View filtering by the path's (actually an alias) third argument, but can't succeed.
The path where the block is displayed is sitename.com/first/second/third.
Actually the third argument is the node's author, in the end, I am trying to display a block where only the content created be the author of the node the block is in...
I.e: in the content type Garage node created by user Joe, there should be a block of content type Cars created by Joe. The node's path would then be garagecars.com/garages/spain/joe.
I have tried setting 3 Global:Null arguments and then User:Uid but it doesn't work.
Help? Any other way to filter by node author? (have been a long while searching and the "filter by path arguments" approach seemed the good one, but I must be missing something then).
UPDATE: in the Views preview the path garages/spain/joe works but it doesn't in the page itself http://garagecars.com/garages/spain/joe... which has me ever more puzzled.
SOLVED: I was inserting the blog programatically throught the views_embed_view($viewName, $display_id, $args)... that's why it DID work on preview but when the page was rendered, the arguments set programmatically overrode the one's in the path, thus not working.
Solved in the same question. Information provided on making this work.
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!