Search code examples
dotnetnuke2sxc

How can I use DNNSharp MyTokens in 2SXC Razor templates?


I have a content type and C# Razor template for a simple page hero built using 2SXC. I also have a DNNSharp MyTokens with a simple token that looks like this: [DBQ:EligibleForExam]

Using the regular DNN HTML module, I can put my token in the source and it renders the value of the token.

I want to display the value of this DNNSharp MyToken inside of the C# Razor template but it doesn't show the value. Furthermore, I want to perform an if else statement on this value.

Here's what I want to do:

@if [DBQ:EligibleForExam] = 1 {
   <p>You are eligible for the exam</p>
}

How can I use DNNSharp MyTokens in 2SXC?


Solution

  • In this case you can choose between going all the way 2sxc or all the way DNNSharp : - scenario 2sxc: translate the DNNSharp token to 2SXC. I don't know what's behind that code but I guess it is some kind of SQL select and/or filters. In 2SXC you can create content types with SQL as a source. In the query designer, you can filter these results. - scenario DDNSharp: in MyTokens you create a razorscript or HTML and make a token out of that. I don't think you hit any barriers soon following this path.