It looks like you're new here. If you want to get involved, click one of these buttons!
... but of course this just changes the actual address, not the a tag! :( Any suggestions please? I've had a look through the core PHP files and couldn't really see anything relating to it.$("a:external").attr("href", function () {
// ... prepending the prefix to the original value
return prefix + $(this).attr("href") + ' target="blank"';
});
Comments
$("a:external").attr("target", 'blank');Hi Mark,
Thanks for the tip. I am new to Vanilla. Just set it up within iframe of my site and the links are not opened in a new window. Where do I add your line of code to maek this happen? Thanks.
this is a jquery line and will go in any javascript files or in your page - if you are familiar with jquery
Theme Charcha for great desktop and mobile experience! - drop me a message :)
Thanks sahotataran. I haven't used JQuery, but other JS libararies. I see Vanilla deployed with jquery in the js folder. Is index.php a good place to put this code? I don't see any in that file. Should I create a conf/bootstrap.after.php to add this custom code?
no. you use your theme for adding additional code.
open /themes/yourtheme/views/default.master.php or default.master.tpl - you can add the above code in head using
Theme Charcha for great desktop and mobile experience! - drop me a message :)
Great. Thanks! You pointed me to the right direction. Looks like there are some reading for me to do regarding to the customization of Vanilla.
reminds me that whenever i add jquery to the default.master.tpl it bonks out :/
as in jquery.js ? its already loaded though @redtwentyfour
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
nono, i mean whenever i add any jquery code
Always add it to the footer
If you try and render jquery before jquery.js loads it will fail
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
Hmm, tried both to add it in either
<div id="Foot">or<head>but not working. I don't have customized theme. There is one "EmbedFriendly" in the folder, so added in EmbedFriendly/views/default.master.tpl. I tried to just put alert('hi') but it did nothing. Doesn't seem like this file is loaded?Probably issue with including file. The file is not at URL at which it was included probably
Theme Charcha for great desktop and mobile experience! - drop me a message :)
You want to put javascript between
{literal}..{/literal}tags if you are using smarty. Otherwise it will interpret your javascript curly braces as smarty tags.Vanilla co-founder