Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Magento

                                     2010/02/26
                          Magento-JP User Group




2010   2   26
•
                •
                • Magento
                • Twitter@hirokazu_nishi

2010   2   26
• Magento
                • Magento
                •           XML

                • Block
                •
2010   2   ...
Magento




2010   2   26
app   code        core
                                  community
                                  local
               ...
2010   2   26
design frontend default default layout     XML




                                                locale



             ...
design frontend default default layout     XML




                                                locale



             ...
design frontend default default layout     XML




                                                locale



             ...
•
                •


2010   2   26
Magento




2010   2   26
2010   2   26
2010   2   26
2010   2   26
<?php $collection = $this->getItems(3); ?>
  <?php if ( count($collection) == 0 ) : ?>
  	

  <p><?php echo $this->__('No ...
• if      endif

                • foreach       endforeach

                • $this->hogehoge


2010   2   26
XML



2010   2   26
XML
                •               XML

                •
                •

                •   XML



2010   2   26
XML



2010   2   26
<?xml version="1.0"?>
       <layout version="0.1.0">
       ! <default>
       ! ! <!--
       ! ! <reference name="right...
•   block
                •   reference
                •   action
                •   remove

2010   2   26
block

                •
                    •
                    • <block type=”foo” name=”foo”
                      te...
<?xml version="1.0"?>
       <layout version="0.1.0">
       ! <default>
       ! ! <!--
       ! ! <reference name="right...
reference


                • name=”foo”
                 • <reference name=”foo”>


2010   2   26
<?xml version="1.0"?>
       <layout version="0.1.0">
       ! <default>
       ! ! <!--
       ! ! <reference name="right...
action

                • block
                • block
                 •
                • <action method=”foo”>   </
  ...
<?xml version="1.0"?>
       <layout version="0.1.0">
       ! <default>
       ! ! <!--
       ! ! <reference name="right...
remove

                •
                • <remove name=”foo”/>
                •


2010   2   26
Block



2010   2   26
Block
                •    XML       block



                •          .phtml

                •    XML       public



...
Block
       <block type="foo/foo" name="foo.foo">

                <block type="foo/bar" name="foo.bar" as="bar"/>




  ...
• $this->getChildHtml(‘foo’);
                •


2010   2   26
• CMS   XML



                •


2010   2   26
• {{block type=”cms/block” block_id=”hoge”
                  template=”cms/content.phtml”}}
                • {{widget typ...
• <block type=”cms/block”
                  name=”hoge” (before|after)=”foo”>
                    <action method=”setBlock...
2010   2   26
•   HTML

                •   JS   CSS

                •



2010   2   26
•
                          OK

                •

                •   CSS        JS


2010   2   26
2010   2   26
Upcoming SlideShare
Loading in …5
×

Magento20100226

2,479 views

Published on

OSC2010 Tokyo/Springで使用した資料です。

Published in: Technology
  • Be the first to comment

Magento20100226

  1. 1. Magento 2010/02/26 Magento-JP User Group 2010 2 26
  2. 2. • • • Magento • Twitter@hirokazu_nishi 2010 2 26
  3. 3. • Magento • Magento • XML • Block • 2010 2 26
  4. 4. Magento 2010 2 26
  5. 5. app code core community local design frontend adminhtml etc locale lib js JS skin frontend adminhtml 2010 2 26
  6. 6. 2010 2 26
  7. 7. design frontend default default layout XML locale template foo bar 2010 2 26
  8. 8. design frontend default default layout XML locale template foo bar 2010 2 26
  9. 9. design frontend default default layout XML locale template foo bar 2010 2 26
  10. 10. • • 2010 2 26
  11. 11. Magento 2010 2 26
  12. 12. 2010 2 26
  13. 13. 2010 2 26
  14. 14. 2010 2 26
  15. 15. <?php $collection = $this->getItems(3); ?> <?php if ( count($collection) == 0 ) : ?> <p><?php echo $this->__('No news yet...'); ?></p> <?php else : ?> <dl> <?php foreach ( $collection as $_item ) : ?> <dt><a href="<?php echo Mage::helper('snews')->getUrl($_item['identifier']); ?>"><?php echo $_item['title']; ?></a></dt> <dd><?php echo $_item['date']; ?></dd> <dd> <?php if ( Mage::helper('snews')->getListLimitDescription() == 0 || strlen($_item ['description']) < Mage::helper('snews')->getListLimitDescription() ) : ?> <?php echo $_item['description']; ?> <?php else : ?> <?php echo substr($_item['description'], 0, Mage::helper('snews')- >getListLimitDescription()); ?>... <?php endif; ?> </dd> <dd><a href="<?php echo Mage::helper('snews')->getUrl($_item['identifier']); ?>"><?php echo $this->__('Learn more...'); ?></a></dd> <?php endforeach; ?> </dl> <?php endif; ?> 2010 2 26
  16. 16. • if endif • foreach endforeach • $this->hogehoge 2010 2 26
  17. 17. XML 2010 2 26
  18. 18. XML • XML • • • XML 2010 2 26
  19. 19. XML 2010 2 26
  20. 20. <?xml version="1.0"?> <layout version="0.1.0"> ! <default> ! ! <!-- ! ! <reference name="right"> ! ! ! <block type="snews/block" name="snews.block" as="newsBlock" template="scalena/ news/block.phtml"/> ! ! </reference> ! ! --> ! </default> ! <snews_index_index> <reference name="root"> <action method="setTemplate"><template>page/2columns-right.phtml</ template></action> </reference> <reference name="content"> <block type="snews/items" name="snews.news" template="scalena/news/ news.phtml"> ! <block type="snews/pagination" name="snews.pagination" as="pagination" template="scalena/news/pagination.phtml"/> </block> </reference> </snews_index_index> <snews_index_view> <reference name="root"> <action method="setTemplate"><template>page/2columns-right.phtml</ template></action> </reference> <reference name="content"> <block type="snews/item" name="snews.detail" template="scalena/news/news- detail.phtml" /> </reference> </snews_index_view> </layout> 2010 2 26
  21. 21. • block • reference • action • remove 2010 2 26
  22. 22. block • • • <block type=”foo” name=”foo” template=”foo.phtml” /> 2010 2 26
  23. 23. <?xml version="1.0"?> <layout version="0.1.0"> ! <default> ! ! <!-- ! ! <reference name="right"> ! ! ! <block type="snews/block" name="snews.block" as="newsBlock" template="scalena/ news/block.phtml"/> ! ! </reference> ! ! --> ! </default> ! <snews_index_index> <reference name="root"> <action method="setTemplate"><template>page/2columns-right.phtml</ template></action> </reference> <reference name="content"> <block type="snews/items" name="snews.news" template="scalena/news/ news.phtml"> ! <block type="snews/pagination" name="snews.pagination" as="pagination" template="scalena/news/pagination.phtml"/> </block> </reference> </snews_index_index> <snews_index_view> <reference name="root"> <action method="setTemplate"><template>page/2columns-right.phtml</ template></action> </reference> <reference name="content"> <block type="snews/item" name="snews.detail" template="scalena/news/news- detail.phtml" /> </reference> </snews_index_view> </layout> 2010 2 26
  24. 24. reference • name=”foo” • <reference name=”foo”> 2010 2 26
  25. 25. <?xml version="1.0"?> <layout version="0.1.0"> ! <default> ! ! <!-- ! ! <reference name="right"> ! ! ! <block type="snews/block" name="snews.block" as="newsBlock" template="scalena/ news/block.phtml"/> ! ! </reference> ! ! --> ! </default> ! <snews_index_index> <reference name="root"> <action method="setTemplate"><template>page/2columns-right.phtml</ template></action> </reference> <reference name="content"> <block type="snews/items" name="snews.news" template="scalena/news/ news.phtml"> ! <block type="snews/pagination" name="snews.pagination" as="pagination" template="scalena/news/pagination.phtml"/> </block> </reference> </snews_index_index> <snews_index_view> <reference name="root"> <action method="setTemplate"><template>page/2columns-right.phtml</ template></action> </reference> <reference name="content"> <block type="snews/item" name="snews.detail" template="scalena/news/news- detail.phtml" /> </reference> </snews_index_view> </layout> 2010 2 26
  26. 26. action • block • block • • <action method=”foo”> </ action> 2010 2 26
  27. 27. <?xml version="1.0"?> <layout version="0.1.0"> ! <default> ! ! <!-- ! ! <reference name="right"> ! ! ! <block type="snews/block" name="snews.block" as="newsBlock" template="scalena/ news/block.phtml"/> ! ! </reference> ! ! --> ! </default> ! <snews_index_index> <reference name="root"> <action method="setTemplate"><template>page/2columns-right.phtml</ template></action> </reference> <reference name="content"> <block type="snews/items" name="snews.news" template="scalena/news/ news.phtml"> ! <block type="snews/pagination" name="snews.pagination" as="pagination" template="scalena/news/pagination.phtml"/> </block> </reference> </snews_index_index> <snews_index_view> <reference name="root"> <action method="setTemplate"><template>page/2columns-right.phtml</ template></action> </reference> <reference name="content"> <block type="snews/item" name="snews.detail" template="scalena/news/news- detail.phtml" /> </reference> </snews_index_view> </layout> 2010 2 26
  28. 28. remove • • <remove name=”foo”/> • 2010 2 26
  29. 29. Block 2010 2 26
  30. 30. Block • XML block • .phtml • XML public • XML 2010 2 26
  31. 31. Block <block type="foo/foo" name="foo.foo"> <block type="foo/bar" name="foo.bar" as="bar"/> </block> 2010 2 26
  32. 32. • $this->getChildHtml(‘foo’); • 2010 2 26
  33. 33. • CMS XML • 2010 2 26
  34. 34. • {{block type=”cms/block” block_id=”hoge” template=”cms/content.phtml”}} • {{widget type="cms/widget_block" template="cms/widget/static_block/ default.phtml" block_id="5"}} 2010 2 26
  35. 35. • <block type=”cms/block” name=”hoge” (before|after)=”foo”> <action method=”setBlockId”> hoge </action> </block> 2010 2 26
  36. 36. 2010 2 26
  37. 37. • HTML • JS CSS • 2010 2 26
  38. 38. • OK • • CSS JS 2010 2 26
  39. 39. 2010 2 26

×