Sry about the typo(s):
cdd = css
lie = OF COURSE line... :)

Christian

On Sep 16, 2009, at 12:12 , Christian Ringele wrote:

Hi Andreas,

This is not necessary to implement it like this. Every class extending RenderingModelImpl has automatically the 'ctx' object available. I think the mistake what you did is that you havent defined the model class for the processed cdd.
You wrote in the mail before:
'Now in order to reference them from the style sheet, I've first changed its
type to "Processed CSS".'
That implies to me that you have switched your css to 'processed css', but have not defined (not seen) the advanced tab of this dialog. We provide a model class for resources which extends the RenderingModelImpl you can use for resources: STKResourceModel If you compare to the default 'styles' node of the stk you can see in the advanced tap this configuration:

----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
<Picture 1.png>


I added this lie at the top to this css:
${ctx.contextPath!TEST_FALSE}

And in the rendered/processed css i get the context path as it should (/skymall):
<Picture 2.png>


I hope this is some help!

Cheers
Christian

On Sep 15, 2009, at 18:52 , weder wrote:



I've found a way by defining my own RenderModel implementation based on the default RenderModelImpl class defined in the STK core module. I've simply
added a method, which calls MgnlContext to obtain what I need.

package //MyPackageName//;

import info.magnolia.cms.core.Content;
import info.magnolia.context.MgnlContext;
import info.magnolia.module.templating.RenderableDefinition;
import info.magnolia.module.templating.RenderingModel;
import info.magnolia.module.templating.RenderingModelImpl;

public class MyRenderingModelImpl extends RenderingModelImpl {

        public MyRenderingModelImpl(Content content,
                        RenderableDefinition definition, RenderingModel parent) 
{
                super(content, definition, parent);
        }
        
        public String getContextPath() {
                return MgnlContext.getContextPath();
        }
}


You then have to instruct your processed CSS to use this model class instead of the default rendering model by. Use the Advanced tab of the dialog opened when you edit the CSS in the Resources section of the Templating Kit menu.

Sounds a bit fishy, since a render model probably should be returning a
value like this. So is there a cleaner way to get the context path?

Thx
Andreas
--
View this message in context: 
http://www.nabble.com/Context-in-Processed-CSS-tp25457092p25457664.html
Sent from the Magnolia - User mailing list archive at Nabble.com.


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to