{"id":37,"date":"2009-02-09T21:25:36","date_gmt":"2009-02-10T02:25:36","guid":{"rendered":"http:\/\/mikeconley.ca\/blog\/?p=37"},"modified":"2023-12-20T16:25:23","modified_gmt":"2023-12-20T21:25:23","slug":"model-view-controller-in-php","status":"publish","type":"post","link":"https:\/\/mikeconley.ca\/blog\/2009\/02\/09\/model-view-controller-in-php\/","title":{"rendered":"Model-View-Controller in PHP:  View"},"content":{"rendered":"<p>I&#8217;ve been programming in PHP for a few years now, and after being exposed to MVC through Ruby on Rails back in 2007, I came to realize that I liked the idea of keeping the presentation of data separate from the manipulation of data.<\/p>\n<p>So I built a View class.\u00a0 <a href=\"http:\/\/mikeconley.ca\/blog\/wp-content\/uploads\/2009\/02\/viewclass.phps\">Download View Class<\/a><\/p>\n<p>Usage:<\/p>\n<pre>$view = new View('views\/main_page.tpl', array(\r\n       'some_var' =&gt; 'This will be assigned to $some_var in the view'));\r\n$view-&gt;render();<\/pre>\n<p>And like that, data presentation is separated from data manipulation.<\/p>\n<p>Piece of cake.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been programming in PHP for a few years now, and after being exposed to MVC through Ruby on Rails back in 2007, I came to realize that I liked the idea of keeping the presentation of data separate from the manipulation of data. So I built a View class.\u00a0 Download View Class Usage: $view [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,10,1],"tags":[14,11,12,1209,13],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-computer-science","category-php","category-uncategorized","tag-design-patterns","tag-model-view-controller","tag-mvc","tag-php","tag-views"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/prmTy-B","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":13,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":3284,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/37\/revisions\/3284"}],"wp:attachment":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}