Jump to content
Robert1995

Codeigniter trick

Recommended Posts

Posted (edited)

1. :) Mi-a venit inspiratia si am facut asta Code Igniter , how to "layout"

$data['target_page']['first_page'] = 'view_page';

-> 'view_page' e pagina care vreau sa se "loadeze" asa ar veni , gata cu durerile de cap :)

Controller


class frontend extends CI_Controller {

public function __construct()
{
parent::__construct();
// Your own constructor code

//Load my Models
}

public function index(){
$data = array();
$data['title'] = 'Some Title';
$data['welcome'] = "Robert's Page";
$data['target_page'] = array();
$data['target_page']['first_page'] = 'view_page';
$this->load->view('layout' , $data);
}
}

The View

<head>

</head>


<body>
<div id="wrapper">
<div id="header">
<div id="logo">

</div>
</div>
<div id="menu">

</div>
<div id="content">

 <?php foreach($target_page as $tp): ?>
<?php $this->load->view($tp); ?>
<div class="clear"></div>
<?php endforeach;?>


</div>
<div id="footer">

</div>

</div>

</body>

Astept Comentarii , o sa continui postul cu edituri daca mai trebuie :)

Edited by Robert1995
Posted

Aveam facut eu un mic trick, prin care incarcai ceva de genul $this->load->layout('pageX', $data'); unde pageX este pagina din layout care o incarci. O sa il caut zilele astea prin PC daca-l mai am.

  • Upvote 1
Posted (edited)

:)) ma crezi ca nu stiam ca exista layout pe codeigniter ? dar am gasit Click Still anyway for newbies merge mai bine varianta mea :)) .

Edit :

Mersi Hammer , nu credeam ca o sa mai invat ceva azi

Edited by Robert1995

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...