Loading a css file to Magento - html

So I basically got my own whole css layout and I want to change the layout of my magento frontend. I've looked into this post: How to apply CSS to Magento CMS Page but it's not loading my css in. I did this:
I added to Custom Layout Update XML:
<reference name="head">
<action method="addCss"><stylesheet>csstest/style.css</stylesheet></action>
</reference>
and in my html editor I got this:
<div class="header"> </div>
<div class="header_2"> </div>
Css just in case:
.header{
width:80%;
margin-left:10%;
height:15%;
/*border-radius:12px; */
background-color:white;
}
.header_2{
width:80%;
margin-left:10%;
height:5%;
background-color:grey;
font-size:200%;
}
My style.css is in this directory:/skin/frontend/default/csstest/ I also tried to put it in: skin/frontend/default/default/css/
Am I forgetting something?

Why not use a simple way to add your CSS styles?
Add it to head.phtml
<link rel="stylesheet" type="text/css" href="<?php echo $this->getSkinUrl('csstest/style.css') ?>">
Or add it to your local.xml
<?xml version="1.0">
<layout>
<default>
<reference name="head">
<action method="addItem"><type>skin_css</type><file>csstest/style.css</file></action>
</reference>
</default>
</layout>
Don't forget to check your styles in right folder.

you can also try
put your csstest/style.css in css folder
<action method="addItem"><type>skin_css</type><file>css/csstest/style.css/file></action>

This did the trick for me:
<reference name="head">
<action method="addCss">
<stylesheet>../csstest/css/style.css</stylesheet>
<params>media="screen"</params></action>
</reference>
In Custom Layout Update XML

Related

Magento block and layout confusion

I'm new in Magento. Now im trying to understand how blocks and layouts working. Here is my layout file `
<layout>
<custom_index_getallfaq>
<reference name="head">
<action method="setTitle">
<arg>All FAQ's</arg>
</action>
</reference>
<reference name="content">
<block type="custom/type" name="root" template="view.phtml" />
</reference>
</custom_index_getallfaq>
<custom_index_addnewfaq>
<reference name="head">
<action method="setTitle">
<arg>All FAQ's</arg>
</action>
</reference>
<reference name="content">
<block type="custom/type" name="root" template="form.phtml" />
</reference>
</custom_index_addnewfaq>
</layout>`
First handler working properly. It displaying template view.phtml
The problem is second handler working unexpected for me. It displaying index page of my site instead of form.phtml
Thank you for help

Relative paths not working as expected when using URL Rewrites

I'm doing a URL rewrite to a localhost site:
<rule name="test" enabled="true" stopProcessing="true">
<match url="demo/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://localhost:7777/{R:1}" logRewrittenUrl="true" />
</rule>
Let's say the folder structure in localhost:7777 is:
/app/something/demo.css
and
/app/index.html
And the call made in the main site is:
http://www.domain.com/afolder/anotherfolder/demo/app/index.html
When I do a simple reference to a css file from index.html which sits in the localhost:7777 website like this:
<link rel="stylesheet" type="text/css" href="/app/something/demo.css">
I would expect the path to be: http://www.domain.com/afolder/anotherfolder/demo/app/something/demo.css.
But instead the path becomes:
http://www.domain.com/app/something/demo.css
Even if I try href="../demo.css" I would expect to see:
http://www.domain.com/afolder/anotherfolder/demo/app/demo.css
But no... I get: http://www.domain.com/afolder/demo.css
Why :( ?????

How can i remove popular tags just for product page?Magento

I have this page:
link
At the bottom of the page is a section with Popular Tags.I want to remove this section xml code.
Where it is located?
Which is the name of the file and what section i should to remove?
Thanks in advance!
you can simply add in your local xml to remove tag block
<catalog_product_view>
<reference name="product.info.additional">
<action method="unsetChild"><name>product_tag_list</name></action>
</reference>
<reference name="left">
<remove name="tags_popular" />
</reference>
</catalog_product_view>

How rewrite Mage_Catalog_Block_Product_Price for handle catalog_product_view?

How to rewrite Mage_Catalog_Block_Product_Price only for handle catalog_product_view? This block haven't specific name in Layout.
<catalog_product_view>
<reference name="???">
<block type="test/price" name="test.price />
</reference>
</catalog_product_view>
Since in magento the product type is defining the block that is used to render the price, it is a little bit tricky. Maybe this can work:
go to your favorite layout xml file and add this
<catalog_product_view>
<reference name="catalog_product_price_template">
<action method="addPriceBlockType"><type>simple</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>virtual</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>grouped</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>downloadable</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>configurable</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>bundle</type><block>yourmodule/bundle_catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
</reference>
</catalog_product_view>
iam not 100% sure that this will work but its maybe a start for you

Adding custom CSS to Magento Homepage

I'm trying to add a css file to my CMS homepage by going to CMS > Pages > Home > Design then updating the Layout XML however it keeps adding in /base to the url to show the following:
<reference name="head">
<action method="addJs">
<script>nivo-slider/jquery.nivo.slider.js</script>
</action>
<action method="addCss">
<script>../bootstrap/theme_name/css/nivo-slider.css
</script></action>
</reference>
which outputs the following in view source:
<link rel="stylesheet" type="text/css" href="/skin/frontend/base/default/bootstrap/theme_name/css/nivo-slider.css" media="all" />
I've tried ../ and adding in the absolute link however it just adds it after the /base/
Is there a way I can override the theme trying to add in /base/
Assuming theme_name is your active theme, try to replace <action method="addCss">...</action> with this node:
<action method="addItem"><type>skin_css</type><file>css/nivo-slider.css</file></action>
Base folder is loaded due to the magento fallback. It searchs last in base folder, that's why base is added.
try with below code
<?xml version="1.0">
<layout>
<default>
<reference name="head">
<action method="addItem"><type>skin_css</type><file>css/nivo-slider.css</file></action>
</reference>
</default>
</layout>
hope this will sure help you.