We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36884
    • 4 Posts
    I'm using Revo 2.2 and this is my first project.

    I've done some searching through both the Extras library and this forum but haven't found an answer for this. If I've missed an answer in my search, please just point me to it to save effort.

    What I'm building is an eBook library. So I will have multiple files for each title in different formats (PDF, ePub, mobi, etc), and I want to store these files in a database table rather than in the file system.

    Is there a plugin/addin/technique that would simplify doing this?

    Thanks,
    Stephen Silk
    [ed. note: sasilk last edited this post 7 years, 10 months ago.]
      • 3749
      • 24,544 Posts
      I can't think of any extra that would do that for you.

      I think it would make your life a whole lot easier if you left them as files and saved just the information about them in the DB (title, author(s), path/to/file, number or pages, pub date, etc.). It's easy enough to give them all the same name except for the extension. That way you can easily deliver any of them as long as you know the title and extension. If you're worried about security, you can store the files above the web root so no one can access them except through the service you provide.

      How you store the information about each eBook depends on how your users will access them. If they'll just be browsing, you could use a resource for each book and Template Variables (TVs) for the information that doesn't fit in the resource fields.

      If the users will be using a search form to search for books, however, the above is a bad strategy since TVs suck for searching and sorting. In that case I would probably use ClassExtender or some custom PHP code to add the extra fields to the resource object. That way you could put all the information that might be involved in a search in a custom table, so searching for books and sorting the results would be way faster, but you could still use the Create/Edit Resource form to enter the data.

      You could also do it without using Resources at all, which would be even more efficient, but would require a fair amount of custom PHP coding.

      Everything here is in a single custom DB table. You can see that searches and the sorting are fairly quick: http://wordsmatter.softville.com/index.php?id=2
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 36884
        • 4 Posts
        Thank you - that's just the kind of information I needed.
          • 3749
          • 24,544 Posts
          I'm glad I could help. Welcome to MODX. smiley
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting