html5 - How do I set up navigation using CFINCLUDE with subfolders? -


i want set page navigation links in coldfusion , cfinclude pull navigation in on each individual page. if keep pages in root folder navigation works fine, want organize pages in sub folders. when link to:

<a href="pages/page2.cfm">page 2</a>  

i go page 2 when trying to:

<a href="page1.cfm">page 1</a>  

i following error: file not found: navigationtest/pages/page1.cfm.

i know need use ../ , if put navigation on each individual page works subfolders, want 1 page navigation , include on other pages.

how can set navigation works subfolders in coldfusion?

this file structure:

enter image description here

this include page:

enter image description here

this page code (same on pages except in body it's respective page name (i.e. - default, page1, page2):

enter image description here

if have global layout file, file starts <html> tags, add <base href="{domain}" > tag , anchor (<a>) tags use root links, images, etc.

alternately, can change of link, image, etc. href values start leading slash. tells browser start @ root of website , there.

so instead of

<a href="page1.cfm">page 1</a>  

use

<a href="/page1.cfm">page 1</a> 

then if you're in 3rd level folder, link page1.cfm root of website instead of relative current folder, what's happening now.

personally, use framework coldbox or fw/1, urls driven root , layouts can handled without cfincludes on place.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -