开发者

<div> doesn't appear

so this is how index.php looks like:

<div id="wrapper"> 
    <div id="header"> 
        <div id="logo"> 
            <h1>...</h1> 
        </div> 
        <div id="nav-bar"> 
        ...
        </div> 
    </div> 
    <div id="content"> 
        <div id="main"> 
            <div id="posts"> 
                ...
            </div> 
            <div id="pages"> 
                ...
            </div> 
        </div> 
        <div id="countries"> 
             <ul> 
                <li></li>  
                ...            
             </ul> 
        </div> 
    </div> 
        <div id="adverts"> 
            ...
        </div> 

and then i call ajax function ajax.query("page.php?category=culture&limit=5&c=1","content") to change "content" div. this is how actual page.php looks like:

<?php
    include 'class/mysql.php';
    $mysql=new connection();

    $rows=count($mysql->db->query("select url from video")->fetchAll());
    $url='page.php?';
    $div='"main"';
    $limit=5;


    if(isset($_GET['category'])&&(!isset($_GET['country']))){
        $query='select video.url from video inner join videoCat on video.url=videoCat.url
            where category="'.$_GET['category'].'" group by postDate desc limit ';
        $rows=count($mysql->db->query("select video.url from video inner join videoCat
                on video.url=videoCat.url where category='{$_GET['category']}'")->fetchAll());
        $url='page.php?category='.$_GET['category'].'&';
    }

    if(isset($_GET['category'])&&isset($_GET['country'])){
        $query='select video.url from video inner join videoCat on video.url=videoCat.url
            where category="'.$_GET['category'].'" and country="'.$_GET['country'].'"group by postDate desc limit ';
        $rows=count($mysql->db->query("select video.url from video inner join videoCat
                on video.url=videoCat.url where category='{$_GET['category']}' and country='{$_GET['country']}'")->fetchAll());
        $url='page.php?category='.$_GET['category'].'&country='.$_GET['category'].'&';
    }

    $output=$mysql->db->query($query.$_GET['limit'])->fetchAll();
    if(isset($_GET['c'])) echo '<div id="main">';
    echo '<div id="posts">';
    foreach($output as $i => $result){
        preg_match('/[a-zA-Z0-9-_]{11}/',$result['url'],$match);
        echo '<p><object width="95%" height="55%"><param name="movie"
            value="http://www.youtube.com/v/'.$match[0].'?fs=1&amp;hl=en_US&rel=0">
            </param><param name="allowFullScreen" value="true"></param>
            <param name="allowscriptaccess" value="always"></param>
            <embed src="http://www.youtube.com/v/'.$match[0].'?fs=1&amp;hl=en_US&rel=0"
            type="application/x-shockwave-flash" allowscriptaccess="always"
            allowfullscreen="true" width="95%" height="55%"></embed></object></p><br/>';
    }
    echo '</div>';

    echo '<div id="pages">';
    for($i=0;$i<=(int)($rows/$limit);$i++){
        if($i==(int)($rows/$limit)&&($rows%$limit==0))
            break;
        $_limit=$limit*$i.','.$limit;
        $_url='"'.$url.'limit='.$_limit.'"';
        echo "<a href='javascript:ajax.query({$_url},{$div})'>".($i+1)." </a>";
    }
    echo '<br/><br/></div></div>';
    if(isset($_GET['c'])) echo '</div>';

    if(isset($_GET['c'])) {
        echo '<div id="countries"><ul>';
        $output=$mysql->db->query("select country,count(country) from video inner join videoCat
            on video.url=videoCat.url where category='{$_GET['category']}' and
            country='{$_GET['country']}' group by country asc")->fetchAll();
        foreach($output as $result){
            $_url='"'.$url.'limit='.$limit;
            echo "<li><a href='javascript:ajax.query({$_url},{$div})'>
            {$result['country']}</a>({$result['count(country)']})</li>";
        }
        echo '</ul></div>';
    }
?>

in the end my page looks almost fine ex开发者_JAVA技巧cept that <div id='countries'> is missing. here is the link to the page many thanks


You look for a variable c

if(isset($_GET['c']))

which isn't provided, the variable is called 'country' (reported by firebug's network-tab)

http://lookaroundyou.net/page.php?limit=1&country=croatia
http://lookaroundyou.net/page.php?limit=1&c=croatia

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