![]() |
escaping quotation marks in a template variable
I am redesigning one of my vB4 CMS widgets, "Recent Threads". It has variable for the preview of a thread post contents, it is called {vb:raw thread.previewtext}. I want to move it into the title attribute for the link to the thread (<a href="thread_url" title="thread_preview_text">) so that on most modern browsers the preview text will show up on hover over the link.
To work, I need to escape either double or single quotes from the text. Can I do this in a template? {vb:raw xxx} and {vb:urlencode xxx} aren't going to cut it for me. Is there an alternative that will escape my quotes? If not, any other suggestions? I suppose I could do a plug-in(?) but that template has no hook, and I have always been perplexed how to do a plug-in when there is no template hook. |
It looks like {vb:escapejs xxx} escapes single quotes with a backslash (and that's all it does, apparently).
|
You can use:
HTML Code:
{vb:var thread.previewtext} |
All times are GMT. The time now is 04:54 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|