Jump to content

how to use external CSS in smarty templates


Recommended Posts

Hi,

  I am using smarty templtes for view part in my PHP project. Thing is, if i embed CSS code in smarty templates it is working fine. But if i add an external CSS file in smarty templates, then it is not working. If any one having idea on why it is behaving like that, pls help me.

 

-SunilKumar

<literal>

<style type="text/css">

  ...........

  ...........

</style>

<script language="javascript"></script>

</literal>

 

 

 

literal

Literal tags allow a block of data to be taken literally. This is typically used around javascript or stylesheet blocks where curly braces would interfere with the template delimiter syntax. Anything within {literal}{/literal} tags is not interpreted, but displayed as-is. If you need template tags embedded in your literal block, consider using {ldelim}{rdelim} to escape the individual delimiters instead.

 

Example 7-13. literal tags

 

{literal}

<script type="text/javascript">

 

        <!--

                function isblank(field) {

                if (field.value == '')

                        { return false; }

                else

                        {

                        document.loginform.submit();

                        return true;

                        }

                }

        // -->

 

</script>

{/literal}

 

 

 

Thanks for response.  But when i add the CSS code in the template file itself it is working

Ex: {literal}

<script type="text/javascript" src="js/bsn.Ajax.js"></script>

<script type="text/javascript" src="js/bsn.DOM.js"></script>

<script type="text/javascript" src="js/bsn.AutoSuggest.js"></script>

<style type="text/css">

body {

font-family: Lucida Grande, Arial, sans-serif;

font-size: 10px;

text-align: center;

margin: 0;

padding: 0px;

}

table

{

font-size: 10px;

}

tr

{

vertical-align: top;

}

th

{

 

background-color: #005988;

color: #fff;

}

th,

td

{

padding: 1px;

font-family: Trebuchet MS;

font-size: 1.2em;

}

td

{

background-color: ;

}

</style>

{/literal}

 

 

But when i write a separate CSS file and include that CSS file in template file, like

Ex:

{literal}

<link rel="stylesheet" type="text/css" href="test.css" />

{/literal}

 

This is not workig... any idea????

 

 

Thanks

SunilKumar V

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.