I've created a doctype imagerender and inside this i've created a doctype imagePlaceholder. The Placeholder holds the property imgUpload (in this case the DAMP).
Than i've created in the Developersection a new script razor cshtml and include this one into my template with the Doctype Imagerender
The sample provided is nice, but is also shows some of the problems of Razor. There are a lot of if statements in it, where in xslt none would be required to do the same. Here is an XPath sample:
I know XPath can also be used in Razor, but that's cheating ;-). Somehow it would already be a lot easier if the first node wasn't removed like it says here. Can that be disabled somehow?
In the latest change set I've created a helper method to get the crop url in razor. That way you don't need to loop through all the crops. Here is a small sample:
@Jeroen - Snippet done - read more inside
Hy Jeroen and sorry for my long abstinence.
I've manged to handle with the media picker and cropped images at once and yes the snippet supports multiple pictures and crops in one instance.
Here comes the code:
And here's a screenshot rendering the whole thing :
Have FUN !!!! :)
Hi Toni,
Thanks for the snippet! I'll try it out soon.
Jeroen
hehe okay.
Am nice to know is my sitestructe:
I've created a doctype imagerender and inside this i've created a doctype imagePlaceholder.
The Placeholder holds the property imgUpload (in this case the DAMP).
Than i've created in the Developersection a new script razor cshtml and include this one into my template with the Doctype Imagerender
The sample provided is nice, but is also shows some of the problems of Razor. There are a lot of if statements in it, where in xslt none would be required to do the same. Here is an XPath sample:
I know XPath can also be used in Razor, but that's cheating ;-). Somehow it would already be a lot easier if the first node wasn't removed like it says here. Can that be disabled somehow?
Jeroen
In the latest change set I've created a helper method to get the crop url in razor. That way you don't need to loop through all the crops. Here is a small sample:
Jeroen
n1 jeroen would be very usefull for future projects thumbs up
Just want to add some more info to this topic. The xml used for the razor sample probably looks something like this:
Jeroen
I've posted this problem in another topic since it's not just related to DAMP, but to all DynamicXml: http://our.umbraco.org/forum/developers/razor/20024-Root-node-removed-problem-in-DynamicXml.
Jeroen
I posted another razor DAMP sample here: http://our.umbraco.org/forum/developers/razor/18859-Question-for-an-XML-Data-Loop?p=2#comment76855
Jeroen
is working on a reply...