मैं XML यहां के माध्यम से 3 पोस्ट के बाद एक छवि हर गूंज करना चाहता था मेरी कोड है:PHP: आप लूप के प्रत्येक एनएच पुनरावृत्ति को कैसे निर्धारित करते हैं?
<?php
// URL of the XML feed.
$feed = 'test.xml';
// How many items do we want to display?
//$display = 3;
// Check our XML file exists
if(!file_exists($feed)) {
die('The XML file could not be found!');
}
// First, open the XML file.
$xml = simplexml_load_file($feed);
// Set the counter for counting how many items we've displayed.
$counter = 0;
// Start the loop to display each item.
foreach($xml->post as $post) {
echo '
<div style="float:left; width: 180px; margin-top:20px; margin-bottom:10px;">
image file</a> <div class="design-sample-txt">'. $post->author.'</div></div>
';
// Increase the counter by one.
$counter++;
// Check to display all the items we want to.
if($counter >= 3) {
echo 'image file';
}
//if($counter == $display) {
// Yes. End the loop.
// break;
//}
// No. Continue.
}
?>
यहाँ एक नमूना पहले 3 सही है, लेकिन अब यह पाश idgc.ca/web-design-samples नहीं है -testing.php
कृपया स्टैक ओवरफ़्लो कोड स्वरूपण मोड का उपयोग करें। आपका कोड अभी पठनीय नहीं है। –
सवाल क्या है? टेक्स्टरेरा में उपलब्ध टूल्स बनाने के लिए भी एक नज़र डालें .. –
सुझाव दें कि आप "एनएचटी लूप पर डिस्प्ले इमेज" जैसे कुछ और वर्णनात्मक प्रश्न को बदल दें। –