php get filename without extension

If you are looking for how to get filename without extension then there is no need to do any coding or any logic for getting filename without extension simply you can use the php inbuilt function “pathinfo”.This function will return array with file info like extension,Filename without extension,Basename etc.For more info please refer bellow given example. $path_parts = pathinfo(‘/www/htdocs/index.html’); echo

Read more

php get current date

You can get current date in php using getdate().This function return array of options like seconds,minutes,hours,mday, and other options.You can also get date uing date function of php.Here i am presnting you some examples how to get current date in php. $dateArray=getdate();     echo “Current seconds=”.$dateArray[‘seconds’];    echo “Current minutes=”.$dateArray[‘minutes’];    echo “Current hours=”.$dateArray[‘hours’];    echo “Current mday=”.$dateArray[‘mday’];    echo “Current wday=”.$dateArray[‘wday’];    echo “Current

Read more

php get current timestamp

There is lots of way to get current timestamp. In php you can get current unix timestamp using time() function.Please use bellow given examples to get current unix timestamp. date_default_timezone_set(‘Asia/Calcutta’); //optional If PHP 5.3 generate Wornings then use it $cureentTimeStamp=time(); //current timestamp echo $cureentTimeStamp; echo ‘another Way’; echo strtotime(“now”);

Read more

wordpress font size tag cloud

The default font size for wordpress tag cloud is not well formated for all wordpress theme.So how to change wordpress theme tag cloud fontsize.There is a filter for wordpress called “widget_tag_cloud_args” In this filter you can apply font-size and many more options for wordpress tag cloud.   What you have to do is add given code into your current theme’s

Read more

remove image link wordpress

By defualt when you add image from gallery the link also added to the image.A link to image can be remove easy writing small code into function.php or creating plugin. Here is code for how to remove links from images add_filter(‘the_content’, ‘remove_images_from_post_page’); function remove_images_from_post_page($content){ $content = preg_replace(‘/]*>]*)><\/a>/im’, ”, $content); return $content; } add_shortcode( ‘gallery’, ‘remove_images_links_gallery’ ); function remove_images_links_gallery($attr) { global

Read more

magento search category name

Magento how to get category collection by name ? For example here we will get category by it name $category = Mage::getModel(“catalog/category”); $collection = $category->getCollection(); $collection->addAttributeToSelect(“*”); $collection->addFieldToFilter(“name”,array(“eq”=>’test’); The above code will fetch all category named “test”.

Read more

Magento get product by attribute

For example here we will product by it name   $collectionss = Mage::getModel(‘catalog/product’)->getCollection()->addAttributeToSelect(‘*’)->addUrlRewrite(); $collectionss->addFieldToFilter(array( array(‘attribute’=>’name’,’eq’=>’test’), )) Get Product By Id $_newProduct = Mage::getModel(‘catalog/product’)->load($id);

Read more

magento add product to cart

require_once ‘app/Mage.php’; Mage::app(“default”); Mage::getSingleton(“core/session”, array(“name” => “frontend”)); $session = Mage::getSingleton(“customer/session”); $userData=Mage::helper(‘customer’)->getCustomer()->getData(); $cart = Mage::getSingleton(‘checkout/cart’); $yourProId=7; $qty=2; $params = array( ‘product’ => $yourProId, ‘related_product’ => null, ‘qty’ => $qty ); $product = new Mage_Catalog_Model_Product(); $product->load($yourProId); $cart-> addProduct($product, $params); $cart->save(); Mage::getSingleton(‘checkout/session’)->setCartWasUpdated(true); $message = (‘Your cart has been updated successfully.’); Mage::getSingleton(‘checkout/session’)->addSuccess($message);

Read more

jquery date picker

Bydefault Jquery date picker come with Jquery UI and Jquery UI has lots of css and js file so it is not as easy to use jquery date picker.So here you will find full Jquery date picker only code with downloads.This date picker is extracted from Jquery UI so you can use seprate jquery date picker without using lots of

Read more

PHP Download File Forcefully

In php there are some situation where you want to download file Forcefully.For that you have to use php header function. In header function you have to use Content-Type as application/octet-stream and Content-Disposition. ob_clean(); ob_start(); $filename=’private_movie.zip’; $absoluteFilePath=’/public_html/downloads/private_movie.zip’ header(“Pragma: public”); header (“Cache-Control: must-revalidate, post-check=0, pre-check=0”); header(“Cache-Control: maxage=1”); header (“Content-Type: application/octet-stream”); header (“Content-Length: ” . filesize($absoluteFilePath)); header (“Content-Disposition: attachment; filename=$filename”); readfile($absoluteFilePath);

Read more
1 2 3 4