Layouts baseURL

Is there a better way of getting the path in my layouts? Most of the examples just path out the assets but that won’t work for ses urls so I am just wondering if there is a better approach.

Catalog Admin Layout

One option is to build that functionality into your request context decorator.

Then in your views, you could do something like
<link rel="stylesheet"
href="#event.getSESBaseURL()#includes/css/blueprint/screen.css"
type="text/css" media="screen, projection">

That way, the logic is encapsulated in in your request context.

- Gabriel

Ahh, makes sense, thank you!

Is this a Module or standard convention?

Modules you can use the getModuleRoot().

Regards,

Andrew Scott

http://www.andyscott.id.au/

Andy…this is a regular layout, I found the getModuleRoot() for the modules!

Thanks

Does the getBaseURL() not work for you?

Regards,

Andrew Scott

http://www.andyscott.id.au/

I will have to try that in a sec…does that get html or ses url?

Andy - I couldn’t find a getBaseURL() there is a htmlBaseURL() and sesBaseURL though so my layout looks like this. Is that others are doing?

<cfif event.isSES()>



STERIS Product Catalog Administrator
Welcome Guest User
#renderView()#

I'd move whatever logic you need to the request context decorator.
Then you can do something like:

<link rel="stylesheet"
href="#event.myGetBaseURLFunction()#includes/css/blueprint/screen.css"
type="text/css" media="screen, projection">

where myGetBaseURLFunction() has whatever logic you need.

- Gabriel

getBaseUrl() is in the interceptors/ses.cfc

Regards,

Andrew Scott

http://www.andyscott.id.au/

Your speaking over my head now Andy :slight_smile:

Lol, I went looking for your original question here. But can’t seem to find it.

Can you remind me what it was you are trying to do again.

Regards,

Andrew Scott

http://www.andyscott.id.au/

This is what I am doing in my layout so that my paths are right for all assets… is there a better way to do this

<cfif event.isSES()>



STERIS Product Catalog Administrator
Welcome Guest User
#renderView()#

I would have thought this would be sufficient

<cfset baseURL = getSetting(‘htmlBaseURL’) />

Regards,

Andrew Scott

http://www.andyscott.id.au/

I was just trying to make it dynamic so you could switch back and forth if need be