How to get the file name of the view being displayed? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to get the file name of the view being displayed? (/showthread.php?tid=36049) Pages:
1
2
|
How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]callumd[/eluser] Is there a quick and easy way to identify which view file I am looking at when a page renders? (Other than following the logic through the controller class, function name, etc). Thanks. How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]WanWizard[/eluser] echo __FILE__ in the view? How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]callumd[/eluser] I don't know the file name of the view.. How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]smilie[/eluser] __FILE__ is PHP constant which stores current file... So, literaly, put: echo __FILE__ and you will see filename Cheers, Smilie How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]callumd[/eluser] Where do I put it? I can't put it in the view.. How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]smilie[/eluser] Well, yes you can... <?=__FILE__;?> But, what do you want to achieve? Cheers, Smilie How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]callumd[/eluser] No I mean, I am looking at a webpage in my web browser and I can easily see the view has errors. So, I need to go and find that view file so I can fix the code. But the URL does not tell me which view is being loaded. It tells me which controller and class is being loaded. Is there a way I can quickly find out which view has been loaded without following the logic through my controller? Thanks. How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]John_Betong[/eluser] Maybe try this: View webpage source Find the error Select some relevant text near where you know will be in the view (eg: class='this-or-that' id='whatever') Use your editor to search all your view files for the selected text How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]callumd[/eluser] That's a good idea John_Betong, thanks. Still not quite elegant enough though. I'm new to frameworks.. is needing to quickly identify which view you are looking at not a problem other people have already solved? How to get the file name of the view being displayed? - El Forum - 11-19-2010 [eluser]John_Betong[/eluser] maybe try this: http://ellislab.com/forums/viewthread/173910/#826452 |