Sorry if this question is too vague or wrongly categorized. Just looking for guidance and not sure where to start.
Here’s what I want to do:
I am building a site with an online library of downloadable white papers in Word doc format. Must be searchable. If I were building this site by in PHP/MySQL, I would just make a database table with the fields that I need (i.e., docTitle, docAuthor, docFileName, docTeaser, docModDate...etc) then write some PHP to display master/detail pages. No big deal... until the client asks for a full-featured CMS, which I am not going to custom build. Instead, I turn to ModX. In the past it would have been Drupal. But after using ModX, Drupal is not even worth considering.
So my challenge is... how does one create something like a custom content type in ModX? Essentially, a ModX version of what Drupal 6 would do using CCK and Views.
Being new to ModX, I would *expect* that I could (somehow) create a custom resource type, in this case, a "Word Doc" and then (somehow) give it custom attributes like the an author, subject, category, etc...
I would be glad to review more ModX documentation if I knew where to start. ...Should I look at modules? Should I do this with template variables, where every attribute (i.e., docTitle, docFileName, docTeaser) is simply a TV?
I am using Revolution. I would love any hints, advice, pointers or whatever... just feeling lost and not sure where to start.
Thanks in advance!
-
☆ A M B ☆
- 894 Posts
If I understand correctly what you want to do is upload a word doc and have all these attributes be entered when you are uploading the word doc.
If that’s the case you can create a custom form, use a tv for each of the attributes you want for the docs and attach the document to that page.
Maybe use something like
this to attach the doc.
This is how I would do it, but I’m not a programmer I’m a front end dev that knows a bit of things I’m sure there’s probably an easier way or a better way of accomplishing the same thing I just suggested.
Hope that gives you an idea of where to start looking.
It’s a challenging problem.
Doing it with TVs is one way to go, but the searching may be difficult and slow, depending on how complex the search form is and how many docs there are.
If you can make the existing resource fields work for you (introtext, description, longtitle, content, etc.) it will be faster and easier to search -- you could also subclass the resource object and use your own custom fields. You could extract the doc’s content and put it in one of the fields (typically the "content" field). That way, you could use getResources to do the searching and display a "teaser" for each doc.
A better solution (though more difficult to set up) might be to create a custom DB table with the field data from each resource. If you do it in Revolution, you can use xPDO for the searching. Once you know which document you want to display, you could create a static resource on the fly with a link to the .doc file and redirect the user to it. If there will be multiple hits, you could create links to display on a particular page that would each link to the correct static resource.
thanks, guys! i will look into both approaches. bob, i like the idea of a custom DB table because it would allow me to completely build the site around the needs of any particular client’s content (versus forcing the content into a pre-existing structure). i will look into xPDO, it sounds like it could be well worth any extra effort in the long term. may i also ask: what do you mean by "subclass the resource object"? can you recommend any documentation for that approach?
Subclassing the modResource object means to create a new object that "extends" modResource. It can have its own table in the DB and will have the fields of a regular resource plus any you add. Unfortunately, I couldn’t find any good documentation on how to do it (though that doesn’t mean there isn’t any). It’s probably not the best solution for you anyway, since it would carry all the unnecessary baggage of the current modResource object.
A custom DB table that you view through one or more custom snippets is probably a better option. xPDO is definitely worth the effort. It takes a little while to get over the hump, but once you do, you never want to go back.
Here’s another take on creating a custom DB table:
http://bobsguides.com/custom-db-tables.html. It assumes that you’d rather create the new table(s) in PhpMyAdmin and then autogenerate the classes and maps for them. It works well if the extra DB stuff is simple and you don’t have objects that are related to each other (which it sounds like you don’t need -- I could be wrong).
Here’s a quick introduction to xPDO as it’s used with MODX objects in Revolution:
http://bobsguides.com/revolution-objects.html. If you create your custom table as described above (or from one of the other tutorials), you can use all those methods with your custom object.
If you want to get your CMP quick and you want use TV-input-fields (richtext,date,image,checkbox....... also custom-TV-input-types) for your table-fields you can try it with xdbedit
Awesome! I am playing around with TV’s for a quick fix. However, I started looking into xPDO. I am gradually making my way up the learning curve, but I can begin to see some of the dots connecting. xPDO looks extremely promising for not only my current project, but most if not all of the sites I get hired to build. (I find that every website has it’s own particular notion of what the fundamental "content" block is and what fields it should have.) So, this is hugely helpful!
Thanks all! I now have some homework to do.