Results 1 to 5 of 5

Thread: Select records from table and display

  1. #1
    User
    Join Date
    02-05-19.
    Posts
    66

    Frage Select records from table and display

    How do I query from table and display the records?

    Earlier I have done these.
    1. Create a SQL structure and import it to database. Is this acceptable in Contao?
    2. Create a form and bind it to the new table imported.
    3. Save records in the table.

    Now I want to do these.
    1. Query the records (with / without conditions) from this table and display the records.
    How do I do it? Is there any in-built solution? Is it possible to write PHP code? Where do I put the PHP file?

    Any sort of advice would be great.

  2. #2
    User
    Join Date
    06-19-09.
    Posts
    328

    Default

    Quote Originally Posted by alahiri View Post
    How do I query from table and display the records?
    1. Query the records (with / without conditions) from this table and display the records.
    How do I do it? Is there any in-built solution? Is it possible to write PHP code? Where do I put the PHP file?

    Any sort of advice would be great.
    You can use a "Listing" frontend module, just create it from Themes -> <yourtheme> -> Modules, then show it by using a Content Element of type "Module"
    Consulenza Contao CMS https://www.intco.it

  3. #3
    User
    Join Date
    02-05-19.
    Posts
    66

    Frage

    Quote Originally Posted by ga.n View Post
    You can use a "Listing" frontend module, just create it from Themes -> <yourtheme> -> Modules, then show it by using a Content Element of type "Module"
    Thank you ga.n. Its working.
    Now I wish to display only the records which are uploaded by the log in user. Is there any way I can do it? How do I design the page?
    Can I edit and delete the records, just like other CRUD apps?

  4. #4
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default

    Create your php files in folder /templates/. Then within contao you can include them with this insert tag (examples):
    Code:
    {{file::myPHP.php}}
    {{file::inc-myPHP.html5}}
    You also can code in templates, e.g. in j_xxx templates which you then can select within your layout.

    You also can create an HTML module or CE with the above insert tag.

    The listing module is just for listing, no CRUD, no FE editing.

    You can test MetaModels or Contao Catalog Manager for handling your own DB tables. They both offer FE editing.

    In listing module field "Condition" you also can use the insert tag to first check the logged in member an so build the condition dynamically.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  5. #5
    User
    Join Date
    06-19-09.
    Posts
    328

    Default

    Quote Originally Posted by alahiri View Post
    Thank you ga.n. Its working.
    Now I wish to display only the records which are uploaded by the log in user. Is there any way I can do it? How do I design the page?
    IIRC you can use insert tags inside the "Condition" field
    so will be something like
    Code:
    user_id = {{user::id}}
    Quote Originally Posted by alahiri View Post
    Can I edit and delete the records, just like other CRUD apps?
    Editing in frontend can be achieved by creating a form through the form generator and then using the loadFormField and processFormData hooks

    For deleting (as stated above) you can use the "file" insert tags

    (It seems the Forum platform don't let me post links, just google contao insert tags and contao hooks for more information)
    Consulenza Contao CMS https://www.intco.it

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
  •