feature:tag-listexp
This commit is contained in:
@@ -7,7 +7,8 @@ use think\template\TagLib;
|
|||||||
class Video extends TagLib
|
class Video extends TagLib
|
||||||
{
|
{
|
||||||
protected $tags = [
|
protected $tags = [
|
||||||
'list' => ['attr' => 'count,v_category,v_parent_category_en,sort_type,v_status,v_sex,diff_key,cache_life,d_key,d_val', 'close' => 1],
|
'list' => ['attr' => 'count,v_category,v_parent_category_en,sort_type,v_status,v_sex,diff_key,cache_life,d_key,d_val,export_name', 'close' => 1],
|
||||||
|
'listexp' => ['attr' => 'count,v_category,v_parent_category_en,sort_type,v_status,v_sex,diff_key,cache_life,d_key,d_val,export_name', 'close' => 0],
|
||||||
'pager' => ['attr' => 'page,limit,v_category,v_parent_category_en,sort_type,v_status,v_sex,key,diff_key,cache_life,d_key,d_val,p_val,func,export_name', 'close' => 1],
|
'pager' => ['attr' => 'page,limit,v_category,v_parent_category_en,sort_type,v_status,v_sex,key,diff_key,cache_life,d_key,d_val,p_val,func,export_name', 'close' => 1],
|
||||||
'pagerexp' => ['attr' => 'page,limit,v_class,v_category,v_parent_category_en,sort_type,v_status,v_sex,key,diff_key,cache_life,d_key,d_val,p_val,func,export_name', 'close' => 0],
|
'pagerexp' => ['attr' => 'page,limit,v_class,v_category,v_parent_category_en,sort_type,v_status,v_sex,key,diff_key,cache_life,d_key,d_val,p_val,func,export_name', 'close' => 0],
|
||||||
'info' => ['attr' => 'v_id,v_forge_id,v_key', 'close' => 0],
|
'info' => ['attr' => 'v_id,v_forge_id,v_key', 'close' => 0],
|
||||||
@@ -53,6 +54,7 @@ class Video extends TagLib
|
|||||||
$cache_life = $tag['cache_life'] ?? '0';
|
$cache_life = $tag['cache_life'] ?? '0';
|
||||||
$d_key = $tag['d_key'] ?? 'd_key';
|
$d_key = $tag['d_key'] ?? 'd_key';
|
||||||
$d_val = $tag['d_val'] ?? 'd_val';
|
$d_val = $tag['d_val'] ?? 'd_val';
|
||||||
|
$export_name = $tag['export_name'] ?? '';
|
||||||
|
|
||||||
$sort_type = $this->customBuildVar($sort_type);
|
$sort_type = $this->customBuildVar($sort_type);
|
||||||
$v_status = $this->customBuildVar($v_status);
|
$v_status = $this->customBuildVar($v_status);
|
||||||
@@ -76,22 +78,45 @@ class Video extends TagLib
|
|||||||
'diff_key' => {$diff_key},
|
'diff_key' => {$diff_key},
|
||||||
'cache_life' => {$cache_life}
|
'cache_life' => {$cache_life}
|
||||||
]);
|
]);
|
||||||
|
EOT;
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($export_name)) {
|
||||||
|
$strParse .= <<<EOT
|
||||||
if (!empty(\${$arrDataName}) && is_array(\${$arrDataName})):
|
if (!empty(\${$arrDataName}) && is_array(\${$arrDataName})):
|
||||||
|
|
||||||
?>
|
?>
|
||||||
EOT;
|
EOT;
|
||||||
$strParse .= <<<EOT
|
$strParse .= <<<EOT
|
||||||
<?php foreach (\${$arrDataName} as \${$d_key} => \${$d_val}): ?>
|
<?php foreach (\${$arrDataName} as \${$d_key} => \${$d_val}): ?>
|
||||||
EOT;
|
EOT;
|
||||||
$strParse .= $content;
|
$strParse .= $content;
|
||||||
$strParse .= <<<EOT
|
$strParse .= <<<EOT
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
EOT;
|
EOT;
|
||||||
|
} else {
|
||||||
|
$strParse .= <<<EOT
|
||||||
|
\${$export_name} = \${$arrDataName};
|
||||||
|
?>
|
||||||
|
EOT;
|
||||||
|
}
|
||||||
|
|
||||||
return $strParse;
|
return $strParse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tagListExp
|
||||||
|
*
|
||||||
|
* @param array $tag
|
||||||
|
* @param string $content
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function tagListExp($tag, $content)
|
||||||
|
{
|
||||||
|
return $this->tagList($tag, $content);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tagPagerExp
|
* tagPagerExp
|
||||||
|
|||||||
Reference in New Issue
Block a user