Exemplo n.º 1
0
?>

<?php 
$id = test_input($_GET['av']);
if (strlen($id) == 0 || !is_numeric($id)) {
    header("location:index.php");
} else {
    $im = infoMgr::getInstance();
    $tm = new detailMgr($im);
    $gb = new getBase();
    $url = new urlMgr();
    $urlAvailable = $url->getContextUrl($id);
    $jsonData = $tm->getJSON($gb, $urlAvailable);
    $jsonArray = $tm->getContext(new decodeJSON($jsonData));
    $dataParser = new DataObj($jsonArray, DataObj::BODY);
    $stories = $dataParser->getSingleNew();
    if (!$stories) {
        header("location:index.php");
    } else {
        //print_r($stories);
        //echo $dataParser->getImages();
        $allContents = $dataParser->getBody();
        $newsTitle = $dataParser->getTitle();
        $keyTitle = array("整", "点", "儿", "新", "闻");
        $flag = 0;
        foreach ($keyTitle as $key => $value) {
            if (stripos($newsTitle, $value)) {
                $flag++;
            }
        }
        if (!$flag > 0) {
Exemplo n.º 2
0
		<div class="body-content">

		<?php 
//ini
$im = infoMgr::getInstance();
$tm = new detailMgr($im);
$gb = new getBase();
//print today
$jsonData = $tm->getJSON($gb);
$jsonArray = $tm->getContext(new decodeJSON($jsonData));
//print_r($jsonArray);
$dataParser = new DataObj($jsonArray, DataObj::_LIST);
//echo $dataParser->getDate();
$stories = $dataParser->getStories();
foreach ($stories as $key => $value) {
    $singleNew = $dataParser->getSingleNew($key);
    echo '			<div class="content-main-box">
				<div class="main-box-img">
					<img src="' . $dataParser->getImages() . '" alt="' . $dataParser->getID() . '" />
				</div>
				<div class="main-box-content">
					<div class="main-title">
						<a href="read.php?av=' . $dataParser->getID() . '">' . $dataParser->getTitle() . '</a>
					</div>
					<div class="main-time">' . $dataParser->getDate() . '</div>
				</div>
				<div class="main-box-footer">
					<div class="main-box-postscript">来自:<a href="http://zhihu.com">zhihu.com</a></div>
				</div>
			</div>';
}