Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
CSS Injection to SP page
jihan
Hi,
We're using TS 7.0 + SP7.0. LSCS is installed during TS installation, but not LSDS.
I want to dynamically inject styles.css from the "country/language" resource folder. When the .page is generated into a HTML file, my code has succesfully injected the css tag at the header section.
My problem now is that is does not inject into the .page during EDIT & PREVIEW mode in TeamSite. May I know why this is happening? How do I inject the css into these 2 modes?
Thank You.
Find more posts tagged with
Comments
vpatel
How are you trying to inject these CSS Styles? You said your "code" works when you "generate". Please provide more details...
jihan
Hi,
I'm injecting this line of code:
" < link media='all' type='text/css' href='/iwov-resources/"+pagesite+"/css/styles.css' rel='stylesheet' > "
I'm getting "pagesite" from RequestContext of the page, which is actually a combination of the sitename and folder name.
Then I use the code below to inject into header:
context.getPageScopeData().put(RuntimePage.PAGESCOPE_HEAD_INJECTION, str);
But I still can't get it on Edit & Preview. Please help.
Thank You
vpatel
My guess is that you have a controller or external that is doing this injection. Is it getting fired off at all in preview mode? Have you tried some simple logging and see if that works in preview? That maybe the first place to start of.
jihan
Hi,
I've tried to print out some context info in the log. When I do an Edit or Preview, the printout does come out.
So I guess during these times my code are being called and it returned the info that I need. But it won't inject the tag.