example.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. template name: 案例展示
  4. description: template for yusi123.com Yusi theme
  5. */
  6. $pid = isset( $_GET['pid'] ) ? trim(htmlspecialchars($_GET['pid'], ENT_QUOTES)) : '';
  7. if( !$pid ) die('No param pid');
  8. $title = get_the_title($pid);
  9. $values = get_post_custom_values('d_example',$pid);
  10. empty($values) ? Header('Location:/') : $theCode = $values[0];
  11. ?>
  12. <!DOCTYPE HTML>
  13. <html>
  14. <head>
  15. <meta charset="UTF-8" />
  16. <title>实例: <?php echo $title ?> -- <?php echo bloginfo('name'); ?></title>
  17. <style>
  18. @charset "utf-8";
  19. body,h1,h2,h3,h4,p,ul,li,ol,dl,dt,dd,input,textarea,figure,form{margin:0;padding:0}
  20. body,input,textarea{font-size:12px;font-family:microsoft yahei}
  21. body{text-align:center;color:#33383D;background:#eee}
  22. ul,ol{list-style:none}
  23. img{border:0}
  24. button,input {line-height:normal;*overflow:visible}
  25. input,textarea{outline:none}
  26. a{color:#428BD1;text-decoration:none}
  27. a:hover{color:#3071A9}
  28. .demo-header{position:relative;height:32px;background-color:#4A4A4A;line-height:32px;text-align: left;}
  29. .demo-name{background-color: #428BCA;color: #fff;display: inline-block;padding: 0 20px;}
  30. .demo-name:hover{color: #fff;}
  31. .demo-title{height:0;overflow:hidden}
  32. .demo-container{clear: both;padding:30px 20px;text-align:left;margin:0 auto;line-height: 18px;}
  33. .demo h2{font-size: 15px;padding-bottom: 6px;margin-bottom: 20px;border-bottom: solid 1px #ddd;}
  34. </style>
  35. </head>
  36. <body>
  37. <h1 class="demo-title">实例: <?php echo $title ?> -- <?php echo bloginfo('name'); ?></h1>
  38. <div class="demo-header">
  39. <a class="demo-name" href="<?php echo get_permalink($pid); ?>">&laquo; <?php echo $title ?></a>
  40. <span style="display:none"><?php if( dopt('d_track_b') != '' ) echo dopt('d_track'); ?></span>
  41. </div>
  42. <div class="demo-container demo"><?php echo $theCode; ?></div>
  43. <div style="display:none"><?php if( dopt('d_track_b') ) echo dopt('d_track'); ?></div>
  44. </body>
  45. </html>