2012-08-30 56 views
-1

我對將動態數據應用排版和頁面佈局元素不熟悉。將CSS元素應用到PHP動態數據

我已經使用這個代碼 - <p><?php echo preg_replace('/[\r\n]+/', '</p><p>', $row_rs_AZ_Products_Detail_pg['ItemLongDesc']); ?></p>

插入段落從我的數據庫之下產生的。段落完全分開,但我需要創建一個名爲「INFORMATION NEEDED」的子列表,或者在段落中間編號。我被指示將此代碼 -

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 [email protected] 

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 [email protected] or call Tony at 973-347-6819 

回答

0

這取決於如何固定您的數據,但你已經證明什麼,我想:

  • 爆炸多換行符輸入(通過使preg_split )得到一個包含所有行的數組
  • 刪除數組中的前兩個條目作爲前導段落並將它們回顯出來
  • 刪除數組中的最後兩個條目y以被用作結束段落
  • 開始列表(<ul><ol>或)
  • 回聲剩餘陣列出作爲列表項
  • 關閉列表
  • 回聲出兩個結束paragraps