I have an argument in Views that has a dash in it (7-11). Views (or php) is replacing the dash with a space (7 11). Is there a way to keep the dash in there?

Comments

traviscarden’s picture

Title: Can't Display A Dash In An Argument » Pound Signs, Plus Signs, Dashes, and Backslashes (#+-/) Break Arguments
Category: feature » bug

[Comment removed to #672606: Hyphens and forward slashes (-/) break Views contextual filters] (Sorry; I read this issue too fast.)

traviscarden’s picture

Title: Pound Signs, Plus Signs, Dashes, and Backslashes (#+-/) Break Arguments » Can't Display A Dash In An Argument
Category: bug » support

ericinwisconsin, when you say the dash is being replaced with a space, do you mean in the path generated by a summary when the argument isn't present, or in the page title or breadcrumb when viewing that path?

ericinwisconsin’s picture

This is probably too much info, but here I go...

I have a website dedicated to old magazines. I'm using the insert view module to insert a view into a node. To do this, I have to include some arguments, including the magazine title (7-11) and the name of the publisher (in this case, unknown). This will show all of the issues of 7-11 I have on the site. I just have to put this into the body of the node:

[view:matrix_mag=page_6=unknown,7-11]

That inserts the proper view into the node. Or at least, it WOULD insert it, if it weren't for that pesky dash. The dash gets stripped out and it looks for all magazines named "7 11", not "7-11", which means that no magazines are shown. I can work around this by just naming the magazines "7 11" instead of "7-11". No big deal. But IS there a way to include that dash?

traviscarden’s picture

My first thought is that I wonder if you would have better success with the Views attach module, which accomplishes largely the same thing, but without you having to manually specify arguments--it can take them from node tokens and such. But secondly, I wonder if it would make it easier for you to specify the node ID (nid) to the magazines instead of their titles in your argument. That way there's no special characters problem, and you can even rename the mags down the line without breaking your Views. Hopefully this helps!

stefanhapper’s picture

Not sure if this addresses completely your problem, but maybe for others: Try turning off the option "Transform spaces to dashes in URL" in the views arguments settings for that field

esmerel’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.