Bootstrap手机网站开发案例

一、总结

一句话总结:Bootstrap手机网站开发注意事项(3点):a、引入viewpoint声明,b、通过屏幕宽动态控制元素显隐 c、图片添加自适应

1、Bootstrap手机网站开发注意事项(3点)?

a、引入手机声明

11     <meta name="viewport" content="width=device-width, initial-scale=1.0">

b、通过屏幕宽动态控制元素显隐

135 <script>
136 w=$(window).width();
137
138 if(w<700){
139 $('.bottom-right').hide();
140 $('.navbar-left').css({'text-align':'center'});
141 }
142
143 $('.panel-body img').addClass('img-responsive');
144 </script>

c、图片添加自适应

143 $('.panel-body img').addClass('img-responsive');

2、页面引用原生数据库操作方法及位置?

php放开头

  1 <?php
2 include 'public/common/config.php';
3 $sql="select * from message";
4 $rst=mysql_query($sql);
5
6 ?>
7 <!doctype html>

3、应用框架内元素方法,比如bootstrap中的幻灯片?

引模块加指定id进行样式微调

 21         .navbar-brand{
22 padding:0px;
23 }

4、模型中foreach循环拆开写?

 98         <?php
99 while($row=mysql_fetch_assoc($rst)){
100 ?>
119         <?php
120 }
121 ?>

5、网站到数据库内容转实体方法?

110                 <?php echo htmlspecialchars_decode($row[content]) ?>    

6、除uedit外另一个富文本编辑器?

kd,kindeditor,用法和ueditor很像,引文件加js

 16     <script src="public/kd/kindeditor-min.js"></script>
122 var editor;
123 KindEditor.ready(function(K) {
124 editor = K.create('#txt', {
125 resizeType : 1,
126 allowPreviewEmoticons : false,
127 allowImageUpload : false,
128 items : [
129 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
130 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
131 'insertunorderedlist', '|', 'emoticons', 'image', 'link']
132 });
133 });

7、通过header跳转方法?

12     header('location:index.php');

二、Bootstrap手机网站开发案例

1、index.php

 <?php
include 'public/common/config.php';
$sql="select * from message";
$rst=mysql_query($sql); ?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
11 <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>动漫乐园</title>
<link rel="stylesheet" href="public/bs/css/bootstrap.min.css">
<script src="public/js/jquery.js"></script>
<script src="public/bs/js/bootstrap.min.js"></script>
<style>
*{
font-family: 微软雅黑;
font-size:16px;
}
21 .navbar-brand{
padding:0px;
} .page{
padding-top:60px;
} .navbar2{
padding-right:15px;
} .panel-primary{
margin-top:15px;
margin-bottom:15px;
}
</style>
</head>
<body>
<div class="container page">
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">
<img src="public/images/logo.png" alt="">
</a>
</div> <!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="add.php">发布动漫</a></li>
</ul>
</div>
</div> </nav> <!-- 幻灯片 -->
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol> <!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="public/images/a.jpg" alt="...">
</div>
<div class="item">
<img src="public/images/b.jpg" alt="...">
</div>
<div class="item">
<img src="public/images/c.jpg" alt="...">
</div>
</div> <!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div> <!-- 内容部分 -->
98 <?php
while($row=mysql_fetch_assoc($rst)){
?> <div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-title">
<img src="public/images/head.jpg" alt="">
<span><?php echo $row[title]?></span>
</div>
</div>
<div class="panel-body">
<?php echo htmlspecialchars_decode($row[content]) ?>
</div> <div class="panel-footer">
<span><span class='label label-primary'>发布者:</span> user1</span>
<span style='margin-left:10px;'><span class='label label-danger'>发布时间:</span> 2015.10.27</span>
</div>
</div> 119 <?php
}
?> <!-- 底部导航条 -->
<nav class="navbar navbar-inverse navbar2" role="navigation">
<ul class="nav navbar-nav navbar-left">
<li><a href="#">www.lampym.com</a></li>
</ul>
<ul class="nav navbar-nav navbar-right bottom-right">
<li><a href="#">云知梦,只为有梦想的人!</a></li>
</ul>
</nav>
</div>
</body>
<script>
w=$(window).width(); if(w<){
$('.bottom-right').hide();
$('.navbar-left').css({'text-align':'center'});
} $('.panel-body img').addClass('img-responsive');
</script>
</html>

