I want to do something like the following in my spark view.
@{this.LinkTo("1234")}
Which should output something like
<a href="domain.tld?var=1234">1234</a>
I cannot seem to find a good way to do this.
Most searches for "fubumvc htmlhelpers" end up giving me more pages about htmlhelpers in msmvc.
A plus would be if I could put the code in a separate assembly that I can share between multiple sites.
Solution
namespace MyNamespace { public static class FubuPageExtensions { public static HtmlTag LinkTo(this IFubuPage page, string input) { return new LinkTag(input, "domain.tld?var={0}".ToFormat(input)); } } }
...and in my spark view
<use namespace="MyNamespace" /> ${this.LinkTo(Model.Something)}