静态 HTML 到 PHP 导航
Static HTML to PHP Navigation
我希望动态更改静态 html 站点的导航。我想检测我所在的页面并相应地调整导航,因为某些页面位于文件夹中并导致导航在链接回以前的页面时中断。如果我需要重建导航,我可以接受。只是不确定如何处理 php.
中的嵌套文件夹导航
我有一个导航结构像这样的站点
index.php
sample-page.php
Resources(folder) > resource-1.php, resource-2.php, resource-3.php
Contact(folder) > contact-1.php, contact-2.php
我可以从 index.php 转到 Resources/resources-1。php 很好,但是如果我单击资源 - 2.php 我会转到资源 /Resources/resources-1。php.
如果我在 Resources/resources-1.php 到 index.php 我会转到 Resources/index.php 而不是根。
不确定如何更改。我已经打破了导航所以它是
由 <?php include ("navigation.php"); ?>
<?php set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); ?>
插入
谢谢!
p.s。抱歉格式不佳,潜伏时间长,第一次张贴。还没想明白
请务必包含正斜杠以避免不需要的相对路径。假设 / 是你的基础:
<a href="/index.php">Index</a>
<a href="/sample-page.php">Sample Page</a>
<a href="/Resources/resource-1.php">Resources 1</a>
<a href="/Resources/resource-2.php">Resources 2</a>
<a href="/Resources/resource-3.php">Resources 3</a>
<a href="/Contact/contact-1.php">Contact 1</a>
<a href="/Contact/contact-2.php">Contact 2</a>
试一试,希望对您有所帮助!
我希望动态更改静态 html 站点的导航。我想检测我所在的页面并相应地调整导航,因为某些页面位于文件夹中并导致导航在链接回以前的页面时中断。如果我需要重建导航,我可以接受。只是不确定如何处理 php.
中的嵌套文件夹导航我有一个导航结构像这样的站点
index.php
sample-page.php
Resources(folder) > resource-1.php, resource-2.php, resource-3.php
Contact(folder) > contact-1.php, contact-2.php
我可以从 index.php 转到 Resources/resources-1。php 很好,但是如果我单击资源 - 2.php 我会转到资源 /Resources/resources-1。php.
如果我在 Resources/resources-1.php 到 index.php 我会转到 Resources/index.php 而不是根。
不确定如何更改。我已经打破了导航所以它是
由 <?php include ("navigation.php"); ?>
<?php set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); ?>
谢谢!
p.s。抱歉格式不佳,潜伏时间长,第一次张贴。还没想明白
请务必包含正斜杠以避免不需要的相对路径。假设 / 是你的基础:
<a href="/index.php">Index</a>
<a href="/sample-page.php">Sample Page</a>
<a href="/Resources/resource-1.php">Resources 1</a>
<a href="/Resources/resource-2.php">Resources 2</a>
<a href="/Resources/resource-3.php">Resources 3</a>
<a href="/Contact/contact-1.php">Contact 1</a>
<a href="/Contact/contact-2.php">Contact 2</a>
试一试,希望对您有所帮助!