Ganesh H S

thoughts on life, entrepreneurship, technology

php easier way to set the include_path

I always used retrieving the Operating system environment, and then get all current include path and then set the include path <?php $delim = (PHP_OS == “WIN32″ || PHP_OS == “WINNT”) ? ‘;’: ‘:’; ini_set(‘include_path’, “.”); ini_set(‘include_path’, ini_get(‘include_path’) . “my_library”); ini_set(‘include_path’, ini_get(‘include_path’) . “my_library/include”); ?> Here is the code, which simplifies the above logic of [...]

I always thought following links are same – http://ganeshhs.com/search-engine-optimization-seo/noindex-nofollow http://www.ganeshhs.com/search-engine-optimization-seo/noindex-nofollow Above links leads to the same page, but it differs with www. But search engine treats both links are different, i have seen in few cases where we link many a times we ignore www. and in some cases we do include www. in the [...]

seo robotstxt

Web Robots (Crawlers, or Spiders) are programs that traverse the Web automatically. Search engines use them to index the web content. Whenever search engine robotos wants to crawl the website, it looks for robots.txt which is the file where we write the instructions to the robots/crawlers about what it should crawl and what it shouldn’t. [...]

In the previous article Zend Lucene Search – part4 – Search Results Highlighting i talked about highlighting the keywords in search results. In this article i will be writing about highlighting the keywords in search results and formating the output display format much similar to most search engines result page using the zend lucene search. [...]

Once the index is created, we are ready use zend lucene search to search the website. In the following example, php is the search keyword used to fetch the relevant search results in the already indexed data. <?php require_once ‘Zend/Search/Lucene.php’;$query = “php”; $index = Zend_Search_Lucene::open(“/var/www/lucene-data/blog-index”); $results = $index->find($query); echo “Index contains “.$index->count().” documents.\n\n”; if($index->count()) { [...]

In the previous post about setting project environment setting http://ganeshhs.com/php/php-configuring-project-environment-using-ini-file , zend config plays a vital role in initializing the environment variables and by default, configuration data made available through Zend_Config are read-only. Lets write the ini configuration file application/config.ini [staging] db.adapter = PDO_MYSQL db.config.host = localhost db.config.username = mysql_user db.config.password = mysql_password db.config.dbname = [...]

Zend loader is much similar to require_once, best usage is if we have to load a file based on the variable value. <?php require_once “Zend/Loader.php”; Zend_Loader::loadClass(‘Zend_Session’); Zend_Session::start(); ?> The above example, illustrates loading the zend session class and starting the session. Here i am not going to discuss complete usage of zend loader, i will [...]

For creating the index from the existing data, we need to create the index. Isn’t it a better idea to index each data when its created, to index the real time data we need to open the index which was created earlier, rest of the other things remains same as discussed in the Zend lucene [...]

In this zend framework tutorial, we will learn how to create the file/directory layout when developing any project using zend framework. application – business logic files, no access for website users library – library files / reusable components, no access for website users public – access to outside users Considering the above points, here is [...]

You had a plan for a business, you need a website, now the website is done. What next? How do you inform search engines that your website existed and inform them to index your website? When i started working on Search Engine Optimization ( SEO ) for 3 ecommerce sites in 2006, this was the [...]