Answer the question
In order to leave comments, you need to log in
How to get page information in yii?
The application plans static (the presence of a controller) and dynamic pages (PageController).
Because if you set a rule only for dynamic pages, then static pages will not receive data about the current page and vice versa.
Idea: in the __construct method of the Controller class, add an automatic search for a page at the current url (sitename-ru/page_name), the data is added to $this->pageData.
1. How to get the required page_name from url without routes?
2. Perhaps it should be implemented differently?
Answer the question
In order to leave comments, you need to log in
Thanks for the options - I've re-read everything, but a lot won't work on IE.
I still don’t know which option is better to do:(
".wrapper does not have a height."
And if you make a crutch in JS that will monitor resize and set the wrapper height in pixels?
wouldn't it be better?
Here is a piece of JS code, when loading the page, it will automatically make the height of your block equal to the height of the display of the device on which the page is viewed, I think everything is clear here.
function autoHeight () {
$('.content').css('min-height', $(window).height());
};
autoHeight();
$(window).resize(function() {
autoHeight();
});
2. Perhaps it should be implemented differently?
$this->id (get controller name)
or
Yii::app()->controller->id
Yii::app()->controller->action->id (for action name)
Using a controller constructor is not a very good idea: public function __construct($id,$module=null)
- redefining the parent controller is not easy.
Use the method init()
in which you can already do whatever you want.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question