1
It’s the following guys, I have a page of the project that serves as a standard for all the others, a Layout.. However I wish to add an item (informative) in it, and it only remains on the home page and in the CRUD of the informative, when it goes to other pages that occurs the controller exchange, gives error and the informative disappear. Could someone help??
layout page:
<div class="col-md-8">
<div id="c-slide" class="carousel slide auto panel">
<div class="carousel-inner">
<?php foreach ($informativos as $index => $informativo){ ?>
<div class="item text-center<?php echo ($index === 0 ? " active" : "") ?>" style="width: 90%;margin-left:5%">
<div class="alert alert-block alert-<?php echo $informativo['Informativo']['tipo']; ?> fade in">
<?php echo $informativo['Informativo']['texto']; ?>
</div>
</div>
<?php } ?>
</div>
<a data-slide="prev" href="#c-slide" class="left carousel-control">
<i class="fa fa-angle-left"></i>
</a>
<a id="nextInformativo" data-slide="next" href="#c-slide" class="right carousel-control">
<i class="fa fa-angle-right"></i>
</a>
</div>
</div>
App Controller:
public $helpers = array(
'Gravatar.Gravatar',
'Html',
'Form',
'Session'
);
public $components = array(
'Auth' => array(
'authenticate' => array('Saml.Saml')
),
'Session',
'Cookie');
var $uses = array('User');
public function beforeFilter() {
parent::beforeFilter();
$this->set('convertTime', $this->convertTime);
if ($this->Saml){
if ($this->Saml->isAuthenticated()) {
$infoWSO2 = $this->Saml->getAttributes();
if($this->Session->read('UsuarioLogado') == NULL){
$userSistema = $this->User->atualizaSessao($infoWSO2);
$this->Session->write('UsuarioLogado', $userSistema);
}
$this->set('login_user', $infoWSO2);
}
}
}
In fact it is an internal intranet of the company, and this item "informative" is just a common text, which will not generate slowness.. I will test here and soon I give a return. Thanks
– Julyano Felipe
So, at first it’s correct, but in practice it’s making a mistake.. You’re saying that I’m calling the find() function on a non-eobject, but when I capture the variable created through var_dump, all the information is in the variable, it’s all right.. I don’t know what it could be..
– Julyano Felipe
Don’t forget to declare in your app controler public $uses = array('Seumodel'); Out of the beforeRender. Do this and tell us if it worked. I hope I helped :D
– Artur
I’m already using the $uses variable: var $uses = array('User'), how do I do now? I’m sorry, but I’m kind of layabout it..
– Julyano Felipe
Post your code please, so it is easier to identify the problem. Edit your question, and put it there.
– Artur
I edited my question
– Julyano Felipe
I managed to do based on your help, I only had to load the Model of the newsletters, thanks
– Julyano Felipe
Good! If you need to use more than one model in the same controller, simply add it to the array. var $uses = array('User','Outromodel','Terceiromodel');
– Artur