{"id":891,"date":"2010-03-28T13:59:16","date_gmt":"2010-03-28T04:59:16","guid":{"rendered":"http:\/\/www.kazu.tv\/blog\/?p=891"},"modified":"2010-03-28T13:59:16","modified_gmt":"2010-03-28T04:59:16","slug":"_httpfo","status":"publish","type":"post","link":"https:\/\/kazu.tv\/blog\/2010\/03\/28\/_httpfo\/","title":{"rendered":"Joomla!\u306eView\u3067\u9055\u3046\u540d\u524d\u306eModel\u3092\u4f7f\u3046"},"content":{"rendered":"<p>\u307e\u3060\u307e\u3060Joomla\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u6210\u4e2d\u3002<br \/>\nJoomla\u3067MVC\u30b9\u30bf\u30a4\u30eb\u306b\u6cbf\u3063\u3066\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u308b\u5834\u5408\u3001\u5404\u30af\u30e9\u30b9\u30fb\u30d5\u30a1\u30a4\u30eb\u540d\u3092Joomla\u6d41\u5100\u306e\u547d\u540d\u898f\u5247\u306b\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u7d50\u69cb\u9762\u5012\u3002<br \/>\n\u25a0View\u3067View\u540d\u3068\u306f\u9055\u3046\u540d\u524d\u306eModel\u3092\u4f7f\u3044\u305f\u3044<br \/>\nadmin\u5074\u306e\u6a5f\u80fd\u3092\u5148\u306b\u4f5c\u3063\u305f\u3093\u3060\u3051\u3069\u3001\u30e6\u30fc\u30b6\u30fc\u5074\u306e\u30b3\u30fc\u30c9\u3067\u3082admin\u5074\u3067\u4f5c\u3063\u305fmodel\u3092\u4f7f\u3044\u305f\u3044\u3002\u8272\u3005\u8abf\u3079\u305f\u308a\u8a66\u884c\u932f\u8aa4\u3057\u305f\u308a\u3057\u3066\u30011\u6642\u9593\u304f\u3089\u3044\u304b\u304b\u3063\u3066\u3057\u307e\u3063\u305f&#8230;<br \/>\n\u30d5\u30a9\u30fc\u30e9\u30e0\u306e<a href=\"http:\/\/forum.joomla.org\/viewtopic.php?f=304&#038;t=375644&#038;start=0\" target=\"_blank\">\u3053\u306e\u66f8\u304d\u8fbc\u307f<\/a>\u304c\u7d50\u69cb\u5f79\u306b\u7acb\u3063\u305f\u3002<\/p>\n<p><!--more--><br \/>\n\u25a0\u3084\u308a\u304b\u305f<br \/>\n\u30fbController\u3067\u4f7f\u3044\u305f\u3044Model\u3092View\u306b\u30bb\u30c3\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<br \/>\n\u4ee5\u4e0b\u3001Controller\u306e\u30b3\u30fc\u30c9\u306e\u629c\u7c8b\u3002<\/p>\n<div class=\"code\">\n<pre>function foo() {\n\/\/admin\u5074\u306emodels\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092model\u30af\u30e9\u30b9\u306e\u691c\u7d22\u30d1\u30b9\u306b\u8ffd\u52a0\nJModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');\n\/\/ view\u3067\u4f7f\u3044\u305f\u3044model\u3092\u53d6\u5f97\n$model =& $this->getModel('Modelname', 'Prefix');\n\/\/ view\u3092\u53d6\u5f97\u3057\u3001\u5148\u307b\u3069\u306emodel\u3092\u30bb\u30c3\u30c8\u3059\u308b\n$view =& $this->getView('foo', 'html');\n\/\/ \u7b2c2\u5f15\u6570\u3092 true \u306b\u3059\u308b\u3068\u3001\u3053\u306e\u30e2\u30c7\u30eb\u304c\u305d\u306eview\u306e\u30c7\u30d5\u30a9\u30eb\u30c8model\u306b\u306a\u308b\n$view->setModel($model, true);\n\/\/\u3053\u306e\u8fba\u306f\u666e\u901a\u901a\u308a\u3002\nJRequest::setVar('view', 'foo');\nparent::display();\n}<\/pre>\n<\/div>\n<p>\u6b21\u306bview\u306e\u30b3\u30fc\u30c9\u306e\u629c\u7c8b<\/p>\n<div class=\"code\">\n<pre>function display($tpl = null) {\n\/\/Get the lessons available.\n\/\/ \u4ee5\u4e0b\u306e\u3088\u3046\u306bmodel\u3092\u53d6\u5f97\u53ef\u80fd\n$model = $this->getModel('Modelname', 'Prefix');\n$data = $model->getData();\n\/\/\u3042\u308b\u3044\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3002\n$data = $this->get('Data');\n}<\/pre>\n<\/div>\n<p>\u25a0\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u5834\u5408\u3001\u3053\u3046\u3044\u3046\u9003\u3052\u65b9\u3082\u3042\u308b\u3051\u3069&#8230;<br \/>\n\u6700\u60aa\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306bview\u306e\u4e2d\u3067model\u3092\u666e\u901a\u306b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u3059\u308b\u6c5a\u3044\u30b3\u30fc\u30c9\u306b\u3057\u3088\u3046\u304b\u3068\u601d\u3063\u305f\u3051\u3069\u3001\u4f55\u3068\u304b\u907f\u3051\u3089\u308c\u3066\u826f\u304b\u3063\u305f\u3002<\/p>\n<div class=\"code\"\n\n<pre>\trequire_once(JPATH_COMPONENT_ADMINISTRATOR.DS.&#8217;models&#8217;.DS.&#8217;modelname.php&#8217;);\n$model=new PrefixModelname();\n$data = $model->getData();\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u307e\u3060\u307e\u3060Joomla\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u6210\u4e2d\u3002 Joomla\u3067MVC\u30b9\u30bf\u30a4\u30eb\u306b\u6cbf\u3063\u3066\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u4f5c\u308b\u5834\u5408\u3001\u5404\u30af\u30e9\u30b9\u30fb\u30d5\u30a1\u30a4\u30eb\u540d\u3092Joomla\u6d41\u5100\u306e\u547d\u540d\u898f\u5247\u306b\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u7d50\u69cb\u9762\u5012\u3002 \u25a0View\u3067View\u540d\u3068\u306f\u9055\u3046\u540d\u524d&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[592],"tags":[589,635],"class_list":["post-891","post","type-post","status-publish","format-standard","hentry","category-joomla-2","tag-joomla","tag-mvc"],"_links":{"self":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/891","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/comments?post=891"}],"version-history":[{"count":0,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/891\/revisions"}],"wp:attachment":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/media?parent=891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/categories?post=891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/tags?post=891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}