Coder Social home page Coder Social logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 12, 2024
Priyank - if you look at         
Tridion.Extensions.Mediators.Razor.RazorHandler.GetImportTemplateContent(), you 
will see that the webdav url is passed unchanged to the Tridion session. Have 
you verified that your webdav url can successfully retrieve the item from the 
Tridion API?

Original comment by [email protected] on 25 Oct 2012 at 1:29

from razor-mediator-4-tridion.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 12, 2024
It seems like your escaping the double quotes? Not sure if that's needed. We 
also reference our helper files in this way, which works fine (in 1.2 and 1.3):

<add 
import="/webdav/20%20Developer%20-%20Templates/Building%20Blocks/System/Libs/Raz
or/Helpers/RTBB_Helpers.cshtml" />

Note we also use %20 for spacing, I'm aware it should not be needed, but it's 
habit :).

Original comment by [email protected] on 25 Oct 2012 at 1:36

from razor-mediator-4-tridion.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 12, 2024
Marking as non-issue... haven't heard any updates are have heard reports of 
this issue from anyone else.

Original comment by [email protected] on 21 Dec 2012 at 2:23

  • Changed state: WontFix

from razor-mediator-4-tridion.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 12, 2024
Hi Alex, 

Sorry for not responded you earlier. 

Today, i am going to set-up razor helper function for new environment, and face 
same issue with internal TBB file, 

Just for update, I am using the following steps to use razor helper function in 
all others razor TBBs.

1. Created a TBB file Named as "Helper" which web dev Url is 
/webdav/03C%20Medical%20Content/Building%20Blocks/System/Templates%20Building%20
Blocks/Razor%20Templates/Helper.cshtml

In this file i wrote a simple "test" helper function like below

@helper test()
        {
        <p>Working correctly</p>
    }

2. Added this TBB path in the config file in razor section tag like below 
<add 
import="/webdav/02%20Global%20Design/Building%20Blocks/System/Templates%20Buildi
ng%20Blocks/Razor%20Templates/Helper.cshtml" />

3. Restarted the Com++ package and tridion services

4. Create a new razor TBB, and tried to call test() helper function like below

@test()

but when i save this file then getting the below error

Error:

TemplateCompileException: CS0103: The name 'test' does not exist in the current 
context 
 Line 48 Column 7: WriteLiteral("\r\n\r\n\r\n");
 * Write(test());
 }
 }
 }

 Stack Trace: 
 at Tridion.Extensions.Mediators.Razor.Templating.Compiler.Compile(IEnumerable`1 entries, IEnumerable`1 assemblyReferences)
 at Tridion.Extensions.Mediators.Razor.Templating.RazorTemplateGenerator.CompileTemplates(IEnumerable`1 assemblyReferences)
 at Tridion.Extensions.Mediators.Razor.RazorHandler.Compile(DateTime revisionDate)
Unable to save Template Building Block (tcm:0-0-0).

2.a Suppose, if i use a different approach in steps 2 and pass tcm uri instead 
of webdev path like below 

<add import="tcm:2-421-2048" />

Then i am getting the below different error

Error: The item tcm:0-421-2048 does not exist.

2.b But, i am successfully able to call that helper function if i create 
External Helper file and pass the physical path in the config file like below 

<add import="C:\Program Files (x86)\Tridion\Razor Mediator\helpers.cshtml" />
Note: This is a another file, which is used for different helper function and 
saved at the same above path

Then its working correctly.

I would like to go with approach explained in stpes 2 and 2.a for sake best 
practices. Could you please help me on same?

Thanks

Kind regards,
Priyank


Original comment by [email protected] on 31 Jan 2013 at 12:20

from razor-mediator-4-tridion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.