내가 찾은 그 이클립스 (Aptana를, PDT, 또는 젠드)의 맛을 사용하고/* @var 같은 문서 기능을 잘 활용 ... */코멘트 경이를한다. 예를 들어
, 나는 다음과 같은 구조로 Strube_MyModule라는 사용자 지정 모듈 일하고 경우 :
Strube\
MyModule\
Block\
Custom.php
template\
mymodule\
custom.phtml
스트 루베 \ 인 MyModule 블록 \ \ Custom.php
<?php
class Strube_MyModule_Block_Custom extend Mage_Core_Block_Template {
public function _construct() {
$this->setTemplate('../../../../path/to/template/mymodule/custom.phtml');
}
/**
* Eclipse is smart enough to follow PHP-Docs
*
* @return Mage_Customer_Model_Customer
*/
public function getCustomer() {
return Mage::getSingleton('customer/session')->getCustomer();
}
}
템플릿 \의 인 MyModule의 \ 사용자 지정 .phtml
<?php
/**
* PHP DOC!
*/
/* @var $this Strube_MyModule_Block_Custom */
// Now you can auto-complete $this->...
// You can also <ctrl> + click on functions that descent from $this
echo $this->getChildHtml();
// It will also autocomplete based on PHP-doc @return tags
echo $this->getCustomer()->getName();
:
는 자식 저장소를 참조하십시오. 코드 기반의 크기는 걱정거리가 적습니다. – Laizer그러한 인스턴스 생성의 예를 만들 수 있습니까? –
제품을로드하는 데 사용되는 핸들이 항상 생각대로 매핑되지 않을 수도 있습니다. 카탈로그/제품이 Mage_Core_Catalog_Model_Product에 매핑되어야하지만 누군가 다른 메소드를 완전히 다른 클래스로 재정의하고 메소드 중 일부를 다시 작성할 수도 있습니다. –