我已經有一段時間沒有使用PHP編碼,不記得如何做到這一點..內HTML中使用引號屬性
我使用的需要設置一些相對參數的jQuery插件。
$imgtag = '<a href="'.carturl($img->id,'images').'/'.$img->filename.'" class = "zoom" id="zoom1" rel="adjustX: 10, adjustY:-4, zoomWidth:150, zoomHeight:150">
<img src="'.$src.'"'.$titleattr.' alt="'.$alt.'" width="'.$width_a.'" height="'.$height_a.'" '.$classes.' /></a>';
現在我需要添加, position: "inside"
到相對位,然而,每次我這樣做的時候,它在HTML輸出作爲引號所有的地方。該插件必須將「內部」這個單詞的引號零散地工作,但是,我需要在「rel =」引號內使用這些引號。
我該如何解決這個問題?
HTML輸出應該是這樣的:
<a style="position: relative; display: block;" href="http://www.URL.com/theimage.jpg" class="cloud-zoom" id="zoom1" rel="adjustX: 10, adjustY:-4, zoomWidth:150, zoomHeight:150, position:"inside"">
<img style="display: block;" src="http://www.URL.com/theimage.jpg" alt="product-picture" height="450" width="360"></a>
謝謝!
你確定應該有位置引號:「裏面」?不能只是位置:裏面? – itsmeee
@itsmeee:它必須與引號:(不會工作沒有 – MartinH23
它實際上是一個HTML問題,而不是PHP :) PHP只是生成任何HTML,你說他生成,所以我修正了標題更具描述性。 –