小编kwe*_*wek的帖子

PHP:如何确定循环的每个第N次迭代?

我希望通过XML发布每3个帖子后回显一个图像这里是我的代码:

<?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; …
Run Code Online (Sandbox Code Playgroud)

html php loops

52
推荐指数
4
解决办法
9万
查看次数

Php读取目录文件

我有一个脚本通过一个有3个图像的目录

$imglist='';
$img_folder = "path to my image";

//use the directory class
$imgs = dir($img_folder);

//read all files from the  directory, checks if are images and ads them to a list 
while ($file = $imgs->read()) {
  if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
    $imglist .= "$file ";
} 
closedir($imgs->handle);

//put all images into an array
$imglist = explode(" ", $imglist);

//display image
foreach($imglist as $image) {
  echo '<img src="'.$img_folder.$image.'">';
}
Run Code Online (Sandbox Code Playgroud)

但我遇到的问题是显示没有图像的第4个img ..但我在该文件夹中只有3个图像.

php

4
推荐指数
1
解决办法
3017
查看次数

Wordpress PHP如果有其他帮助

我一直在尝试这几个小时

<?php

if ($_SERVER['SERVER_NAME']=='http://www.testground.idghosting.com/idi' && $_SERVER['REQUEST_URI'] == 'our-production/') {

         echo '<div id="services">
<h1>Our services</h1>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_productions" title="Our Productions"><span>Our Productions</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_services" title="Production Services"><span>Production Services</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_equipment" title="Equipment &amp; Facilities"><span>Equipment &amp; Facilities</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_pr" title="PR &amp; Media"><span>PR &amp; Media</span></a>

</div>';
     } else {
         echo '<div> do not show</div>';
     } ;
 ?>
Run Code Online (Sandbox Code Playgroud)

但没有运气......非常感谢帮助..

php wordpress

1
推荐指数
1
解决办法
611
查看次数

PHP if else请求URI帮助

我尝试过这样做但是它没有用

 <?php

if ($_SERVER['SERVER_NAME']=='http://www.testground.idghosting.com/idi' && $_SERVER['REQUEST_URI'] == 'our-production/') {

         echo '<div id="services">
<h1>Our services</h1>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_productions" title="Our Productions"><span>Our Productions</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_services" title="Production Services"><span>Production Services</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_equipment" title="Equipment &amp; Facilities"><span>Equipment &amp; Facilities</span></a>
<a href="<?php bloginfo(\'url\'); ?>" id="serv_pr" title="PR &amp; Media"><span>PR &amp; Media</span></a>

</div>';
     } else {
         echo '<div> do not show</div>';
     } ;
 ?>
Run Code Online (Sandbox Code Playgroud)

看到样本点击这里看到它所说的块我们的服务在底部我不希望它显示在页面上,但对所有其他页面可见....

php syntax

0
推荐指数
1
解决办法
8417
查看次数

Jquery工具和MooTools冲突

我正在尝试制作一个jquery工具提示,以便在mootools灯箱中打开一个链接.

能帮帮我吗...这是我的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<script language="javascript" type="text/javascript" src="js/bumpbox.js"></script>
<script src="js/sifr.js" type="text/javascript"></script>
<script src="js/sifr-config.js" type="text/javascript"></script>
<script src="http://cdn.jquerytools.org/1.1.2/full/jquery.tools.min.js" type="text/javascript"/></script>
    <script type="text/javascript">
        //no conflict jquery
        var $ = jQuery.noConflict();
        //jquery stuff
    </script>
    <script language="javascript" type="text/javascript" src="js/mootools.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen,projection" />

<head>
Run Code Online (Sandbox Code Playgroud)

现在这是我的身体代码:

    <p>Phasellus pulvinar lacinia sapien eu lacinia. Sed fermentum augue et lectus ullamcorper quis cursus justo venenatis. Aenean id molestie leo. Vivamus ultrices lobortis velit, quis euismod …
Run Code Online (Sandbox Code Playgroud)

javascript jquery mootools

0
推荐指数
1
解决办法
3134
查看次数

PHP中的解析错误

以下代码:

<?php

if ($_SERVER['REQUEST_METHOD'] != 'POST'){
    $self = $_SERVER['PHP_SELF'];

?>
Run Code Online (Sandbox Code Playgroud)

生成此错误:

解析错误:语法错误,第26行/home/idghosti/public_html/testground/mma/include/header.php中的意外$ end

我的代码出了什么问题?

php syntax-error

-1
推荐指数
1
解决办法
244
查看次数

另一个PHP语法错误

这是错误:

解析错误:语法错误,第9行/home/idghosti/public_html/testground/mma/include/footer.php中的意外'}'

这是代码:

<?php
    } else {
        error_reporting(0);

        if  (mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"))

        //Message sent!
        //It the message that will be displayed when the user click the sumbit button
        //You can modify the text if you want
        echo nl2br("
        <div class=\"MsgSent\">
            <h1>Congratulations!!</h1>
            <p>Thank you <b>$name</b>, your message is sent!<br /> We will get back to you as soon as possible.</p>
        </div>
       ");

        else

        // Display error message if the message failed to send
        echo "
        <div class=\"MsgError\"> …
Run Code Online (Sandbox Code Playgroud)

php syntax-error

-3
推荐指数
1
解决办法
250
查看次数

标签 统计

php ×6

syntax-error ×2

html ×1

javascript ×1

jquery ×1

loops ×1

mootools ×1

syntax ×1

wordpress ×1