We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36667
    • 57 Posts
    Peter Falkenberg Brown Reply #101, 13 years, 10 months ago
    Quote from: hk_modx at Jul 08, 2010, 04:39 PM

    In this case we only used *one* MODx resource for displaying each and every wine on the site, for all the reasons Jason mentioned above and more. Essentially you use a resource as a controller to display data from your custom tables.

    Dear HK,

    In your scenario above, do you create friendly urls for each wine item, or do you use the id syntax?

    One of the attractive things about the resource interface is the inclusion of things like friendly urls, etc. I’m not sure how we could include friendly urls if we skipped the resource interface.

    It would be *very* useful if someone who has already programmed this kind of thing in Evo or Revo could post a zip file of code files, or notes, or something like that.

    But I still think MODx has to be repositioned. This limitation wasn’t clear to me at all when I adopted MODx. I blithely went with the 5,000 resource limitation mentioned in the documentation, thinking that all was well.

    Peter
      Visit The Significato Journal ~ nectar for the soul ~ http://significatojournal.com
      • 28436
      • 242 Posts
      Hello Peter,

      is already getting close to the 1,000 mark.
      dont by worry, thats no problem, i am running a site with more than 5000 documents*56TVs, a lot of phx/snippets/templates/chunks(all in filesystem) and all is fine. The key is the caching. The parsing time is 2.0s 1350 Database queries from fresh and 0.08s from cache without any DB-query. The Backend runs stable and no other issus with it.(This is a point that sacred me.. i try to copy this site to revo and it runs slower)

      And, i use modx in exactly the way you think how to use it. Modx make a nice tree, give the possiblity to turn a simple entry into a product, a car, a blog-entry, magazinpage or whatever. As you mention, so why should not use modx in this way?

      I found this topic some days ago when i was trying to build a archive for historic newspapers. Modx crashed with 100.000
      documents, sure, i build a dedicated database table to keep the data, but later i figured out that modx do also this job, the problem was just wayfinder, the treebuilding inside the backend and a huge cache-file. So i think 5000 entries are not really a problem.

      I actually think @cipa’s recommended middle ground is a great idea - using TVs and resources does allow for rapid prototyping, but it’s in no way a replacement for custom tables when you’re talking about 1000’s of pages.
      Sorry, but this cant be right. What is the reason for using a CMS? To Handle content! No matter what kind of content it is. The content can turn into a homepage by a hap. But i want to handle my cars, magazines or whatever. How to handle the different kinds of content is a question for the "under the hood" people not for the user. Take a look to ezpublish for example.

      $wine_id = $_GET['wine'];
      $wine = $modx->getObject('wine', $wine_id);
      This is great, really, but just a part of the truth. Who search the wines? who build a navigation through the wines? who make the friendly-urls for that entries?

      My vision is that you can tell the CMS "Hey i want to store Wines" and the cms do the job with the data-storing and integration to the system(navigations, search, templating, urls, etc)

      cheers
      Stefan

        • 5340
        • 1,624 Posts

        Sorry, but this cant be right. What is the reason for using a CMS? To Handle content! No matter what kind of content it is. The content can turn into a homepage by a hap. But i want to handle my cars, magazines or whatever. How to handle the different kinds of content is a question for the "under the hood" people not for the user. Take a look to ezpublish for example.

        Would you build a site like amazon using modx? I wouldn’t
        All I’m saying is that it depends on your project. If I know that my website will have more than 10.000 similar resources I would build my own CMS or build a modx module. Until my website reaches that number of pages I can easily build a module.
          • 34017
          • 898 Posts
          Quote from: OpenGeek at Jul 08, 2010, 01:18 PM

          I’ll say it one more time: I recommend you DO NOT use Resources to represent data that needs multi-faceted views. Your should never have thousands of Resources, as these are supposed to represent distinct, dynamic views in your site. The perception that using custom data tables to populate your views does not allow the use of Wayfinder or Ditto is IMO irrelevant, as you can (at least in Revo) very quickly create views from custom data tables. TV’s and Resources are for constructing layouts; IOW for presentation. Not for data.

          I totally disagree.

          The power of modx is flexible attributes (tv’s). Let’s say I have 4 types of data. I could either spend hours creating 4 CRUD modules- or I could spend hours working on modx letting it handle 1000’s of resources. I would rather make modx parsing and caching work better, because I can re-use that. Otherwise I’d just have to create a new module for each new data type.

          And let’s not forget about the client. They NEVER know what they want. One of the best things about modx TV’s is no database migrations. If the customer wants a new ’image’ field, I can give it to them.

          Now I know Jason is coming at this from ’Enterprise App’ developer. So he’s coming at this from a different angle. But most modx users dont have access to a Jason or Shaun or other uber-developer. So they want to allow customers to create TV-based resources (with friendly URLs).

          So Jason, I do understand your view, and it is best practice/optimal. But you are missing a huge part of the market when you dismiss using modx resources/TV’s for CRUD.
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 28436
            • 242 Posts
            Hallo cipa,
            All I’m saying is that it depends on your project
            Absolutely! I won’t criticise your position, just wondering about the statements about the use of modx. If this so, i totally misunderstood the great of modx.
            Adios, Stefan
              • 12236
              • 48 Posts
              Digital Butter - MODX Premiere Partners Reply #106, 13 years, 10 months ago
              Quote from: peterbrown at Jul 08, 2010, 05:19 PM

              Quote from: hk_modx at Jul 08, 2010, 04:39 PM

              In this case we only used *one* MODx resource for displaying each and every wine on the site, for all the reasons Jason mentioned above and more. Essentially you use a resource as a controller to display data from your custom tables.

              Dear HK,

              In your scenario above, do you create friendly urls for each wine item, or do you use the id syntax?

              One of the attractive things about the resource interface is the inclusion of things like friendly urls, etc. I’m not sure how we could include friendly urls if we skipped the resource interface.

              It would be *very* useful if someone who has already programmed this kind of thing in Evo or Revo could post a zip file of code files, or notes, or something like that.

              But I still think MODx has to be repositioned. This limitation wasn’t clear to me at all when I adopted MODx. I blithely went with the 5,000 resource limitation mentioned in the documentation, thinking that all was well.

              Peter


              Hey Peter,

              You could indeed use friendly URLs, whereby instead of supplying a wine id in the URL it would be an alias of the wine (assuming you had created a field for it). You’d be able to create an .htaccess rule to put the whole thing together neatly.

              I have an example, though it’s from a different website.

              http://www.womguide.com/events/event/hot-pick-dining-privileges-at-paterson-street-in-causeway-bay

              All events on this site are stored in custom tables, I can’t imagine how resource hungry it would be to render a calender with hundreds of events if they were stored as resources with date widget TVs. In the case above, there is one resource being used to control the display of all the events, by alias, and that’s this page:

              http://www.womguide.com/events/event/

              On this page is a snippet call that checks for an event alias, stored in the $_GET[’event’] parameter. Using an htaccess file, you can map the last parameter in the URL to the $_GET variable[’event’], like so:

              RewriteRule ^(events)/event/(.*) index.php?q=$1&event=$2 [L]

              I just read through some of the other users’ thoughts - I’ll agree it sucks that developing sites with 1000’s of pages isn’t easier, but I would never approach a project of that scale with expectations that it would be, I just personally think it’s unreasonable to expect to not have to create any custom snippets if you’re building something of significant scale, although I can see how by default you might try to do so and hope for the best.

              Peter - if you have any specific challenges, let me know if you’d like any advice. That womguide.com site is running on Evo and has a lot of pages - some handled as resources and some as the calendar events above, I’d be happy to share some experiences.
                • 12236
                • 48 Posts
                Digital Butter - MODX Premiere Partners Reply #107, 13 years, 10 months ago
                Quote from: stefan at Jul 08, 2010, 05:29 PM

                $wine_id = $_GET['wine'];
                $wine = $modx->getObject('wine', $wine_id);
                This is great, really, but just a part of the truth. Who search the wines? who build a navigation through the wines? who make the friendly-urls for that entries?

                Agreed - this is a super simplified version of the actual code. Something like the search engine for the wines is complex - you can search by flavor, by rating, by age, by inventory and so on. I don’t think it would be viable to do it with resources, the database structure doesn’t lend itself to such a thing. The point of my original posting of that code is to display only the ’resource as a controller’ idea.

                Also, see my post above for an idea of how to do friendly URLs with this kind of setup.

                The power of modx is flexible attributes (tv’s). Let’s say I have 4 types of data. I could either spend hours creating 4 CRUD modules- or I could spend hours working on modx letting it handle 1000’s of resources. I would rather make modx parsing and caching work better, because I can re-use that. Otherwise I’d just have to create a new module for each new data type.

                I agree, it’s more work creating custom modules and the CRUD, and whenever I can, I avoid it too.

                And let’s not forget about the client. They NEVER know what they want. One of the best things about modx TV’s is no database migrations. If the customer wants a new ’image’ field, I can give it to them.

                Agreed - in part. But if you have a client telling you that they have 1000’s of rows of data that will be going onto a website, then I’d argue that their data structure has already been set and to ’change/remove/add fields’ would be just as painful for them as it is for you as a developer. Essentially, a client who processes & creates thousands of pieces of content will be much more realistic and sensible than a client who casually has a 50 page website. Whenever we have built anything on a large scale, we don’t agree to a thing until we see a database (a work in progress is acceptable) and then we’ll agree with the client on a signed off structure.

                Cheers
                  • 28436
                  • 242 Posts
                  hallo hk,
                  Quote from: hk_modx at Jul 09, 2010, 03:09 AM

                  Quote from: stefan at Jul 08, 2010, 05:29 PM

                  $wine_id = $_GET['wine'];
                  $wine = $modx->getObject('wine', $wine_id);
                  This is great, really, but just a part of the truth. Who search the wines? who build a navigation through the wines? who make the friendly-urls for that entries?
                  Also, see my post above for an idea of how to do friendly URLs with this kind of setup.
                  Quote from: hk_modx
                  RewriteRule ^(events)/event/(.*) index.php?q=$1&event=$2 [L]

                  Of course, your right, i also use such technique in a lot of projects and of course sometimes its better to make dedicated tables, its always up to the project needs.

                  But again, if you already have a integrated system that provide you a full functional EAV handling, so why dont use it for storing arbitrary content. Seriously, wheres the difference between your own table and the CMS-table? If you have thousands of events, of course, the manager-tree is not really a good solution to display them, but the storing itself must be out of the question.

                  ciao, Stefan


                    • 12236
                    • 48 Posts
                    Digital Butter - MODX Premiere Partners Reply #109, 13 years, 10 months ago
                    Quote from: stefan at Jul 09, 2010, 05:38 AM

                    hallo hk,
                    Quote from: hk_modx at Jul 09, 2010, 03:09 AM

                    Quote from: stefan at Jul 08, 2010, 05:29 PM

                    $wine_id = $_GET['wine'];
                    $wine = $modx->getObject('wine', $wine_id);
                    This is great, really, but just a part of the truth. Who search the wines? who build a navigation through the wines? who make the friendly-urls for that entries?
                    Also, see my post above for an idea of how to do friendly URLs with this kind of setup.
                    Quote from: hk_modx
                    RewriteRule ^(events)/event/(.*) index.php?q=$1&event=$2 [L]

                    Of course, your right, i also use such technique in a lot of projects and of course sometimes its better to make dedicated tables, its always up to the project needs.

                    But again, if you already have a integrated system that provide you a full functional EAV handling, so why dont use it for storing arbitrary content. Seriously, wheres the difference between your own table and the CMS-table? If you have thousands of events, of course, the manager-tree is not really a good solution to display them, but the storing itself must be out of the question.

                    ciao, Stefan




                    Hey Stefan,

                    I think to answer your question I would just say that what makes it better (from a development side) is the database structure becomes more suitable when you define it yourself and makes your queries later on so much simpler and more capable. As in, if you’re storing a date field for an event as a TV, then it is being stored in the TV content values table as a string. Tie that in with 10 other searchable fields in the same table, that might not be the right field types, and it becomes a nightmare. Also like you say, the interface can be improved too, for example you could use a datagrid with filters and a search bar instead of the site tree which quickly becomes unusable with too many resources.

                    For actual storage and writing to the database, especially for arbitrary content, then a custom table isn’t any much better, you are right - but I still don’t think that’s the point - the point is that if you have an exceptional requirement, you should come with the expectation of needing to put in some work to make your project.

                    My question back would be to ask - for these exceptional cases, don’t you think *some* extra work should be put into a project to get the best out of it? If it was me, I would certainly make sure that a magazine site with 1000’s of pages has a workable budget behind it (meaning time or money). If it doesn’t, and I simply do not have time to add custom modules then I would have to accept the site isn’t going to be optimised, although I would still get a fully functional website.

                    In my opinion, it’s just unreasonable to think that shoehorning everything into resources, at this level of website, is going to give you excellent results.

                    I would rather be told to build these custom addons to the system to handle the exceptional cases, than to have the system as a whole be dragged down so that it can cater to absolutely any requirement without developers lifting a finger. As far as I can tell, that’s actually what makes MODx so great.

                    With Revo, setting up CRUD is remarkably elegant, I’m assuming it’s the CRUD that most people are trying to avoid. I’ll post some tutorials soon for reference because I think attitudes would change if you can see how much ’better’ it is in this instance.
                      • 26931
                      • 2,314 Posts
                      hm, is there really no way to optimize the caching? there have been some efforts by the russian community: http://modxcms.com/forums/index.php/topic,36714.msg277542.html#msg277542
                      + the ressource management tool from the japanese community: http://modxcms.com/forums/index.php/topic,42566.msg255370.html#msg255370