Results 1 to 3 of 3

Thread: Clean URLs for List Reader

  1. #1
    New user
    Join Date
    01-10-21.
    Posts
    28

    Default Clean URLs for List Reader

    SHORT VERSION: Looking to use the List module, or other method, to access Db table records with a clean [user-friendly] URL (eg "website.com/link-to-unique-record.html".) We have tl_ tables that have been manually created on the server under the Contao MySQL Db - need to list, search and display the records. No adding, editing or deleting.

    LONG VERSION: We have a catalog of three tables comprised of objects, books, and historic articles that is managed in a local library using Filemaker Pro. The tables are sync'd (mirrored) to MySQL for web use. The tables are simple - ~36 fields and each contains approx 1000 records; we are not making any relationships between the tables at this time.

    With regards to Contao, we placed the tables under the Contao Db with tl_ prefix (e.g. tl_objects) so that the List module can retrieve records from the table. There is no need for add, edit or delete functions as this take place on Filemaker Pro. We will use the tables for visitors to search, list, and read (display) each record on the front-end.

    Our desire is to create clean URLs for each record as some need to be added as links in navigation and/or shared. Currently, the List module uses a GET variable ?show=ID to retrieve and display the table record. While we could do a htaccess rewrite_mod, it seems we'd be sidestepping the power of Contao. We do have a unique text field for each record based on the object title which could be used in place of ID and serve as a base name for "link-to-unique-record.html" naming convention.

    If there is a better way to do this with DCA, I'm game. It seems that, since we will not be creating or managing records in Contao, this would not be necessary. Even with a proper DCA, I'm still uncertain as to how clean URL for each table entry gets generated. Any assistance is appreciated.

    Thank you.

  2. #2
    User Spooky's Avatar
    Join Date
    01-03-13.
    Posts
    339

    Default

    Your task is more related to routing rather than a question of the DCA. There is different ways on how to go about it. One (legacy) way would be to utilize the getPageIdFromUrl hook, in order to dynamically determine which page should be rendered and which parameters should be set, according to the accessed URL. See https://github.com/fritzmg/contao-simple-news-urls/ for an example.

  3. #3
    New user
    Join Date
    01-10-21.
    Posts
    28

    Default

    I'm still at a loss here. Is there a way to make a url like list.html?show=83 become list/83.html without developing a package like contao-simple-news-urls? Maybe there's a better approach?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •