<?php echo $this->getLayout()->createBlock(‘mymodule/myblock’)->setTemplate(‘mymodule/myblock.phtml’)->toHtml(); ?>
Monthly Archives: August 2012
List all products under a given category on homepage magento
{{block type=”catalog/product_list” name=”home.catalog.product.list” alias=”products_homepage” category_id=”4″ template=”catalog/product/list.phtml”}}
List all products on home page magento
{{block type=”catalog/product_list” name=”home.catalog.product.list” alias=”products_homepage” template=”catalog/product/list.phtml”}}
List new products on home page Magento
{{block type=”catalog/product_new” name=”home.catalog.product.new” alias=”product_homepage” template=”catalog/product/new.phtml”}}
jQuery replace a string
<html>
<head>
<script type=”text/javascript” src=”jquery.js”></script>
</head>
<div id=”divId”>
<iframe src=”http://phpcodez.com” scrolling=”no” frameborder=”0″ style=”border: none; width: 90px; height: 20px; “></iframe>
</div>
<script type=”text/javascript”>
jQuery.noConflict();
jQuery(document).ready(function() {
if(jQuery(“#divId”+” iframe”).attr(‘src’).indexOf(“https”)<=-1) {
var newSrc = jQuery(“#divId”+” iframe”).attr(‘src’).replace(“http”,”https”);
jQuery(“#divId”+” iframe”).attr(‘src’,newSrc);
alert(jQuery(“#divId”+” iframe”).attr(‘src’));
}
});
</script>
</html>
jQuery check if string contains another string
<html>
<head>
<script type=”text/javascript” src=”jquery.js”></script>
</head>
<div id=”divId”>
<iframe src=”http://phpcodez.com” scrolling=”no” frameborder=”0″ style=”border: none; width: 90px; height: 20px; “></iframe>
</div>
<script type=”text/javascript”>
jQuery.noConflict();
jQuery(document).ready(function() {
if(jQuery(“#divId”+” iframe”).attr(‘src’).indexOf(“https”)<=-1) {
alert(“Its not a secure url”);
}
});
</script>
</html>
jQuery check an element exist
<script type=”text/javascript”>
jQuery(document).ready(function() {
if ($(“#divId”).length > 0){
// your code here
}
});
</scrip
jQuery
jQuery is a multi-browser JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig. Used by over 55% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today
jquery conflict
<script type=”text/javascript”>
jQuery.noConflict();
jQuery(document).ready(function() {
// Your code comes here
});
</script>
Include a static block on sidebar
<reference name=”left”>
<block type=”cms/block” name=”blockName” before=”-” >
<action method=”setBlockId”><block_id>block_identifier</block_id></action>
</block>
</reference>