Comments (4)
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.
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.
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.
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)
- Smart quotes in code samples in document will not compile HOT 2
- Unable to save existing (v1.2) tbb's with version 1.3 HOT 3
- Patch for /trunk/Tridion.Extensions.Mediators.RazorMediator/Tridion.Extensions.Mediators.RazorMediator/Models/DynamicPackage.cs HOT 2
- Unable to Content Port Razor Code Using Content Porter SP1 HOT 1
- Not able to import razor template even after placing import settings HOT 1
- Razor template is not working in SiteEdit HOT 1
- Memory leak: Templates are removed from cache, therefore recompiled. Original assembly can't be unloaded HOT 3
- Memory leak: AppDomain assembly resolve handler not unhooked causing template objects to leak. HOT 4
- Null reference exception when creating new razor tbb
- Globally imported TBBs have a dependency on themselves created if includeConfigWhereUsed is true
- Razor config imports with publications attribute does not work and break all razor templates
- Models.GetCategory does not exist
- Saving templates fails if admin user not configured HOT 3
- How to add page directives in Razor HOT 1
- Imported Razor TBB's not up-to-date HOT 2
- Memory leak Issues with Razor Mediator 1.3.3
- unable to get template type with id:8 while publishing
- function IsSiteEditEnabled stopped working after topology installment HOT 1
- Support of Tridion (SDL) 9.1 or 9.5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from razor-mediator-4-tridion.