掲示板
Stylesheets in velocity?
Hi @all,
i thought i have understand the liferay framework but now i have problems with velocity
As i understand the portal_normal.vm file is the overall site structure and generates the html code.
So i changed the variable '$the_title - $company_name' to my companyname.
Works fine after deployment.
Now i want to append a stylessheet
I inserted between <head></head> the following line:
<link href="../_resources/css/business.css" media="screen,projection" type="text/css" rel="stylesheet">
the Stylesheet is in --> /_diffs/_resources/css/
The styles didn't work. When i use fireburg it shows me the following:
Where comes that shit of html code from???
There should be the commentary in the *.css file.
In that *.css file i import with the @import command other *.css files
Please, do you have any ideas what is going wrong? Maybe i can't use stylesheets directly in velocity?
I don't really want to change the top_head.jsp.
What can i do to use my stylesheets?
Thanks,
Best regards,
Hugo
i thought i have understand the liferay framework but now i have problems with velocity
As i understand the portal_normal.vm file is the overall site structure and generates the html code.
So i changed the variable '$the_title - $company_name' to my companyname.
Works fine after deployment.
Now i want to append a stylessheet
I inserted between <head></head> the following line:
<link href="../_resources/css/business.css" media="screen,projection" type="text/css" rel="stylesheet">
the Stylesheet is in --> /_diffs/_resources/css/
The styles didn't work. When i use fireburg it shows me the following:
<link href="../_resources/css/business.css" media="screen,projection" type="text/css" rel="stylesheet">
<title></title>
<meta content="1; url=http://localhost:8080/web/guest" http-equiv="refresh">
<!--
The numbers below are used to fill up space so that this works properly in IE.
See http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807 for more
information on why this is necessary.
2312345678901234567890123456789012345678901234567890123456789012345678901234567890
2412345678901234567890123456789012345678901234567890123456789012345678901234567890
2512345678901234567890123456789012345678901234567890123456789012345678901234567890
26-->
Where comes that shit of html code from???
There should be the commentary in the *.css file.
In that *.css file i import with the @import command other *.css files
Please, do you have any ideas what is going wrong? Maybe i can't use stylesheets directly in velocity?
I don't really want to change the top_head.jsp.
What can i do to use my stylesheets?
Thanks,
Best regards,
Hugo
14年前 に Nikos Kapatos によって更新されました。
RE: Stylesheets in velocity?
Junior Member 投稿: 57 参加年月日: 08/11/12 最新の投稿
The "../_resources/css/business.css" that u use looks in the root of the server and not the root folder of your theme.
Change it by either using the name of your theme "my_theme/css/something.css" or use velocity vars to get the name of the theme and use it in the path as a dynamic snippet for all your projects.
Or just import the css in custom.css file than using it in portal-normal.vm file
As for all this code I have an idea from where it comes from but trust me u don't want to know
P.S. About @import command. When u r in developer mode the @import("something.css"); works ok but if not u should remove quotes or else it will not work @import(something.css);
Change it by either using the name of your theme "my_theme/css/something.css" or use velocity vars to get the name of the theme and use it in the path as a dynamic snippet for all your projects.
Or just import the css in custom.css file than using it in portal-normal.vm file
As for all this code I have an idea from where it comes from but trust me u don't want to know
P.S. About @import command. When u r in developer mode the @import("something.css"); works ok but if not u should remove quotes or else it will not work @import(something.css);
14年前 に Hugo Müller によって更新されました。
RE: Stylesheets in velocity?
Junior Member 投稿: 94 参加年月日: 09/09/25 最新の投稿
Yeah, thanks man. It works
I use the $themeDisplay.getThemeRootPath() .
But how do i now which Java mathods i can use?
i first tried $theme.getThemePath(). But there i got nothing.
Are there some Hints in VelocityVariables.java which Methods from Klasses could be used?
Hehe. Ok ;)
That with @import i don't understand.
I use @import url ('css/mystyle.css');
Is that ok ?
Thanks very much
Hugo
I use the $themeDisplay.getThemeRootPath() .
But how do i now which Java mathods i can use?
i first tried $theme.getThemePath(). But there i got nothing.
Are there some Hints in VelocityVariables.java which Methods from Klasses could be used?
As for all this code I have an idea from where it comes from but trust me u don't want to know emoticon
Hehe. Ok ;)
That with @import i don't understand.
I use @import url ('css/mystyle.css');
Is that ok ?
Thanks very much
Hugo
14年前 に Lisa Simpson によって更新されました。
RE: Stylesheets in velocity?
Liferay Legend 投稿: 2034 参加年月日: 09/03/05 最新の投稿
It should look exactly like this...
@import url(base.css);
@import url(reset.css);
@import url(nav_portlet.css);
@import url(calendar.css);
@import url(base.css);
@import url(reset.css);
@import url(nav_portlet.css);
@import url(calendar.css);
13年前 に Naven Pathange によって更新されました。
RE: Stylesheets in velocity?
New Member 投稿: 11 参加年月日: 09/04/27 最新の投稿
To access a style sheet in portal_normal.vm, set the css path to a velocity variable in init_custom.css.vm
For example:
#set ($samp_css_file = $portalUtil.getStaticResourceURL($request, "$css_folder/samp_file.css"))
Then u can import this in portal_normal.vm as shown below,
#css ($samp_css_file)
inside the head section of portal_normal.vm
For example:
#set ($samp_css_file = $portalUtil.getStaticResourceURL($request, "$css_folder/samp_file.css"))
Then u can import this in portal_normal.vm as shown below,
#css ($samp_css_file)
inside the head section of portal_normal.vm
Naven Pathange:
To access a style sheet in portal_normal.vm, set the css path to a velocity variable in init_custom.css.vm
For example:
#set ($samp_css_file = $portalUtil.getStaticResourceURL($request, "$css_folder/samp_file.css"))
Then u can import this in portal_normal.vm as shown below,
#css ($samp_css_file)
inside the head section of portal_normal.vm
My apologies for dummy question, pretty new to Freemarker syntax. Would it be safe doing in freemarker so?:
<#include ($sample_css_file) />
Or would i need somehow to define that it's a css file? like in velocity that you type that it's a css file.
Forgot to mention that i already found a solution for that in Liferay source code:
VM_liferay.vm
FTL_liferay.ftl
You can find all macros in these files and understand what kind of liferay macros you can use in your template files.
So to answer my question:
Velocity:
Freemarker:
VM_liferay.vm
FTL_liferay.ftl
You can find all macros in these files and understand what kind of liferay macros you can use in your template files.
So to answer my question:
Velocity:
<#include ($sample_css_file) />
Freemarker:
<@liferay.css sample_css_file />