Movable Href in Navbar (PHP)

Asked

Viewed 48 times

-1

I have a Nav.php and am giving include on all the pages I need it to navigate my system, however I am having a problem with the directories.

Ex. If the Nav is in the right root and I call via href the pages that are in the root Ok, but if I create a page in a subdirectory and give the Nav include on this page it can no longer reach the pages of the root directory.

Anyone have any suggestions ? I thought I’d try to make href variable depending on the page directory.

Below a piece of Nav:

<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
    <li class="dropdown">
        <a class="dropdown-toggle" class="dropdown-toggle" 
            data-toggle="dropdown" 
            role="button" aria-haspopup="true" aria-expanded="false" 
            href="#">
            Tecnologia <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
            <li><a href="CatalogoSis.php">Catálogo Sistemas</a></li>
            <li><a href="FerramentasInter.php">Ferramentas Internas</a></li>
        </ul>
    </li>
</ul>
</div>

2 answers

0

Apparently it’s enough to use the /, so it will start from the source and not from the current directory.

That is, change this:

<li><a href="CatalogoSis.php">Catálogo Sistemas</a></li>
<li><a href="FerramentasInter.php">Ferramentas Internas</a></li>

That way up, if you’re in site.com/uma/coisa/index.php, click on "Catalog Systems" will take to site.com/uma/coisa/CatalogoSis.php.

For this reason:

<li><a href="/CatalogoSis.php">Catálogo Sistemas</a></li>
<li><a href="/FerramentasInter.php">Ferramentas Internas</a></li>

That way, using the/, if you are in site.com/uma/coisa/index.php, click on "Catalog Systems" will take to site.com/CatalogoSis.php, that is to the file gives root.

  • So I had already tried this but it didn’t work... for now I’m using the absolute address (http://meusever/dirroot/subdir/Catalogosis.php).

  • @Leonardo If the pages are at the root as you specified in the question this answer should work. So I’d say either you tried it that way but you did it in a different way that didn’t work or the pages aren’t really at the root as you put it.

-1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.