-
☆ A M B ☆
- 24,524 Posts
You can use TVs with weblinks, and have Ditto make its links from the TV instead of the usual id or whatever. A file input type TV has uploading of files to the assets/files directory. Make sure the weblink is set to not show in the menu, or Wayfinder will be very unhappy about it not having a proper URL (or document id) in the weblink field; that is, if it doesn’t have a proper URL as well as the TV with the path to the file.
When testing this, I used a TV named Files with the input type of File. Then I used this (very simple) chunk tpl for Ditto
<a href="[+Files+]">[+menutitle+]</a>
gives me a link to the file quite happily. I suspect that if you are using Ditto with mixed documents you could use PHx to determine the type of the document Ditto is working on at the moment and use two different chunks, depending on if the document type is "reference" or "document".
Keiron,
Thanks, this is exactly what I was looking for! A few questions though:
1 - Any reason your only allowing the button to show on ’blank’ templates? On our site, all new documents inherit the parent’s template, so I’d have to remove this condition, but want to make sure there wasn’t any specific reason (stability?).
2 - Is there any way to make the button look like the browse button in the link manager? Many of our users are not web savvy, and would appreciate consistency (to them, browse = pdf).
3 - Any plans you know of to include this as a standard feature in future releases? I think this is something many others would appreciate as well.
Thanks!
Glad you like it. It’s the first plugin I’ve made and I did it because I needed it for some of my clients.
1. I did make it only work on blank templates so that there weren’t clashes of javascript functions if they were already used as a template variable. Thinking about it I can just rename the function to stop this happening.
2. Good idea - I’ll do this
3. No idea. And I don’t know how this gets suggested to the people in charge.
I have just made a small mod today so I will incorporate points 1 & 2 when I update the script online later (hopefully).
I updated the script last night with renamed JS functions and a fix for IE8. The icon was trickier than expected in the 1/2 hour I had - but it is achievable, so I will get around to it soon.
What a superb idea! This would be really useful on a couple of MODx sites I run. Unfortunately the resource link seems to be broken so I can’t download it - can you look into it please? Ta.
I didn’t realise it was broken. I have reattached the file and it’s working now. I plan to update the button visually soon (when I get 10 minutes).
Thanks for this its a big help, i dont suppose it could be modded to be on preRender, so its already there if the insert is on a default page, i.e a template called Links, which automatically has the button there?
GFood woork tho