Closed GoogleCodeExporter closed 8 years ago
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 dominic....@gmail.com
on 25 Oct 2012 at 1:29
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 rwars...@gmail.com
on 25 Oct 2012 at 1:36
Marking as non-issue... haven't heard any updates are have heard reports of
this issue from anyone else.
Original comment by alex@tahzoo.com
on 21 Dec 2012 at 2:23
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 joy.priy...@gmail.com
on 31 Jan 2013 at 12:20
Original issue reported on code.google.com by
joy.priy...@gmail.com
on 22 Oct 2012 at 11:49