我刚刚开始忙于网络开发,我只有struts2
开发经验,我使用sitemesh
来装饰网页。我对网络开发感到好奇,我想仅使用twitter bootstrap
开始构建网站,但我不确定如何在页面之间保持我的导航栏。
我有点迷失......是否有任何好的做法"在这个问题上?我已经搜索了一段时间,并在这个主题上找不到任何帮助。我应该创建一个HTML
文件" import"它以任何方式存在于我的所有页面上?你通常怎么做?
答案 0 :(得分:1)
只需将您的导航栏div 从//...
#include "Unit2.h"
#include "Unit1.h"
//...
int MSecond = 0, MyTime = 0;
//---------------------------------------------------------------------------
__fastcall TFormTwo::TFormTwo(TComponent* Owner) : TForm(Owner)
{
ProgressBar->Min = 0;
ProgressBar->Max = 100;
ProgressBar->Position = 0;
Timer1->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TFormTwo::FormCreate(TObject *Sender)
{
MyTime = GetTickCount();
MSecond = 0;
Timer1->Enabled = false;
ProgressBar->Position = 0;
}
//---------------------------------------------------------------------------
void __fastcall TFormTwo::Timer1Timer(TObject *Sender)
{
MSecond = GetTickCount( ) - MyTime;
if (MSecond < 30000)
ProgressBar->Position = double Trunc(double(MSecond) / 300);
else
{
ProgressBar->Position = 100;
Timer1->Enabled = false;
}
}
移至另一个文件,例如index.html
,然后将其添加到您删除导航栏的行中:
navbar.php
请务必:
示例:强>
如果这是您当前的代码:
<?php include ('navbar.php'); ?>
然后只需提取导航栏部分并将其移动到navbar.php文件,您的索引文件现在将如下所示:
<body>
<nav role="navigation" class="navbar navbar-default">
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand">Brand</a>
</div>
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Profile</a></li>
<li><a href="#">Messages</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Login</a></li>
</ul>
</div>
</nav>
<!--Rest of your page contents-->
....
</body>