2、add.php

 <?php
include 'public/common/config.php';
$sql="select * from message";
$rst=mysql_query($sql); ?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>index</title>
<link rel="stylesheet" href="public/bs/css/bootstrap.min.css">
<script src="public/js/jquery.js"></script>
<script src="public/bs/js/bootstrap.min.js"></script>
<script src="public/kd/kindeditor-min.js"></script>
<style>
*{
font-family: 微软雅黑;
font-size:16px;
}
.navbar-brand{
padding:0px;
} .page{
padding-top:60px;
} .navbar2{
padding-right:15px;
} .panel-primary{
margin-top:15px;
margin-bottom:15px;
} .ke-container{
width:100%!important;
}
</style>
</head>
<body>
<div class="container page">
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">
<img src="public/images/logo.png" alt="">
</a>
</div> <!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="add.php">发布动漫</a></li>
</ul>
</div>
</div> </nav> <div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-title">
<img src="public/images/head.jpg" alt="">
<span>发布动漫</span>
</div>
</div>
<div class="panel-body">
<form action="insert.php" method='post'>
<div class="form-group">
<label for="">发布者:</label>
<input type="text" class='form-control' name='username'>
</div> <div class="form-group">
<label for="">动漫名称:</label>
<input type="text" class='form-control' name='title'>
</div> <div class="form-group">
<label for="">动漫简介:</label>
<textarea name="content" id="txt" cols="30" rows="10" class='form-control'></textarea>
</div> <div class="form-group">
<input type="submit" value="Ok" class='btn btn-primary'>
<input type="reset" value="Cancel" class='btn btn-danger'>
</div>
</form>
</div>
</div> <nav class="navbar navbar-inverse navbar2" role="navigation">
<ul class="nav navbar-nav navbar-left">
<li><a href="#">www.lampym.com</a></li>
</ul>
<ul class="nav navbar-nav navbar-right bottom-right">
<li><a href="#">云知梦,只为有梦想的人!</a></li>
</ul>
</nav>
</div>
</body>
<script>
w=$(window).width(); if(w<700){
$('.bottom-right').hide();
$('.navbar-left').css({'text-align':'center'});
} $('.panel-body img').addClass('img-responsive'); var editor;
KindEditor.ready(function(K) {
editor = K.create('#txt', {
resizeType : ,
allowPreviewEmoticons : false,
allowImageUpload : false,
items : [
'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
'insertunorderedlist', '|', 'emoticons', 'image', 'link']
});
}); </script>
</html>

3、insert.php

 <?php
include 'public/common/config.php'; $username=$_POST['username'];
$title=$_POST['title'];
$content=htmlspecialchars(addslashes($_POST['content']));
$time=time(); $sql="insert into message(username,title,content,time) values('{$username}','{$title}','{$content}','{$time}')"; if(mysql_query($sql)){
header('location:index.php');
}; ?>
 
 
 
 
 
 

