I have a clean 4.5.2 install using .net 3.5. In the media section I have a folder named 'Site' with one image named 'Logo'. On the master page, I would like to do the following:
The problem with this, of course, is that GetMedia takes a node id rather than a node name. So my question is how do I get the node id given that I have the node name?
Is there any reason why you don't use the mediaCurrent type as a parameter for your macro? Then you get the id, which you can submit to the GetMedia extension.
Using mediaCurrent macro parameter actually goes even further and pre-fetches the XML for the media item, so you don't even need to call GetMedia() - you could do this instead:
Thank you both for the reply. I tried that and didn't get anything. That's why I sent it in as text, then at least I had the name of the image. What I couldn't figure out is how to link the image name to the media file in the tree.
In essence what I am trying to do is have a site-wide logo appear without having to reference it in each page. So there is no page that has a data element referring to the image, it's just in the master masterpage.
Also - this is a newbe question - how do you get your code to show up compactly? As you can see, mine spreads all over the page. I'm using the code paragraph type.
How to get media node from name
I have a clean 4.5.2 install using .net 3.5. In the media section I have a folder named 'Site' with one image named 'Logo'. On the master page, I would like to do the following:
The macro siteImage then does the following:
The problem with this, of course, is that GetMedia takes a node id rather than a node name. So my question is how do I get the node id given that I have the node name?
Hi Jon
Is there any reason why you don't use the mediaCurrent type as a parameter for your macro? Then you get the id, which you can submit to the GetMedia extension.
Hope this helps.
/Jan
Hi Jon (+Jan)
I was about to ask the same :-)
Using mediaCurrent macro parameter actually goes even further and pre-fetches the XML for the media item, so you don't even need to call GetMedia() - you could do this instead:
/Chriztian
Thank you both for the reply. I tried that and didn't get anything. That's why I sent it in as text, then at least I had the name of the image. What I couldn't figure out is how to link the image name to the media file in the tree.
In essence what I am trying to do is have a site-wide logo appear without having to reference it in each page. So there is no page that has a data element referring to the image, it's just in the master masterpage.
Also - this is a newbe question - how do you get your code to show up compactly? As you can see, mine spreads all over the page. I'm using the code paragraph type.
is working on a reply...