We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I’m pretty excited about all the new stuff I’ve discovered that MODx can do... my goal is to tie into some custom database tables and use MODx to display the information. Using a plugin that executes when a page is not found, I am able to grab a particular url segment and use it to look up an id in my custom database table (see this url:
    http://modxcms.com/forums/index.php/topic,31477.msg193330.html)

    Now that I can get that information from the custom database table, I figure I have at least 2 options, and I’m hoping someone wiser than myself can weigh in on them:

    1. Format the information (i.e. the row from the custom database table) and pipe that into an existing document’s [*content*] tag.
    2. Generate my own custom templates using sensible tags appropriate for the custom table whose output they would be formatting... e.g. if the table deals with books, I might have template variable tags for [*author*], [*isbn*], [*publisher*], [*synopsis*], etc.

    Option #1 is simple, but it would not offer the degree of formatting control that the web designers like (read: it may not meet the needs of the project). I’m not exactly sure how to do EITHER option though... how do I trigger MODx’s parsing engine? And assuming I wanted to do the 2nd option, how would I prime the parser to find/replace my custom variables?

    Just in case someone is wondering why I don’t use custom Template Variables, it’s basically because we require a strictly normalized database structure for these custom tables... reporting on the MODx pages that make heavy use of TV’s relies heavily on joins. See http://modxcms.com/forums/index.php?topic=31297.0 for some talk about it with other forum folks.
    • You can’t do it that way; MODx currently handles the request. You cannot simply plugin your own URL routing and go like with pure development frameworks, at least not currently. For Revolution, the game changes.
      • Thanks for the response.... I don’t want to paint myself in a corner, but I don’t want to hog-tie the front-end and content folks either. I don’t think it would be a travesty if I perform the magic with a Snippet and format the output with a Chunk... that might be the more appropriate way to handle all the custom info that I would be reading from a custom table. To further my book example, maybe my chunk can use placeholders like [+author+], [+synopsis+], etc. and they can be parsed via a Snippet.... the Snippet could place its output in the document’s content, then I wouldn’t have to come up with any custom templates at all... that seems like a much simpler way to go about things.
        http://modxcms.com/forums/index.php?action=post;topic=31477.0;