This is my first post here and my first time extensively using Yii. I really like it so far and I have quite a big project i’d like to build in Yii.
My Question is, what are the relationships between column1.php, column2.php and the main.php file.
I’ve made a start on my own template before I started using Yii, now I’d like to style the standard Yii web app using my own styles (which i’ve done to a degree), but I wanted to fully understand what column1.php/column2.php/main.php were and probably more importantly, when these files are used and incorporated into a page. I don’t want to accidentally “break” an aspect of Yii inadvertently.
main.php is a base template (layout) of a site. It contains header and footer, menu and other common stuff. column1 and column2 are sublayouts. They are included into main.php (but main.php can be also used directly). Which one to include you should specify in a view file (e.g. post/view.php). You can choose any (main, column1 or column2). So, when you call $this->render(‘list’, array(…)) and set $this->layout = ‘column2’, then list.php is included into column2.php which is included into main.php (via “echo $content”).
Thanks for your reply, no it was a great help. I’ve never really ran anything through a solitary file before like a bootstrap, so I wanted to know how it all fitted together, so thanks.
I may well return if I encounter other queries, but thanks for your help!
A slight progression from this topic (If i should post a new topic please let me know), I wonder if you can clarify for me the best way to achieve something like this:
Basically I have a moderately sized personal project and I want on my index page a search form, a list of the most recent items and maybe a featured section also.
The form will be fairly large (in terms of details), so that can a user can search by keywords in a title or a description or both, along with a category search, which I plan to be a series of checkboxes and finally i think I shall have a distance search all in one form.
The list of most recent items will be 40 records worth of the most recent results, and the featured section will be again be a list of records from a separate DB (I imagine) of some featured items say 10 maybe.
In terms of the featured results and the 40 most recent results, I believe I would need to create the models and create the controllers to work with the DB in Gii in order to get the data and manipulate it? Would that be correct?
To get the index page the way I want visually would i just need to create/edit the index.php view in order to get it to display the form?
I guess my final question is that if you create a model and controller say recentItems.php using Gii but you want to access 40 records of the recentItems database, how do you put that information in a file other than www.example.com/index.php/recentItems/ for example ‘index.php’ that I want to?