Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Menu item link to download document


Go to End


13 Posts   5547 Views

Avatar
servalman

Community Member, 211 Posts

2 August 2011 at 3:22am

Edited: 02/08/2011 3:25am

Hello (update)

I tried and it is not still not working (sometimes I really get lost with ss ;)

Maybe I was not clear abour my scenario:

I want to be able to directly link a menu Item (from the site tree) to a pdf document (or any document) so that when the user click on the link he downloads the PDF.

It should behave like a normal link :

<a href="assests/upload/mypdf.pdf" target="_blank" > MenuItemLInk </a>.

I tought it would be a simple task but I really can't sort it out

Thanks for your help

Avatar
swaiba

Forum Moderator, 1899 Posts

2 August 2011 at 3:33am

Edited: 02/08/2011 3:33am

I will try that right now but I'm a bit confused about your sugestion to go and see the tutorial.

The error you posted was about the selection of a file while editing it within the CMS, the tutorial deals with this I believe. The code I wrote was untested and when I remember the tutorial has it - I recommend you that.

I've had another look and I think if you change 'Root.Content' to 'Root.Content.Main' that might work.

The point is that I like to help but I'm not here to write code for people - after 200+ posts I'd imagine you'd have debugged code and could get something to work with a few hints. Sorry if I have misread the situation here.

And if you want to hardcode the file that will be downloaded then go ahead and do that it will save you time.

Avatar
servalman

Community Member, 211 Posts

2 August 2011 at 3:52am

Hello

1) I'v never asked you to writte any code for me

2) the only thing I have asked for (original post) was if there was a simple way to create an hyperlink from a menu item to a file in the asset folder like you can do inside a page with the pag editor.

4) I don't see where in tutorial there is something that has to do with my problem

3) I think ss is a great piece of software but sometime not easy to apprehend

Sorry if I'd bothered you, I won't do it again.

Thanks anyway for your time

Avatar
swaiba

Forum Moderator, 1899 Posts

2 August 2011 at 4:45am

1) I'v never asked you to writte any code for me

I know I choose to try and help you.

2) the only thing I have asked for (original post) was if there was a simple way to create an hyperlink from a menu item to a file in the asset folder like you can do inside a page with the pag editor.

And I've done my best to help you, I'm sorry if you feel me pointing to you a tutorial on how to add field type (upload file) to a page was not good.

4) I don't see where in tutorial there is something that has to do with my problem

To choose the file you need something that says "this is the file I want" it could be done many ways but uploading the file and having it associated with the page is a good one I think, if you disagree than as I said hardcode the file.

3) I think ss is a great piece of software but sometime not easy to apprehend

I agree, assuming you have completed the tutorials, read the relevant documentation and maybe even one of the books - it will get much better.

Avatar
servalman

Community Member, 211 Posts

2 August 2011 at 4:59am

Edited: 02/08/2011 5:04am

Hello

I bought the 2 availiable books on silvertsripe (old and new one)

I have understood how to upolad a file and display it on a page or create a link on the page to download it.

the part I don't get (my goal is to have the user click on the menu item link and download file without opening page) is how to link it directly to the menu item without opening a page (a kind of redirector page).

But maybe this has to do with the way menus behave.

I'm really trying to do thing by myself and understand what I do

I won't bother you any more and again sorry if I have been a pain in the ass

T

Go to Top