Not sure I understand your question correctly but what I'd do is to have the same content picker on all doc types below, if the user doesn't select a doc type then in your XSLT / razor simply use the medida picked above (until you find one where a user has made a selection).
I suppose the above screendump is a mashup of what you want to do - place the checkbox net to the picker?
That's not possible - you need to create a property beneath the picker and then check if the property has been checked to decide whether or not the image should be inherited to subpages.
i am using Umbraco 4.7 and yes all media pickers are same for a particular section of pages who are inherited from that Doc type..
and is it possible if i user select the image from parent page and dont choose any images from child pages, so all the child pages gets the same image as the parent.
I just noticed you have written that you are using version 4.7 of Umbraco and that is why the above code does not return anything and why it does not fail since the syntax is correct but the elements it's trying to match in the XML file just does not exists, since it's trying to match the XML syntax from the old legacy schema.
Allowing an option in Doc type media picker to be displayed in Child pages
Is there any possible way to Allow an option in Doc type media picker to be displayed in Child pages
by using a tick box next to browse images.
Hi,
Not sure I understand your question correctly but what I'd do is to have the same content picker on all doc types below, if the user doesn't select a doc type then in your XSLT / razor simply use the medida picked above (until you find one where a user has made a selection).
Rich
thanx Rich
your solution seems to be convincing, but could you guide a little bit how can i use my XSLT for media picked in parent node.
(actuallly i am new to xslt and umbraco, so sorry for such a simple task)
Asim
Hi Asim
I suppose the above screendump is a mashup of what you want to do - place the checkbox net to the picker?
That's not possible - you need to create a property beneath the picker and then check if the property has been checked to decide whether or not the image should be inherited to subpages.
Hope this makes sense to you?
/Jan
Hey Asim,
Do all your media pickers have the same name & what version of umbraco are you using,
Let me know and I'll try to post some xslt.
Rich
Hi Rich
i am using Umbraco 4.7 and yes all media pickers are same for a particular section of pages who are inherited from that Doc type..
and is it possible if i user select the image from parent page and dont choose any images from child pages, so all the child pages gets the same image as the parent.
thanks
Asim
Hi Jan
thats what i did as you told, i had made a true/false property below media picker in doc type.
plz tel me how to modify the XSLT for allowing the image to be displayed in child pages
Thanks
Asim
Hey Asim,
Sorry, was sleeping :)
Taking from this post here http://our.umbraco.org/forum/developers/xslt/11470-Recursive-macro-for-a-banner?p=1
Set up a macro parameter named myMacroPropertyAlias
Then in your template where you want your image to show insert your macro
<umbraco:macro alias="myMacro" myMacroPropertyAlias="[$bannerImage]" />
In the above line bannerImage is the name of your property
The $ notation tells umbraco to look up the tree until it finds a value for bannerImage
Then add the following lines to your XSLT file, one to retrieve the parameter, the other to display the image (tweak however you need to)
Hope that helps
Rich
Hi Rich, how are you
i saw this functionality in this post, which is what i want to do, here:
http://forum.umbraco.org/yaf_postst6234_Getting-media-based-on-parent-folder.aspx
but this isnt working for me, i guess i m using v4.7 it might have different syntax, kindly help me for this, here is my xslt
<xsl:if test="$currentPage/ancestor-or-self::node [string(data[@alias='bannerImage_nl'])]/data [@alias = 'bannerImage_nl'] != ''">
<xsl:element name="img">
<xsl:attribute name="src"><xsl:value-of select="umbraco.library:GetMedia($currentPage/ancestor-or-self::node [string(data[@alias='bannerImage_nl'])]/data [@alias = 'bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="$currentPage/data [@alias = 'DisplayName']"/></xsl:attribute>
</xsl:element>
</xsl:if>
Hi,
This code above wont work for 4.7, did you try my suggestion? They both do the same thing but in a slightly different way.
Rich
Hi asim
Please have a look on this http://our.umbraco.org/wiki/reference/xslt/45-xml-schema/xslt-examples-updated-to-new-schema. Here you can find the xslt changes for umbraco v4.5 or later version.
Thanks
Pnima
Thanks Pnima,
Hi Rich i tried ur solution, but didnt worked for me,
i wana use this,
<xsl:attribute name="src"><xsl:value-of select="umbraco.library:GetMedia($currentPage/ancestor-or-self::node [string(data[@alias='bannerImage_nl'])]/data [@alias = 'bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/>
</xsl:attribute>
Hi Asim
What error message do you get?
And do you get the error inside the XSLT editor in Umbraco or on the website?
/Jan
Hi Jan
i didnt get any errors, xslt is saved without errors,
but nothing is shown in browser when i use this for code for my xslt
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($currentPage/ancestor-or-self::node [string(data[@alias='bannerImage_nl'])]/data [@alias = 'bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/>
</xsl:attribute>
but it works fine for this one
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/>
</xsl:attribute>
any help would be highly appreciated.
Asim
Hi Asim
I just noticed you have written that you are using version 4.7 of Umbraco and that is why the above code does not return anything and why it does not fail since the syntax is correct but the elements it's trying to match in the XML file just does not exists, since it's trying to match the XML syntax from the old legacy schema.
You can read more about the differences in the schemas here: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema and you can probably benefit from this converter created by Tommy Poulsen here: http://blackpoint.dk/umbraco-workbench/tools/convert-xml-schema-to-45-.aspx
I'm a bit puzzled that you write this code works...
<xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='bannerImage_nl'], 'false')/data [@alias = 'umbracoFile']"/>
It's seems to me that it is a mixture of the new and old xml schema?
This looks right to me
<xsl:value-of select="umbraco.library:GetMedia($currentPage/data[@alias='bannerImage_nl'], 0)/umbracoFile"/>
Does this work for you?
/Jan
Hey Jan, how are you
you know your code converter site works like a magic for me, u were rite it was a mixture of old schema and new one.
thanks a lot
Asim
is working on a reply...