extension path

I have an extension placed under extensions like


extensions

      myextension

         style.css

         script.js

now I want to insert the script and css into the header, and I try to do this for css file:


 <link rel="stylesheet" type="text/css" href="

      <?php echo Yii::getPathOfAlias('ext.myextension') ?>/style.css" />

but the result path is in back slash, which is not I expected.


<link rel="stylesheet" type="text/css"  

      href="C:\xampp\htdocs\myapp\protected\extensions\myextension/style.css" /> 

as you can see, there is a problem with the outputed path. can anybody help me with this, how can I get a output link like


C:/xampp/htdocs/myapp/protected/extensions/myextension/style.css

also I notice this is an absolute path, which is different from other ones which are relative path like


myapp/protected/extensions/myextension/style.css

, how can I get this relative path. thanks a lot.

[font=arial, verdana, tahoma, sans-serif][size=2]Use CAssetManager::publish() in your extension to make css and javascript files accessible from web (files will be copied to webroot/assets directory). Then use CClientScript::registerCssFile() and CClientScript::registerScriptFile() to insert appropriate tags into the <head> element of your html. You can find an example on how to do it in the code of CListView::init().[/size][/font]

looks like a good solution…I will look into this. thanks a lot.