EasyCFM.COM Forum / Coding Help! / Understanding Base URLs

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Understanding Base URLs

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

srd
07-29-2010 @ 8:23 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 6
Joined: Jan 2009

I've looked around the web and I'm still not sure how to handle base urls in CF.

My simple situation is that I use a single include statement for my head tags and nav bar with relative url like href="assetsis/css/cig_head_foot.css".

But now I have sub-pages and of course they don't find the stuff in the include.

The site uses client vars, no session.

So do I absolute reference all the urls in the include?... put a slash in front?... or can I set a base url (the root) so I can use the same include for any subpages.

Thanks.



MIGhunter
07-29-2010 @ 7:03 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 510
Joined: Apr 2006

http://www.webreference.com/html/tutorial2/3.html

Also, if you put your include in the header, all of your sub pages should read it.  Typically I do my pages like:

<cfinclude template = "variables.cfm">
<cfinclude template = "header.cfm">
...
Main Content
...
<cfinclude template = "Footer.cfm">

This message was edited by MIGhunter on 7-29-10 @ 7:03 PM

srd
07-29-2010 @ 9:26 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 6
Joined: Jan 2009

Ok, we're on different pages... which is a guess why so many views and you're sole reply... which I thank you for.

I understaand html url's but there seems there should be a way to set the base url so you don't have to code the entire abs. path for every href and graphic... quite redundant.

When I lookup examples via google i see discussion about base url's , like here, http://tutorial304.easycfm.com/, but I've no idea what "Simple Application Deployment' so I've no idea if it even applies to me and was asking for a simpler example...

here's another

http://cksource.com/forums/viewtopic.php?f=10&t=11984

taking about basecfc and config.baseDir ...just trying find out if any of that relates to me.

Thanks again.

srd
07-29-2010 @ 9:40 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 6
Joined: Jan 2009

Ok, we're on different pages... which is a guess why so many views and you're sole reply... which I thank you for.

I understaand html url's but there seems there should be a way to set the base url so you don't have to code the entire abs. path for every href and graphic... quite redundant.

When I lookup examples via google i see discussion about base url's , like here, http://tutorial304.easycfm.com/, but I've no idea what "Simple Application Deployment' so I've no idea if it even applies to me and was asking for a simpler example...

here's another

http://cksource.com/forums/viewtopic.php?f=10&t=11984

taking about basecfc and config.baseDir ...just trying find out if any of that relates to me.

Thanks again.

srd
07-29-2010 @ 10:01 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 6
Joined: Jan 2009

Ok, we're on different pages... which is a guess why so many views and you're sole reply... which I thank you for.

I understaand html url's but there seems there should be a way to set the base url so you don't have to code the entire abs. path for every href and graphic... quite redundant.

When I lookup examples via google i see discussion about base url's , like here, http://tutorial304.easycfm.com/, but I've no idea what "Simple Application Deployment' so I've no idea if it even applies to me and was asking for a simpler example...

here's another

http://cksource.com/forums/viewtopic.php?f=10&t=11984

taking about basecfc and config.baseDir ...just trying find out if any of that relates to me.

Thanks again.

MIGhunter
07-30-2010 @ 9:57 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 510
Joined: Apr 2006

you mean something like:
http://www.bennadel.com/blog/597-ColdFusion-Path-Usage-And-Manipulation-Overview.htm

srd
07-31-2010 @ 6:14 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 6
Joined: Jan 2009

That's interesting stuff!... (but not sure how to use it... I'm asking if there are any baseurl functions in CF or is the correct method to just stick an HTML <base href> into the application.cfm?

cfSearchin
07-31-2010 @ 11:50 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 529
Joined: Feb 2008

quote:

http://tutorial304.easycfm.com/


All those examples do is create a variable that contains a "root" or "base" url in the Appliation.cfc/cfm. Then when a full path is needed, they use the variable instead of hard coding it.

<cfoutput>
<a href="#theBaseURLVariable#/assetsis/css/cig_head_foot.css">
</cfoutput>





Copyright © 2002 - 2009. EasyCFM.COM, LLC.
Powered by < CF FORUM > v.2.0
 
Download the EasyCFM.COM Browser Toolbar!