magicsuggest
Version:
MagicSuggest is a multiple selection auto-suggest input box for Bootstrap 3.
160 lines (140 loc) • 6.47 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="MagicSuggest is a multiple selection combo box built for bootstrap themes">
<meta name="author" content="Nicolas Bize">
<link rel="shortcut icon" href="http://nicolasbize.com/magicsuggest/assets/ico/favicon.ico">
<title>MagicSuggest - Tutorial</title>
<link href="lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/custom.css" rel="stylesheet">
<link href="assets/lib/highlightjs/styles/default.css" rel="stylesheet">
<script type="text/javascript" src="assets/lib/highlightjs/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="lib/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<a id="forkme_banner" href="https://github.com/nicolasbize/magicsuggest">View on GitHub</a>
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="cover-container">
<div class="masthead clearfix">
<div class="inner">
<h3 class="masthead-brand">MagicSuggest</h3>
<ul class="nav masthead-nav">
<li><a href="index.html">Home</a></li>
<li><a href="examples.html">Examples</a></li>
<li><a href="doc.html">Documentation</a></li>
<li class="active"><a href="tutorial.html">Tutorial</a></li>
</ul>
</div>
</div>
</div>
<div class="tutorial">
<div class="container">
<h1>Tutorial Part One</h1>
<p>Setting up the project.</p>
<div class="row">
<div class="col-md-12">
<h3>Project Structure</h3>
<p>You are free to structure your project however you wish. For this tutorial, we will use a simple and clean structure,
with folders <code>css</code>, <code>img</code>, <code>js</code> and <code>lib</code> to hold our resources. Our main
page willl be <code>index.php</code> located at the root of the structure. It will contain a form that will call
<code>subscribe.php</code>:</p>
<img src="tutorial/img/structure.jpg" style="width:169px; height:260px"/>
<h3><code>index.php</code></h3>
<p>The contents are pretty straight forward here</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MagicSuggest Tutorial</title>
<link href="lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div class="container">
<h1>Hello, world!</h1>
<form action="subscribe.php" method="post">
<div class="form-group">
<label>First name</label>
<input class="form-control" name="firstname"/>
</div>
<div class="form-group">
<label>Last name</label>
<input class="form-control" name="lastname"/>
</div>
<input type="submit" class="btn btn-success pull-right" value="Submit"/>
</form>
</div>
<script src="lib/jquery/jquery-1.11.1.min.js"></script>
<script src="lib/bootstrap/js/bootstrap.min.js"></script>
</body>
</html></code></pre>
<h3><code>subscribe.php</code></h3>
<p>Here we'll only display what comes out of the form</p>
<pre><code><?php
$firstname = $_POST['firstname'] || '';
$lastname = $_POST['lastname'] || '';
$data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname']);
?>
<html>
<head>
<title></title>
</head>
<body>
<p>
Hello <?php echo $data['firstname']; ?> <?php echo $data['lastname'] ?>! <br/>
</p>
</body>
</html>
</code></pre>
<h3><code>css/style.css</code></h3>
<p>Now we just give it some style</p>
<pre><code>body{
background: #EEE;
}
.container{
max-width: 500px;
border-radius: 5px;
background: #FFF;
border: 1px solid #CCC;
min-height: 400px;
margin-top: 50px;
}
</code></pre>
<div class="well">
<h4>Wrapping up...</h4>
<a href="tutorial/1.html">View the results</a><br/>
<a href="tutorial/1/1.zip">Download the files for the tutorial</a><br/>
<br/>
<a href="tutorial-2.php.html">Go to part 2</a><br/>
</div>
</div>
</div>
</div>
</div>
<div style="height:200px"></div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-5470193-5']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>