0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

NetCommons2 使用しているテンプレート名をphpで取得する

Last updated at Posted at 2021-01-29

旧会社HPからの転記です。

php側でテンプレート名を使ってプラグラムの動きを変えたかったので、
やり方を調査しました。

下記PHPで実現できます。
componentsの場合

$container =& DIContainerFactory::getContainer();
$block =& $container->getComponent("blocksView");
$block_id = intval($request->getParameter("block_id"));
$block_obj = $block->getBlockById($block_id);

// $block_obj['temp_name'];    //←テンプレート名が取得できる

(2018/09/28追記)

view・actionの場合

PHP

```php5 var $block_id = null; var $blocksView = null;

function execute()
{
$block_obj = $this->blocksView->getBlockById($this->block_id);
$block_obj['temp_name']; //←テンプレート名が取得できる
}

<p>maple.ini</p>
```ini
[Action]
blocksView = "ref:blocksView"

参考になれば幸いです。
ではでは。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?