-1

我是将印刷和页面布局元素应用于动态数据的新手。

我用过这段代码 -<p><?php echo preg_replace('/[\r\n]+/', '</p><p>', $row_rs_AZ_Products_Detail_pg['ItemLongDesc']); ?></p>

插入下面从我的数据库生成的段落。段落完全分开,但我需要创建一个需要信息的列表格式或在段落中间编号。我被指示放置此代码 -

p {
    margin: 0 0 0.25em 0;
}

进入页面,但我不知道该怎么做。任何人都可以帮助我或提出更好的建议吗?您的帮助将不胜感激。

数据输出:

Make someone special feel special with a Customized and Personalized full color Autograph Photo Football Sports Ball. Before clicking the Add to Cart button to place your order, please cut and past the INFORMATION NEEDED below into your email and email to tony@awardzone.net.

INFORMATION NEEDED:

TEXT ABOVE PHOTO - 1 Line Recommended [Type your text here]

CENTER PHOTO OR LOGO - (attach jpeg format image)

TEXT BELOW PHOTO - 1 Line Recommended [Type your text here]

TEAM COLORS - [Type your colors here]

YOUR CONTACT PHONE - [Type your text here]

YOUR EMAIL ADDRESS - [ [Type your text here]

(Optional) MASCOT NAME - [Type your text here]

And/or MASCOT LOGO (attach jpeg format image)

YOUR IN HAND DATE? - [Type your date here]

IMPORTANT - Your final layout proof will be approved by YOU before imprinting and shipment. *All personal information will remain confidential and will not be sold.

QUESTIONS? Email tony@awardzone.net or call Tony at 973-347-6819
4

1 回答 1

0

这取决于您的数据的固定程度,但是根据您所展示的内容,我会:

  • 在多个换行符上分解输入(使用 preg_split)以获得包含所有行的数组
  • 从数组中删除前两个条目以用作前导段落并回显它们
  • 从数组中删除最后两个条目以用作结尾段落
  • 开始一个列表(<ul><ol>
  • 将剩余的数组作为列表项回显
  • 关闭列表
  • 呼出两个结尾段落
于 2012-08-30T22:40:49.173 回答