feature:tag-listexp

This commit is contained in:
Default
2025-05-05 13:53:11 +08:00
parent 925000f736
commit a32e6911f2

View File

@@ -7,7 +7,8 @@ use think\template\TagLib;
class Video extends TagLib
{
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],
'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],
@@ -53,6 +54,7 @@ class Video extends TagLib
$cache_life = $tag['cache_life'] ?? '0';
$d_key = $tag['d_key'] ?? 'd_key';
$d_val = $tag['d_val'] ?? 'd_val';
$export_name = $tag['export_name'] ?? '';
$sort_type = $this->customBuildVar($sort_type);
$v_status = $this->customBuildVar($v_status);
@@ -76,7 +78,11 @@ class Video extends TagLib
'diff_key' => {$diff_key},
'cache_life' => {$cache_life}
]);
EOT;
if (empty($export_name)) {
$strParse .= <<<EOT
if (!empty(\${$arrDataName}) && is_array(\${$arrDataName})):
?>
@@ -89,9 +95,28 @@ EOT;
<?php endforeach; ?>
<?php endif; ?>
EOT;
} else {
$strParse .= <<<EOT
\${$export_name} = \${$arrDataName};
?>
EOT;
}
return $strParse;
}
/**
* tagListExp
*
* @param array $tag
* @param string $content
* @return void
*/
public function tagListExp($tag, $content)
{
return $this->tagList($tag, $content);
}
/**
* tagPagerExp