You can get the name of the current page on $this->name
(in the view);
After that you create a array with every page where the element will not appear and does a check before calling the element in his view;
// Array com os nomes das páginas que o elemento não deve aparecer
$paginas = array("page1", "page2", "page2", "page3");
// Verifica se a página atual está entre as e não deve aparecer
if (!in_array($this->params['action'], $paginas))){
// imprime o elemento
echo $this->element('nome_do_elemento');
}
not that he wants to know, he wants to know how to show the view on some pages and others not
– Erlon Charles
What you said doesn’t make sense. It can only have Elents in separate views or files. If he has it in separate files he obviously knows how to use it in the view he wants, then he has it in his own view. My explanation answers.
– user21494
look at this part of the question "only, on some pages I don’t need the element,but I need to use the view"
– Erlon Charles
Because it has an element embedded in the view. If it separates this Elements into files as mentioned above you can use it in the views you want. Read on before commenting: http://book.cakephp.org/2.0/pt/views.html
– user21494
I know the documentation from cover to cover, what I’m saying is that apparently it doesn’t meet his need, by what I understand of the question, it uses the view on every page, but in the view there is an element that doesn’t need to be on every page, I will post my answer on what I understood of the question.
– Erlon Charles
Then post your answer and let it rewrite. The option to negative the answer is at your disposal. I close here.
– user21494
I have a view that encompasses 80 pages on my site, only recently, includes 5 more pages with this view, but I don’t want to use the element that is in the view, only the view.
– michel
Then my solution is right for you :)
– user21494