Execute PHP code in .html file

PHP
Only way to execute PHP code on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html file [sourcecode language="plain"]AddType application/x-httpd-php .html[/sourcecode] Or for .htm file [sourcecode language="plain"]AddType application/x-httpd-php .htm[/sourcecode] If you only plan on including the PHP on one page, it is better to setup this way: [sourcecode language="plain"] <Files yourpage.html> AddType application/x-httpd-php .html </Files> [/sourcecode] This code will only make the PHP executable on the yourpage.html file, and not on all of your html pages. [JWD-Web-Development]
Read More

How to install magento on local server

Magento
Magento Installation | Magento Installation Process | Magento Installation On Localserver Step 1: Open php.ini file for apache C:/xampp/apache/bin/php.in Find php_curl.dll and remove comment(;) From the following line [sourcecode language="plain"]extension=php_curl.dll[/sourcecode] Same way make changes in C:/xampp/php/php.ini file Restart apache server from xampp control panel Step 2: If database connection error occurs "InnoDB Engine" Open file xampp\mysql\bin\my.cnf (Drag and Drop that file to Notepad or notepad++ program) Find code: [sourcecode language="plain"] # Comment the following if you are using InnoDB tables skip-innodb #innodb_data_home_dir = "/xampplite/mysql/" #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = "/xampplite/mysql/" #innodb_log_arch_dir = "/xampplite/mysql/" ## You can set .._buffer_pool_size up to 50 - 80 % ## of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M ## Set .._log_file_size to 25 % of buffer pool…
Read More

Check youtube video is still valid

PHP
Check youtube video is still valid using youtube's API Manytimes youtube user can decide to delete their video. So I would like to periodically run a script to check that the youtube video is still valid or not. Also, you can fine best video review apps for shopify and make better your Shopify theme. Suppose your Youtube url is : http://www.youtube.com/v/jc0rnCBCX2c So here your Youtube video Id is jc0rnCBCX2c $vid [video Id] posible format/sintax: 1. http://www.youtube.com/watch?v=[ID]&feature=…&… 2. http://www.youtube.com/watch?v=[ID] 3. www.youtube.com/watch?v=[ID] 4. youtube.com/watch?v=[ID] 5. http ://www.youtube.com/v/[ID] 6. www.youtube.com/v/[ID] 7. youtube.com/v/[ID] 8. [ID] 9. …. and any valid youtube video url [php]&amp;amp;lt;?php function checkYoutubeId($id) { if (!$data = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$id)) return false; if ($data == "Video not found") return false; return true; } ?&amp;amp;gt; [/php] http://gdata.youtube.com/feeds/api/videos/jc0rnCBCX2c if it does not exist then you…
Read More

How to call static block in magento

Magento
What is static block in magento? Static blocks can be used throughout your theme wherever you want to make small updates to a section of a page. Typical uses would be for promotional banners/callouts in sidebars or for some custom text in the middle of your home page. Static blocks can also be inserted into CMS pages or included in category pages. Creating s static block => Login in into your magento admin panel. => Navigate to CMS->Static blocks => Click Add new block => Give your block title (Title: A descriptive name to identify this block) => Give your block identifier (Identifier: The identifer will allow you to call this block from your template files or using the Magento markup tags. Typically this would be programmer friendly name with…
Read More

Magento Invalid Method Mage Catalog Model Product IsDuplicable

Magento
New version theme is not working in old version. After upgrading magento or when I design theme in magento 1.5.0.1 and use that theme in magento 1.4.2 that time my product page shows error like Invalid method Mage_Catalog_Model_Product::isDuplicable I find the solutin and its work for me. Copy your product.php file from this path: app\code\core\Mage\Catalog\Model\product.php and replace in your maegnto folder. [JWD-Magento-Development]
Read More

How to get Current page url in magento.

Magento
Get Current page url in magento or you can find catalog url using below code. With the help of this code you can easily find current page url in magento [php] <?php $current_page = ''; /* * Check to see if its a CMS page * if it is then get the page identifier */ if(Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms'): $current_page = Mage::getSingleton('cms/page')->getIdentifier(); endif; /* * If its not CMS page, then just get the route name */ if(empty($current_page)): $current_page = Mage::app()->getFrontController()->getRequest()->getRouteName(); endif; /* * What if its a catalog page? * Then we can get the category path :) */ /* * Or you can check all values * $current_page_array = Mage::registry('current_category'); * $current_page_array['url_path'] */ if($current_page == 'catalog'): $current_page = 'path-' . preg_replace('#[^a-z0-9]+#', '-', strtolower(Mage::registry('current_category')->getUrlPath())); endif; ?> [/php] Also if you…
Read More

Check home page URL in magento

Magento
Check current page is home page in magento If you want to check current page is home page or not in magneto below code is helpful to you. [php] <?php if( Mage::getSingleton('cms/page')->getIdentifier() == 'home' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms' ) : ?> [/php] The other way you can check current page is home page or not in magento [php] <?php if($this->getUrl('') == $this->getUrl('*/*/*', array('_current'=>true, '_use_rewrite'=>true))): echo "Homepage"; else: echo "Not in Homepage"; endif; ?> [/php] [JWD-Magento-Development]
Read More

Call to undefined method Mage_Adminhtml_Block_Widget::getrowurl

Magento
If you install new magento or upgrade your magento with latest version or you got the error like below: Fatal error: Call to undefined method Mage_Adminhtml_Block_Widget::getrowurl() in C:\xampp\htdocs\magento\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php on line 1622 Read this for the solution that workes for me: Go To app/code/core/Mage/Adminhtml/Block/Widget/Grid.php Look at on line no 1620 on magento 1.5.01 public function getRowUrl($item) { $res = parent::getRowUrl($item); return ($res ? $res : '#'); } And replace this line $res = parent::getRowUrl($item); to $res = parent::getUrl($item); So your new function look like this: public function getRowUrl($item) { $res = parent::getUrl($item); return ($res ? $res : '#'); } [JWD-Magento-Development]
Read More

How to Use PHP to Obtain Stock Quotes from Yahoo Finance

PHP
Yahoo! Finance is a very useful resource for both analysts and programmers alike. A PHP library is created by saving the function into a text file - in this example the library is going to be called yahoo_finance.php and this will contain a single function: [php] <?php function show_stock_quotes ($stock_list) { //The function will, by default, return the details of some of the stock markets: if (! $stock_list) { $stock_list = "^IXIC,^DJA,^NIN,^FTSE"; } //The function will then use either an input list or the default list to create the correct url: $url = "http://quote.yahoo.com/d/quotes.csv?s=". $stock_list . "&f=nl1c1&e=.csv"; //and then read in the data stream from the Yahoo! Finance web site: $filesize = 2000; $handle = fopen($url, "r"); $raw_quote_data = fread($handle, $filesize); fclose($handle); //The data will be in the format: "BSE-100",4.37,0.47…
Read More