About Left Join

Hi there,

I am new when it comes to yii. I have just started using yii 2 days ago, so please bear with me if the questions below seems so trivial or my coding is bad.

I need help with my task to create my own forum. (might be complicated or just a lot to read below)

In the index part of the forum, I want to display the subforum list containing the topics of each subforum.

The basic step-by-step data flows is like the following:

  • Get a command to display subforums list

  • For each subforum (using subforumid) display the topics inside below the subforum

  • for each topic to display, the topic needs username, the content of the last post of the topic & the time of the last post of the topic

There are 4 tables in the database connecting to each other so that:

the topics//_view is


<?php echo CHtml::link('<span class="topictitle">'. CHtml::encode($data->tname) . '</span><span class="time">' . CHtml::encode($data->lastupdated). '</span><span class="topicdesc">'. [b]CHtml::encode($data->creator)[/b] . '</span>', array('//topics/view', 'id'=>$data->id)); ?>


However, the bold one of the last _view gives error:

Is there something wrong with my coding?

I think I must have misunderstood the concept of the dataflow of this framework.

Please help

Never mind this.

It seems I have found the answer, simply by adding

public $creator;

and other variables to class Topics.

Perhaps its better to delete this thread?