Escape Views' replacement patterns

Views replacement patterns are great, but they take up valuable variable real-estate. If you need to literally output "[nid]" rather than the value of its corresponding replacement pattern, you might start hitting your head against the wall.

I found this issue to be particularly annoying when using the Prepopulate module, which required CCK field names (with bracketed arrays) to a URL.

Never fear! Rather than using "[nid]" in your views text, try using percent encoding rather than literal brackets. The result would be:

%5Bnid%5D

Using percent encoding with stop views from replacing the replacement pattern with a dynamic value.

This was exactly what I was looking for and has saved me quite a headache! Thanks for posting!

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.