Bootstrap手机网站开发案例的更多相关文章

  1. JM-1 手机网站开发测试环境搭建

    JM-1 手机网站开发测试环境搭建 一.总结 一句话总结:WEB服务器环境可实现局域网内轻松访问.360wifi可以实现局域网. 二.微网站开发环境: 1.把微网站放到本机wamp环境下,用pc浏览器 ...

  2. HTML5移动端手机网站开发流程

    基本上开发手机网站,可大致分为两大类.一类是用框架开发手机网站.一类是自己手写手机网站. 一.框架开发手机网站 一般用现在常用的开发框架有:目前Web前端最火的框架(BootStrap).jQuery ...

  3. WEBAPP开发技巧(手机网站开发注意事项)

    以下只是我个人得总结,如果你有更好的建议,请留言,一起共勉进步!!- -! 1.要响应式开发web,也就是页面必须自适应屏幕大小,可以采用流体布局,如之前的文章(自适应宽度布局),其他具体的小问题可以 ...

  4. 手机移动端网站开发流程HTML5

    手机移动端网站开发流程HTML5 最近一直在研究移动手机网站的开发,发现做手机网站没有想象中的那么难.为什么会这么说呢?我们试想下:我们连传统的PC网站都会做,难道连一个小小的手机网站难道都搞不定吗? ...

  5. 零基础C#网站开发实战教学(全套)最新更新2019-12-16。。。

    这是林枫山自己编写制作的全套Visual Studio 2013 C# 网站开发案例实战教学教程,欢迎下载学习. 下载目录链接如下(如果链接下载不了,请加QQ:714259796获取教程): 网站界面 ...

  6. 软件工程概论 网站开发要掌握的技术 &登录界面

    1.网站系统开发需要掌握的技术 一.界面和用户体验(Interface and User Experience) 1.1 知道如何在基本不影响用户使用的情况下升级网站.通常来说,你必须有版本控制系统( ...

  7. 手机版WEB开发经验分享,手机版网站开发注意事项,网站自适应,手机版网站自适应,移动安卓APP自适应

    转自 http://my.oschina.net/cart/blog/282477 做前端开发不短了,用过jQuery Mobile jqMobi 也纯手工写过.. 最后总结如下: jQuery Mo ...

  8. jQuery Mobile手机网站案例

    jQuery Mobile手机网站案例 一.总结 一句话总结:jQuery Mobile是纯手机框架,和amazeui和bootstrap都可以做手机网站. 1.另一款文本编辑器? jd编辑器 二.j ...

  9. 移动平台3G手机网站前端开发布局技巧

    本文转载至:移动平台3G手机网站前端开发布局技巧汇总 - 前端开发-武方博 您或许正在或准备参与一个WepApp项目,您或许正在Google搜索mobile development相 关的文章,您或许 ...

随机推荐

  1. wechat4j框架具体解释

    发送消息: 基于上面access_token的逻辑,在构造发送消息对象的时候请依照例如以下代码. wechat4j和微信强力推荐的方法 CustomerMsg customerMsg = new Cu ...

  2. 1.2 Use Cases中 Commit Log官网剖析(博主推荐)

    不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Commit Log 提交日志 Kafka can serve as a kind ...

  3. angular设置全局变量,可修改监听变量

    创建service.module.ts import { NgModule, ModuleWithProviders } from '@angular/core'; import { SomeShar ...

  4. spring与cxf整合配置webservice接口(以jaxws:server的方式配置)

    ps:最近项目需要跟其他系统做同步,需要使用webservice来提供接口给其他系统调用:临时抱佛脚赶紧去网上找了下资料,发现用Endpoint的方式发布接口好容易哦:赶紧写了个例子做验证,发布成功. ...

  5. opencv cvPreCornerDetect

    关于OpenCv中cvPreCornerDetect 运行出错解决方法 http://m.blog.csdn.net/blog/wode0239 由于书本上示例的不全,相信大家在做的时候,肯定是无从下 ...

  6. ajax缓存 header头文件

    浏览器第一次访问服务器的时候,需要从服务器加载很多静态资源,并将这些资源文件缓存在浏览器中,当再次访问页面的时候,如果有相同资源文件就直接到缓存中去加载,这样就会降低服务器的负载和带宽,加快用户访问, ...

  7. amazeui学习笔记--css(基本样式2)--基础设置Base

    amazeui学习笔记--css(基本样式2)--基础设置Base 一.总结 1.盒子模型:外margin,内padding,这里的内外指的边框 2.border-box:Amaze UI 将所有元素 ...

  8. 标准模板库 STL 使用之 —— vector 使用 tricks

    1. 从已有 vector(或数组)中复制 vector<int> a{....}; int an = a.size(); int half = an/2; vector<int&g ...

  9. Android自己定义View画图实现拖影动画

    前几天在"Android画图之渐隐动画"一文中通过画线实现了渐隐动画,但里面有个问题,画笔较粗(大于1)时线段之间会有裂隙.我又改进了一下.这次效果好多了. 先看效果吧: 然后我们 ...

  10. js循环函数中的匿名函数和闭包问题(匿名函数要用循环中变量的问题)

    js循环函数中的匿名函数和闭包问题(匿名函数要用循环中变量的问题) 一.总结 需要好好看下面代码 本质是因为匿名函数用到了循环中的变量,而普通方式访问的话,匿名函数的访问在循环之后,所以得到的i是循环 ...