Is there a way to identify the model name and controller name of the views like print_r($model) or print_r($controller)?
For example:
view.php
<div class="data">
<?php
echo "this is from".$controller;
echo "this is from".$model;
?>
</div>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get the name of the controller with this:
You have to pass controller name to view (as a variable).
But you cannot identify model in the view – there could be more than one model (in one controller). The best way is to create method in your model and assign it to variable passed to the view.