Results 1 to 7 of 7

Thread: Listing module encrypt links in C3.5

  1. #1
    User tetrijeb's Avatar
    Join Date
    04-19-12.
    Location
    Bosnia&Herzegovina
    Posts
    114

    Default Listing module encrypt links in C3.5

    Hello!

    For one of my previous projects (Contao 2.11) I have created listing module of download articles with link to file. It looks like:

    Title, download_link_image

    In that case, I've created custom listing module. I use table tl_content, and fields: pid, Title, singleSRC and condition type="download"

    Field singleSRC is containing link to file (textual link), so I can get nice nifty link for download: my_domain/singleSRC

    But, on my new project, I use Contao 3.5 version. And surprisingly, singleSRC field isn't anymore text, it is some encrypted string like: 8f698b742d6611e5ad5754c4eaabfd11

    Now, I can't get anymore link for download since I am getting following result my_domain/8f698b742d6611e5ad5754c4eaabfd11

    Is there some way to decrypt singleSRC and pass it to the php as textual link?

    Thanks.

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

    Default

    Contao 3 uses DBAFS. So you can rename and move files within filemanager without loosing the path to the file.

    Look in DB table tl_files, there you find the path.
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  3. #3
    User tetrijeb's Avatar
    Join Date
    04-19-12.
    Location
    Bosnia&Herzegovina
    Posts
    114

    Default

    Quote Originally Posted by Andreas View Post
    Contao 3 uses DBAFS. So you can rename and move files within filemanager without loosing the path to the file.

    Look in DB table tl_files, there you find the path.
    Oh, great! That's something that has frustrating me with Contao 2.

    Thanks.

  4. #4
    User tetrijeb's Avatar
    Join Date
    04-19-12.
    Location
    Bosnia&Herzegovina
    Posts
    114

    Default

    Well, after I studied tables tl_files and tl_content, regarding the information about DBAFS, I don't understand how I will get my listing works anymore. I know what a query should look like, but it seems that I am missing some step.

    1. I search for the latest downloads (5 last items)

    SELECT singleSRC FROM tl_content WHERE type='download' ORDER BY -tstamp LIMIT 5
    As an result I get something like: 8f698b742d6611e5ad5754c4eaabfd11

    2. In table tl_files I am searching for uuid that is equal to 8f698b742d6611e5ad5754c4eaabfd11.

    SELECT path FROM tl_files WHERE uuid='8f698b742d6611e5ad5754c4eaabfd11'
    But,
    MySQL returned an empty result set (i.e. zero rows). (Query took 0.0007 seconds.)
    although I see trough phpmyadmin that adequate row exists. Why I can't get result?

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

    Default

    Try to use following or similar
    PHP Code:
    $objFile = \FilesModel::findByUuid([YOUR singleSRC variable]);

    if (
    $objFile !== null)
    {
      
    $myPath $objFile->path;

    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  6. #6
    User tetrijeb's Avatar
    Join Date
    04-19-12.
    Location
    Bosnia&Herzegovina
    Posts
    114

    Default

    It's working perfectly.

    Thank you.

    Here is the illustration of module (attached picture).

    Depending of page where the document/file is published (category of file), I am showing an icon which represents that page, the name of the file, and image link to download the file.
    Attached Images Attached Images

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

    Nice
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

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
  •