Results 1 to 4 of 4

Thread: Querying tl_user table always return empty result

  1. #1
    New user
    Join Date
    12-15-13.
    Posts
    2

    Default Querying tl_user table always return empty result

    On a page I´m working on, users can submit comments on blog posts and their avatars are showed. Althought I can retrieve alle the information about the comment author, when I query for its avatar, the query allways return empty, even if all information is there. Is there anything I´m missing?

    The example link is: http://www.natives.de/blogeintrag/items/59.html

    and the template code is as follows:

    PHP Code:
    <?php
    $this
    ->import('Database');
    $authoravatar $this->Database->prepare("SELECT xt_avatar FROM tl_user WHERE email=?")
      ->
    execute($this->email);
    //var_dump($authoravatar);
    ?>

    <div class="comment_default<?php echo $this->class?>" id="<?php echo $this->id?>">
    <h3 class="info"><strong><?php if ($this->website): ?><a href="<?php echo $this->website?>" rel="nofollow" target="_blank"><?php endif; ?><?php echo $this->name?><?php if ($this->website): ?></a><?php endif; ?></strong> <time datetime="<?php echo $this->datetime?>" class="date"><?php echo $this->date?></time></h3>


    <div class="authoravatar">
    {{image::<?php echo $authoravatar->xt_avatar =='' 'tl_files/theme/image/notauser.png' $authoravatar->xt_avatar?>?width=102&height=87&alt=<?php echo $this->name?>}}
    </div>

    <div class="comment">
    <?php echo $this->comment?> 
    </div>
    <?php if ($this->addReply): ?>
    <div class="reply">
    <p class="info"><?php echo $this->rby?> <?php echo $this->authorName?></p>
    <div class="comment">
    <?php echo $this->reply?> 
    </div>
    </div>
    <?php endif; ?>
    </div>
    I tried everything but cant find how to return the avatars. Any Though? Any help is more than appreciated!

  2. #2
    User Toflar's Avatar
    Join Date
    06-19-09.
    Location
    Lyss, Switzerland
    Posts
    170

    Default

    In the front end, we call them "members". In the back end we call them "users". This is why you should probably query "tl_member" to get your result
    Regards

    Yanick - Contao core developer @terminal42 gmbh

  3. #3
    New user
    Join Date
    12-15-13.
    Posts
    2

    Default

    Quote Originally Posted by Toflar View Post
    In the front end, we call them "members". In the back end we call them "users". This is why you should probably query "tl_member" to get your result
    Many thanks Toflar! That solved the problem!! Contao could be so much nicer if it had a usable documentation with examples. the way it is, is almost impossible to learn on your own...

    regards!

  4. #4
    User Toflar's Avatar
    Join Date
    06-19-09.
    Location
    Lyss, Switzerland
    Posts
    170

    Default

    It's always possible to learn by reading the code I did that in many projects

    But I agree, documentation is a problem. But I don't write documentation either so...
    Regards

    Yanick - Contao core developer @terminal42 gmbh

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
  •