Comments (1)
This foreach only used if you need send information or data to the view
if you need send data to the view use:
$this->View->render('note/index', $data)
if you no need send info to the view use:
$this->View->render('note/index')
'note/index' is a file in view folder
$data is index array
$data = ["pizza" => true, "ingredients" = "cheese, tomato"];
foreach only run if $data != null
application/core/view.php
foreach ($data as $key => $value) {
$this->{$key} = $value;
}
for each add you data array in element $this of Class View
Ej:
in controller/NoteController.php create new function:
public function hello(){
$this->View->render('note/hello', array(
'title' => 'Hello men')
);
}
in folder view/note create new file "hello.php"
put in this file "Hello.php"
<p><?= $this->title; ?></p>
open you browser and go to http://localhost/note/hello
you see "Hello men"
in this array you send anything string number array or object, and you use in view
$this->anything
from huge.
Related Issues (20)
- [QUESTION] PostgreSQL HOT 4
- MySQL connection error HOT 3
- [NOTE] bootstrap.sh HOT 1
- ❤ ! HOT 1
- Changes for Postgres
- Calling model on view?
- Session validation improvement
- Q
- Configuration files
- Configuration files HOT 5
- New user registration issue
- in the encryption.php file HOT 1
- Pagination Class
- Agregar AJAX al proyecto
- Trying to get in touch regarding a security issue HOT 4
- ErrorController redeclaration HOT 2
- PHP code analizing does not work. HOT 3
- Connection problems with MySql (MariaDb)
- Contact details
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from huge.