I
I
iceman21122014-09-13 09:29:58
Yii
iceman2112, 2014-09-13 09:29:58

I'm making widget banners. How to correctly implement a schema in a DB and other small questions for a yii beginner?

The task is educational.
In general, the meaning is this, 4 banners are displayed on one page (left, right, bottom and top) . All this is done by one action of one controller (which can be changed for the banner, but this is not
very important yet ) for example, who had fewer impressions)
Questions No. 1:
Since banners can be of 3 types - a picture with a link, flash, html-code. I made 3 database tables to store this whole thing -
a) banner (id, type, position, controller, action, shows, and columns with parameters by which the action filters banners)
b) 2 tables -banner_img (id, banner_id, image, url) and banner_code (id, banner_id, code) for image banners and flash + html respectively. they cling 1 to 1 to the banner table.
Those. I look at the type of the banner and take the data from the corresponding table.
I am new to programming in general, so I ask you to evaluate this scheme for the task.
Question #2:
You need to consider showing banner ads. I don't know where to do this, or after the controller has chosen which banners will "fall" where , do shows++ and save. Or in the banner itself in run()?
Question #3
In which directory to store pictures for banners, because I will edit them both in the backend and in the frontend, so you need to store them in common? And how then to get the src for the img tag from, say frontend. Because Url::toRounte(['/common/web/banners']) will give - frontend/web/common/......
Question #4:
This is a question that would be better clarified with the one who gave me this is a task, but now it is not there yet, so who can, express your opinion. For some reason, it is indicated that you need to write your own widget for each place for the banner, i.e. 4 pieces - TopBanner, RightBanner, etc.
In general, I have no idea why 4? Is it possible to file 1 widget that will work with the Banner model, and mark the view into 4 parts , and call it in each block with different models ?Or is it invented so that I just start all 4 banners in the view, and they already "fall" into place, based on the css settings inside?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question