CodeIgniter Forums
Best practice for simple HTML and PHP code reuse in views? - 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: Best practice for simple HTML and PHP code reuse in views? (/showthread.php?tid=2495)



Best practice for simple HTML and PHP code reuse in views? - El Forum - 08-08-2007

[eluser]mazaka[/eluser]
Hi all, I just started using CI, and it looks very promising!

I searched the forum for good ways of reusing and including code in views, but havent found exactly what I am looking for.

I simply want to include pageheaders, footers, simple nav bars and CSS info (yeah I have to have it inline, I cant link it to external css files for this proj. Its for phones. Phones dont like that.)


Until I find a better way, I do this in a VIEW file:

Code:
<head>
        <?php require dirname(__FILE__).'/../myOwnIncludeFolder/inc.css.xhtml.php'; ?>
</head>

Does someone have the correct approach?

thanks!


Best practice for simple HTML and PHP code reuse in views? - El Forum - 08-08-2007

[eluser]sophistry[/eluser]
The FAQ will lead you in several directions - one of them will satisfy.


Best practice for simple HTML and PHP code reuse in views? - El Forum - 08-08-2007

[eluser]mazaka[/eluser]
Ah, you're right, I found a good answer there!
Thanks for a fast response!