我有几个对函数的调用,这些getContent()
函数的参数使用func_get_args()
. 有几个参数保持不变,我想将它们设置为一个变量,以防止在所有这些函数调用中重复重复的参数。
以下是带有完整参数的函数调用示例:
<? getContent(
"article",
"display:list",
"find_series:team",
"find_category:pastors-team",
"order:series",
"find_parent_category:team",
"show:<div class='box box_stories'>",
"show:<div class='box_pad box_img bwWrapper'>",
"show:<div class='box_inner_pad'>",
"show:<h3><a href='/staff-detail/__slug__'>__authorX__</a></h3>",
"show:<p class='teamsummary'>__summary__</p>",
"show:<p class='phone_icon'>__authorXworkphone__</p>",
"show:</div>",
"show:</div>",
"show:</div>"
);
?>
理想情况下,我可以做这样的事情:
<? $myStyle =
"show:<div class='box box_stories'>",
"show:<div class='box_pad box_img bwWrapper'>",
"show:<div class='box_inner_pad'>",
"show:<h3><a href='/staff-detail/__slug__'>__authorX__</a></h3>",
"show:<p class='teamsummary'>__summary__</p>",
"show:<p class='phone_icon'>__authorXworkphone__</p>",
"show:</div>",
"show:</div>",
"show:</div>";
getContent(
"article",
"display:list",
"find_series:team",
"find_category:leadership-team",
"order:series",
"find_parent_category:team",
$myStyle
);
getContent(
"article",
"display:list",
"find_series:team",
"find_category:executive-team",
"order:series",
"find_parent_category:team",
$myStyle
); ?>
这可能吗?解决这个问题的最佳方法是什么?
注意:我不能更改 getContent() 函数,它是 CMS 的核心函数