Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Load CSS Style sheet from file structure View modes: 
User avatar
Member
Member
Naresh - 11/8/2011 6:19:48 PM
   
Load CSS Style sheet from file structure
Hello,

I need to load CSS style sheets from the project file structure. So, I have tried creating a CSS file in the file structure and referencing it in the master page template in CMSDesk->Content->root->Master page tab.
I placed the reference as follows,
<link type="text/css" rel="stylesheet" href="/CMS/CMSPages/GetCSS.aspx?stylesheetfile=~/CMS/App_Themes/Global.css" />
But, it was not working.

I also tried an article (Referring CSS style sheet managed in Kentico CMS through the direct path) in the Knowledge Base -> Design and CSS styles, but it didn't worked either.

Can any one please tell me how I can load the style sheet from the file structure, but not from CMS site manager.
Kentico Version: V5.5R2

Thank you,

Regards,
Naresh

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/8/2011 11:51:05 PM
   
RE:Load CSS Style sheet from file structure
Hi,

Have you tried to define the direct path as mentioned in the KB? The way you are using the path with GetCSS.aspx script won't work since the script is looking for the stylesheet in the DB.

What happens if you use just the path to your CSS file on the disk in the href parameter?

Best regards,
Juraj Ondrus

User avatar
Member
Member
Naresh - 11/9/2011 6:25:33 PM
   
RE:Load CSS Style sheet from file structure
Hello Juraj Ondrus,

Thank you for the reply.
Yes, I have tried giving the direct path for the CSS style sheet. I have defined the direct file path in the master page template as folllows,
<link href="~/CMS/App_Themes/Global.css" type="text/css" rel="stylesheet" />
But, it is also not loading the CSS.

Also, I have changed the "Site CSS stylesheet" option to none in the CMS Sitemanager->Sites->"Select Site"->General tab. As, I want to load the CSS file from folder structure.

Is their any thing am missing?

Thank you,

Naresh

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/10/2011 1:47:34 AM
   
RE:Load CSS Style sheet from file structure
Hi,

Have you tried using absolute URL to the style sheet file?
When you view the rendered HTML code in FireFox - are you able to click on the stylesheet link, if it is rendered there?

Best regards,
Juraj Ondrus

User avatar
Certified Developer 9
Certified Developer 9
charbf - 11/10/2011 8:41:12 AM
   
RE:Load CSS Style sheet from file structure
Hi,

Try removing the CMS/.

to me it look like a Development path.

User avatar
Member
Member
Naresh - 11/14/2011 3:39:37 PM
   
RE:Load CSS Style sheet from file structure
Hi,

@Juraj Ondrus - I have tried giving the absolute URL to the style sheet file, but it was also not working. Also, I checked the page source of the rendered page, I found that the CSS style sheet is not rendered. I am placing the CSS style sheet link in the <head> section of the master page template.

@Charbf - Thank you for your reply. I tried removing CMS/, but that didn't helped.

When I tried placing the CSS style sheet reference in the <body> section as follows,
"<link href="~/App_Themes/Global.css" type="text/css" rel="stylesheet" />", the style sheet is loading.

Thank you,

Naresh

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/21/2011 1:00:58 AM
   
RE:Load CSS Style sheet from file structure
Hi,

Could you please post some screen shot or exact code you are having in your HEAD section of your master page?

Best regards,
Juraj Ondrus