Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » basic upload pdfs and display on resource page problem

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 2313 Views
  • qlex
    Avatar
    Community Member
    68 Posts

    basic upload pdfs and display on resource page problem Link to this post

    hi,
    it is maybe an easy task, but for some reason, i couldnt get it to work. could you help me out with the following.

    my objective is:
    - create a resource page, where i can upload several pdf's
    - the above will allow my client to upload several forms for download,
    - the website should display those uploaded pdf's in a table, so its easy for website viewers to download them.

    i have DOM installed and have created new page called resources in the CMS. i have uploaded the files to server through the DOM interface.
    i have tried to create a Resource.ss template which displayed a table on the website with those pdf's,
    but the URL pointing to those, used /wnioski (the actual suffix set in CMS) rather than /assets (which is where the pdf's are located).

    could anybody suggest me with the right solution ?
    i dont even need categories at the minute TBH.

    Qlex

  • UncleCheese
    Avatar
    4085 Posts

    Re: basic upload pdfs and display on resource page problem Link to this post

    There's a pretty thorough example of this in the 'DataObjectManager Code Examples" sticky post. Are you following that?

  • qlex
    Avatar
    Community Member
    68 Posts

    Re: basic upload pdfs and display on resource page problem Link to this post

    Indeed i tried.
    I have put Resource.php and ResourcePage.php into /mysite and ResourcesPage.ss to /themes/mytheme/templates.
    I have no possibility of checking this now, but afair page was empty. Why is the template file not called the same as Resource.php - i.e. Resource.ss ?

  • UncleCheese
    Avatar
    4085 Posts

    Re: basic upload pdfs and display on resource page problem Link to this post

    A resource is not a page, so it doesn't get a template. Resource extends DataObject, not Page, right?

    I think I see the problem. Change the name of ResourcesPage.ss to ResourcePage.ss, so it matches the PHP file ResourcePage.php. Then run a ?flush=1

  • qlex
    Avatar
    Community Member
    68 Posts

    Re: basic upload pdfs and display on resource page problem Link to this post

    UncleCheese,
    first congratulations on excellent module and second, thanks for being so patient with me.

    your suggestion helped me, but still something remains to be corrected.

    I have followed your suggestions and after displaying live site i received this code:

    <p>Please find below forms for download</p>

    <p>&#160;</p>
                
                   <h3>First form</h3>
                   <p>first description</p>
                   
                
                   <h3>Second form</h3>
                   <p>second description</p>
                   
                
                   <h3>Third form</h3>
                   <p>third description</p>

    First paragraph is taken from CMS, and all three headings are the actual resources names and descriptions.
    However there's no link to the file, so i can click on it and display ?

    Somebody suggested i should use this:

    <% control Resources %> $Attachment.Link <%end_control %>


    but this causes the table to be created with wrong path to files (/wnioski/ instead of /assets)

    Any further hints available perhaps ?
    Qlex

  • UncleCheese
    Avatar
    4085 Posts

    Re: basic upload pdfs and display on resource page problem Link to this post

    Can't you just do <a href="$Attachment.URL">Download</a>

  • qlex
    Avatar
    Community Member
    68 Posts

    Re: basic upload pdfs and display on resource page problem Link to this post

    hi,
    using your suggestions from ResourcePage.ss, i added:

    <div id="Content">
    <h2>$Title</h2>
       $Content
       <% control Resources %>
       <h3>$Name</h3>
       <p>$Description</p>
       <% control Attachment %>$Player(640,480)<% end_control %>
       <% end_control %>

    $Form
    $PageComments
    </div>

    Where should I add your suggestion of <a href="$Attachment.URL">Download</a> ?

  • qlex
    Avatar
    Community Member
    68 Posts

    Re: basic upload pdfs and display on resource page problem Link to this post

    I adapted the ResourcePage.ss:

    <% control Resources %>
          <h3>$Name</h3>
          <p>$Description</p>
          <% control Attachment %><a href="$Attachment.URL">Download</a><% end_control %>
          <% end_control %>

    Which gives all the listed resources a "download" option, and all point to my site root.

    I guess its the final touch that I need here to get it up and running.

    WOuld appreciate any final hints on making sure the template works ok.

    2313 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.