I would like to specify the number of pieces of information to be displayed separately in foreach of smarty.

Asked 5 months ago, Updated 5 months ago, 14 views

We use an application to create an information display site.I have a question about php and smarty in the new information block.

The block is for displaying up to 6 newly registered information, and the number of the display is specified in php and displayed in smarty using foreach.The problem is that I would like you to display a link button that will guide me to the new arrival list page when I see six new arrivals, but the url of the new arrival list must also be placed in foreach using an array as follows. Could you tell me what to do if I want to see only one button?

<!--{foreach from=$arrProducts item=arrProduct}-->

(What's New)
<h3><a href="<!--{$smarty.const.P_DETAIL_URPATH}-->>!--{$arrProduct.product_id|u}-->>>>!--{$smarty.const.CATEGORY_URPATH}-->_URPATH}-->!--{$arty._artory}

(New information list page button)
<a href="http://xxxx/products/list.php?category_name=<!--{$arrProduct.category_name|h}-->mode=search&category_id=9">><!--{$arrProduct.category_name|ht}>list>>>>>>list


php smarty

2022-09-30 14:08

1 Answers

I'm very sorry.

In the same php file, each program is divided into two parts, and the smarty foreach is divided into two parts.Thank you for your patience.

2022-09-30 14:08

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.