M
M
Mikhail Shatilov2014-06-06 02:35:39
css
Mikhail Shatilov, 2014-06-06 02:35:39

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

7 answer(s)
N
nurise, 2016-01-11
@nurise

you can use
height: 100vh;

M
Mikhail Vlasov, 2016-01-11
@storm_uk

dimox.name/press_footer_bottom_with_css

E
Enot, 2016-01-12
Enotov

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?

I
Ilya Pirozhok, 2016-01-12
@kamikadze1996

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();
  });

S
Sergey, 2014-06-06
Protko @Fesor

2. Perhaps it should be implemented differently?

Yes exactly. But it's hard to tell from the information available. At least doing something like this in the constructor and not using routing is not reasonable.

X
x88, 2014-06-06
@x88

$this->id (get controller name)
or
Yii::app()->controller->id
Yii::app()->controller->action->id (for action name)

S
Seydamet Bilyalov, 2014-06-14
@seydametbilyalov

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 question

Ask a Question

731 491 924 answers to any question