# 在ec-cube的頁面中加入layout中加入新的區塊(DIV)

- URL: https://justfly.idv.tw/%e5%9c%a8ec-cube%e7%9a%84%e9%a0%81%e9%9d%a2%e4%b8%ad%e5%8a%a0%e5%85%a5layout%e4%b8%ad%e5%8a%a0%e5%85%a5%e6%96%b0%e7%9a%84%e5%8d%80%e5%a1%8adiv/
- 日期: 2008-10-17
- 分類: WEB&amp;RIA
- 標籤: css, ec-cube, layout, php, seo, カテゴリー

用內建的block管理功能是可以很容易控制左,右,中三個主要區塊的副區塊

不過老闆這次希望是”在首頁下方”加一個帶比較多關鍵字的產品表格或是カテゴリー!?

也就是要把首頁多切一塊下方的區塊出來放這個表格

據說是對seo有幫助

研究了之後再做一下筆記吧

- \data\Smarty\templates\mystyle\site_main.tpl加入

```

```

- 在\html\user_data\packages\mystyle\中建立一個tablefoot.tpl

```
tablefoot-area TEST!!
```

- \data\class\helper\SC_Helper_PageLayout.php的function lfgetPageData()加一行

```
$sql .= " ,tablefoot_chk ";     // 下方表格的使用FLG
```

- 進my-SQL的dtb_pagelayout中加一個tablefoot_chk的欄位

並且把top的值改成:”1″(因為要改的是首頁麻)

- \data\class\SC_View.php中function SC_View()加上路徑對應

```
// ヘッダとフッタを割り当て
        $header_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "header.tpl";
	$tablefoot_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "tablefoot.tpl";
        $footer_tpl = USER_PATH . USER_PACKAGE_DIR . TEMPLATE_NAME . "/" . "footer.tpl";

        // ユーザー作成のテンプレートが無ければ, 指定テンプレートを割り当て
        if (!$this->_smarty->template_exists($header_tpl)) {
            $header_tpl = TEMPLATE_DIR . "header.tpl";
        }
        if (!$this->_smarty->template_exists($footer_tpl)) {
            $footer_tpl = TEMPLATE_DIR . "footer.tpl";
        }

        $this->assign("header_tpl", $header_tpl);
	$this->assign("tablefoot_tpl", $tablefoot_tpl);
        $this->assign("footer_tpl", $footer_tpl);
    }
```

完成後要放的表格就寫在\html\user_data\packages\mystyle\tablefoot.tpl就ok了

如果還有其他頁要放

當然就是改一下my-SQL中tablefoot_chk的值囉
