Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[Solved] My template’s css file was modified. How can I modify the html code? 
 
EronarDiaras
Member
 
Total Posts:  37
Joined:  2012-01-27
 

My template’s css file was modified. How can I modify the html code?

<link rel="stylesheet" type="text/css" href="http://xxxx.xx/skin/frontend/default/xxxxxx/css/styles.css" media="all" />
to:
<link rel="stylesheet" type="text/css" href="http://xxxx.xx/skin/frontend/default/xxxxxx/css/styles.css?ver=2" media="all" />
 
Magento Community Magento Community
Magento Community
Magento Community
 
prateekgupta
Guru
 
Avatar
Total Posts:  541
Joined:  2010-06-04
India
 

Go to head.phtml file. You can find that in default/theme/template/page/html/head.phtml .. you will find there all these css and js files smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
EronarDiaras
Member
 
Total Posts:  37
Joined:  2012-01-27
 

My head.phtml file:

<title><?php echo $this->getTitle() ?></title>
<
meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<
meta name="description" content="<?php echo htmlspecialchars(strip_tags($this->getDescription())) ?>" />
<
meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<
meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
<
link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<
link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<!--
[if lt IE 7]>
<
script type="text/javascript">
//<![CDATA[
//    var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
//    var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
//]]>
</script>
<![endif]-->
<?php echo $this->getCssJsHtml() ?>
<?php 
echo $this->getChildHtml() ?>
<?php 
echo $this->helper('core/js')->getTranslatorScript() ?>
<?php 
echo $this->getIncludes() ?>
<?php
    
if(!empty($_GET['utm_medium'])):
        if(
$_GET['utm_medium'== 'affiliate'):
            
$_SESSION['affiliate'true;
        endif;
    endif;
?>
<script src="https://www.dwin1.com/3322.js" type="text/javascript" defer="defer"></script>
 
Magento Community Magento Community
Magento Community
Magento Community
 
EronarDiaras
Member
 
Total Posts:  37
Joined:  2012-01-27
 

Anyone? Please… hmmm

 
Magento Community Magento Community
Magento Community
Magento Community
 
tzyganu
Mentor
 
Avatar
Total Posts:  2205
Joined:  2009-11-18
Bucharest, Romania
 

Hello
I don’t think you can add a ?v=2 for css files in Magento.
I assume you use this to force the server to view this file as a new one, for cache expiry purposes, right?

If I’m right then you can do this differently.
Rename styles.css to styles1.css and in app/design/frontend/{interface}/{theme}/layout/page.xml replace this:

<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
with this:
<action method="addCss"><stylesheet>css/styles1.css</stylesheet></action>

Clear the contents of folder var/cache and you should be ready to go.

Marius.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rich Cleverley
Sr. Member
 
Avatar
Total Posts:  285
Joined:  2009-01-20
 

tzyganu is correct.  You can’t do versioned css or js files out of the box because Magento tries to locate the file name on the file system then falls back to the default theme and so doesn’t load teh file.

You would need to create an extension to be able to achieve this

 
Magento Community Magento Community
Magento Community
Magento Community
 
EronarDiaras
Member
 
Total Posts:  37
Joined:  2012-01-27
 

tzyganu: Thank you! This is what I need!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Rich Cleverley
Sr. Member
 
Avatar
Total Posts:  285
Joined:  2009-01-20
 

The place to look at overriding is methods in Mage_Page_Block_Html_Head (sorry can’t share the code I have as it’s for my employer but ask questions and I’ll try to guide you along to what we did).

 
Magento Community Magento Community
Magento Community
Magento Community
 
tease
Sr. Member
 
Total Posts:  115
Joined:  2010-10-06
 

Sorry for digging up this old thread, but I have a similar problem and hope you can give me a hint how to solve the problem.

I watn to speed up my pageload time and an analyse with GTMetrix brought up that i should inline my print.css file, so there is one less HTTP-Request.

Now I understand that “page.xml” is the file which loads all extern files, right?
So I guess I should inline my css here. But I don’t know how to do it. I tried it with this:

<action method="addItem"><type>skin_css</type><name>css/ie8.css</name><params/><if>IE 8</if></action>
                <
style type="text/css">
[color=red]@media projection{
  
*     { background:none !importanttext-align:left !important}
html  { margin
:!importantpadding:!important}
body  { background
:#fff !important; font-size:9pt !important; padding:0 !important; margin:10px !important; }
a     { color:#2976c9 !important; }
th,td { color:#2f2f2f !important;  border-color:#ccc !important; }

.header-container,
.
nav-container,
.
footer-container,
.
pager,
.
toolbar,
.
actions,
.
buttons-set { display:none !important}

.page-print .data-table .cart-tax-total { background-position:100% -54px}
.page-print .data-table .cart-tax-info { display:block !important}
}
</style>[/color]
                
<action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action>
But that doesn’t seem right, because GTMetrix stil is reporting that the print.css is loaded from external. Which sounds to me like I did it wrong.

Any ideas how to archieve that?

Thanks in advance for spending the time!

 
Magento Community Magento Community
Magento Community
Magento Community
 
rohit28mohan
Jr. Member
 
Total Posts:  2
Joined:  2011-06-15
 

What if I am using magento enterprise, and the css / js compression is on. Any changes in css has to be reflected required user to refresh cache.

Is there any method by which i can change the name of merged CSS so that user\’s can see the changes with a simple refesh.

Regards,
Rohit Mohan

 
Magento Community Magento Community
Magento Community
Magento Community
 
rohit28mohan
Jr. Member
 
Total Posts:  2
Joined:  2011-06-15
 

Also as I am using css merging the merged file css is generated which is a unique . even after deleting it, it takes the same name. If i make some css changes in styles.css the merged css changes but if that files is already in user\\\’s browser cache, without refreshing cache the user simply cant see changes.

Renaming styles.css to any name and making that changes in page.xml will not work as the merged file css will have same name.

My questions are:

1.  Can i change the name of this randomly generated css everytime?
2.  Making a new css and then including it in a head file will create more mess?

Regards,
Rohit

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top