Aaron - Wolf X Machina
Aaron - Wolf X Machina

Reputation: 643

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?

Upvotes: 0

Views: 177

Answers (3)

iJungleBoy
iJungleBoy

Reputation: 5638

The core problem is that tokens are not well architected in DNN, there is no officialy "global" token system which knows about the DNN Sharp tokens.

I believe it should be easy to do though: I'm pretty sure there will be some documentation on DNN Sharp how to use their tokens in any c# or MVC page. Probably just 2-3 lines of code. So best check their docs.

Upvotes: 1

Tycho de Waard
Tycho de Waard

Reputation: 46

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.

Upvotes: 1

Tycho de Waard
Tycho de Waard

Reputation: 46

2SXC does not render DNNSharp tokens like html module or EasyDNNSolutions do. It would be an awesome thing as MyTokens and 2SXC are both very powerfull.

But maybe we can fix your problem within 2SXC itself or within DNN Sharp/HTML

What are you trying to accomplish? You can share the case / code here. Or if you feel this is beyond the Q&A setup that Stackoverflow is, you can send me an email.

Cheers Tycho

Upvotes: 0

Related Questions