• Create an account
    *
    *
    *
    *
    *
    Fields marked with an asterisk (*) are required.
  • Friday, Apr 25

    Last update01:38:05 PM

    • How To Create a Facebook Page

      How to access Facebook Pages?

      You can find Facebook Pages in left column on your Facebook home page when you are logged in. If it is not showing you can click on More link to find it. Then click on create page link as shown in screenshot. If you still can not find it Click Here to go directly to Facebook Create Page Screen (Make sure you are signed in Facebook).

      Creating a Facebook Page

      On Create a Page screen you will be asked to enter various categories of information to input. You can choose between Official Page or Community Page. When you create a page you will see URL in Browser address bar for that page. For example

      Customized Facebook Profile URL

      If you have customised Facebook Page URL then your ID will not show in URL and your URL will be like http://www.facebook.com/USER_NAME instead. To find your Facebook Page ID from a Customised URL simply click on your profile picture and it will take you to your profile pictures. On profile pictures area you will see your Facebook Page ID in browser address bar.

      Read More...
    • How to delete and moderate comments in Facebook comments box plugin?

      This tutorial is about how to moderate and delete process works for Facebook Comments box.

      First of all make sure that you have installed, configured and published JavaScriptSDK plugin and Facebook Social Comments plugin.

      In JavaScriptSDK plugin setting you must enter Facebook User IDs of the users who you want to allow to be able to moderate comments. If you want to moderate yourself only then enter your own Facebook ID. 

      facebook admin id

      Moderators View

      After your have added Facebook admin ID save JavaScriptSDK plugin and go to frontend of your website and refresh comments page. You should see Moderators View and Settings above Comments Box as shown below when you are logged into Facebook.

      facebook moderator view

      Click on Moderator view so we can have a look what is in Moderators view. In Moderators view you will see a list of all the comments for that page. In this screen you can Like, Follow and Moderate comments.

      Facebook has made changes and now only the user who posts a comment can competely delete it. Owners and Moderators of Comments Plugin can choose to Hide comments. Hide comments option will remove the comment and it will not be visible to your readers except to friends of that person who actualy made that comment.

      facebook comments moderator view

      At present only a user(who made comment) can completely remove their comment by clicking the cross sign that appears next to their comment (cross sign appear when you hover over your own comment).

      If you choose to Ban user then it will permanently block that user from commenting on any of your posts.

      If you choose to Boost comment will bring the comment at top so that everyone could read it.

      Facebook Comments plugin also allows o arrange the order of comments. For example you can set to show the New comments first and old comments later.

      By default comments are organized by social ranking which means that only those user comments' will be displayed at top who has good reputation on Facebook.

      Settings View

      Click on Settings to open Settings. Under settings you can add moderators, set Moderation mode, Blacklist words, allow other Login providers, enable Grammer filter and set Comments Composer. See screenshot below highlighting these settings.

      facebook comments settings

      Comments Ordering

      If you want the newest comments to be displayed at top and oldest at bottom then choose Reverse Chronological.

      facebook comments ordering

      Read More...
    • How to delete test orders in Magento

      Following queries will single Magento orders. [sql] set @increment_id='100000001'; select @order_id:=entity_id from prefix_sales_order_entity where increment_id=@increment_id; delete from prefix_sales_order_entity where entity_id=@order_id or parent_id=@order_id; delete from prefix_sales_order where increment_id=@increment_id; [/sql] where prifix_ is your database table prefix if you use one. 100000001 is the order number that you would like to delete

      Read More...
    • How to enable CURL on WAMP local server

      I needed CURL to test some php scripts on WAMP Local Server where CURL is disabled by default. To enable it under WAMP running on a Windows Environment follow these steps.

      1. Navigate to WAMP\bin\php\[version_of_php]\
      2. Edit php.ini
      3. Search for curl and uncomment extension=php_curl.dll by removing ; and save file
      4. Navigate to WAMP\bin\Apache\[version_of_apache]\bin\
      5. Edit php.ini
      6. Search for curl and uncomment extension=php_curl.dll by removing ; and save file
      9) Restart WAMP
      

      Read More...
    • How to find a file in Eclipse using file name

      Eclipse comes with advanced search capabilities. User can drill down in file explorer view but using search can make it really easy. Use Ctrl+Shift+R to open Open Resource dialog box which will let you type in any file name you are looking for. Results will starts appearing as you start to type file name. You can click to open any file you want from the results. This is the fasted way to find any resource (files). To search any text in any file on project hit Ctrl+H and it will open a search dialog box where you have many different search options to choose from.

      Read More...
    • How to find and replace text database table

      Often we need to update text in column of a database table. It can be time consuming if there are thusands of rows to be updated. Follwing query will update text based on Like condition: Syntax: [code] UPDATE tablename SET fieldname = REPLACE(fieldname, 'text to find', 'text to replace with') WHERE fieldname LIKE '%text to find%' [/code] Example: [code] UPDATE z2uil_kaimageslider SET image = REPLACE(image, 'images/stories', 'images') WHERE image LIKE '%images/stories/members%' [/code] Backup of database is recommended just to be on safe side.

      Read More...
    • How to get currect SEF URL in Joomla 1.0

      $uri is global variable which holds current SEF url in Joomla 1.0

      global $uri;
      $thisurl = 'http://'.$_SERVER['SERVER_NAME'].DS.'component'.DS.$uri[1];
      

      Read More...
    • How to get name of current Joomla template?

      If you need to know what is current template being used in your plugin or component code you can use following code to find it. [code] $app =& JFactory::getApplication(); $template = $app->getTemplate(); [/code]

      Read More...
    • How to install a new language in Joomla 1.5 websites

      Joomla content management system comes offers various language packs and translations. You can download language packs from following URL: http://joomlacode.org/gf/project/jtranslation/frs/   Once you have the language files that you want to install on your computer go ahead and login into Joomla backend at [your_website]/administrator and go to Extensions > Install/Uninstall.   After installation you can set new installed langauge as default language for your Joomla website by going to Extensions > Language Manager and selecting the language for default.   Note: Installing a new language does not automatically translate the content of your website. It only set direction of text Right-to-Left and Left-to-Right and transalates most of backend strings into your new language. You still have to install and setup a language extension if you want to fully translate your Joomla site.

      Read More...
    • How to install GIT client in Ubuntu

      GIT is a very famous version control system used by majority of developers and designers these days. If you have ever used Subversion, CVS or Mercurial you would know the concept and need of version control in software development and graphics design. By default GIT is not available on Ubuntu. You can use following command to install it.

      sudo apt-get install git-core
      
      After you run that command in SSH of your server and installation is complete you can start to use got on your server b using GIT commands. To confirm that GIT is installed on your sever enter following command and it will show you available commands for GIT.
      git
      
      To check version of GIT enter following command
      git --version
      

      Read More...
    • How to install mcrypt for PHP in ubuntu

      On my Ubuntu 4.9 with PHP Version 5.3.2-1 I had to install Magento that required myscrypt. To install it, I followed following steps:

      apt-get install php5-mcrypt
      /etc/init.d/apache2 restart
      
      Sometimes you might get the message “php5-mcrypt is already the newest version“. If so, install with:
      apt-cache search php5-m
      php5-mapscript - php5-cgi module for MapServer
      php5-mcrypt - MCrypt module for php5
      php5-memcache - memcache extension module for PHP5
      php5-ming - Ming module for php5
      php5-mhash - MHASH module for php5
      php5-mysql - MySQL module for php5
      php5-sybase - Sybase / MS SQL Server module for php5
      
      apt-get --reinstall install php5-mcrypt
      /etc/init.d/apache2 restart
      

      Read More...
    • How to parse a string between two strings

      Handy function to parse XML and other strings and get the inner string out. Example 1:

      function get_string_between($string, $start, $end){ 
          $string = " ".$string; 
          $ini = strpos($string,$start); 
          if ($ini == 0) return ""; 
          $ini += strlen($start); 
          $len = strpos($string,$end,$ini) - $ini; 
          return substr($string,$ini,$len); 
      } 
       
      $fullstring = "this is my [tag]dog[/tag]"; 
      $parsed = get_string_between($fullstring, "[tag]", "[/tag]"); 
       
      echo $parsed; // (result = dog) 
      
      Example 2:
      function get_all_strings_between($string,$start,$end) {
      //Returns an array of all values which are between two tags in a set of data
      $strings = array();
      $startPos = 0;
      $i = 0;
      //echo strlen($string)."\n";
      while($startPos < strlen($string) && $matched = get_string_between(substr($string,$startPos),$start,$end)) {
      if ($matched == null || $matched[1] == null || $matched[1] == '') break;
      $startPos = $matched[0]+$startPos+1;
      array_push($strings,$matched[1]);
      $i++;
      }
      return $strings;
      }
      
      function get_string_between($string, $start, $end) {
      //$string = " ".$string;
      $ini = strpos($string,$start);
      if ($ini == 0) return null;
      $ini += strlen($start);
      $len = strpos($string,$end,$ini) - $ini;
      return array($ini+$len,substr($string,$ini,$len));
      }
      

      Read More...
    • How to reset Joomla Super Admin password

      To reset password you must have access to Joomla database. Most of the hosting providers come with some sort of control panel or PhpMyAdmin. Also make a backup of your database in case you have to revert back to original database. Find users table, e.g. jos_users. Note you table names may vary depending on the prefix used with table names (e.g. prefix_users). Find the Super Administrator account. It will have usetype = "Super Administrator" Using mySQL's builtin MD5 function we can set the new password using following SQL statement.

      UPDATE `jos_users` SET `password` = MD5( 'newPassword' ) WHERE `jos_users`.`username` = "admin";
      
      Now goto www.yourwebsite.com/administrator and login to backend using your Super Admin username.

      Read More...
    • Including SQL queries inside component XML files

      For install and uninstall process of component queries can be put into a separate SQL file, however if there are not lot of queries then they can also be included in component XML. For example after languages tags in XML file put following:

      <install>
      <queries>
      <query>
      CREATE TABLE `#__comp_groups` (
      `id` int(11) NOT NULL auto_increment,
      `name` varchar(254) NOT NULL default 
      
      
      

      Read More...
    • Installing Joomla via SSH

      SSH ("Secure SHell") is a means of establishing a secure command-line shell interface on a remote system. Log into your server via SSH and navigate to location where you would like to install Joomla e.g

      cd /var/www/vhosts/sitename.co.uk/httpdocs/
      To get the path for file to download goto: http://joomlacode.org/gf/project/joomla/frs/?action=index use wget in SSH client (e.g. putty) to retrieve the remote file to the folder you will be installing Joomla.
      // Joomla 2.5 Tar file
      wget 'http://joomlacode.org/gf/download/frsrelease/16512/72037/Joomla_2.5.1-Stable-Full_Package.tar.gz'
      
      Once the download is complete you should have the file:
      // Joomla 2.5 Tar File
      /var/www/vhosts/sitename.co.uk/httpdocs/Joomla_2.5.1-Stable-Full_Package.tar.gz
      
      Next step is to uncompress the file, navigate to location of file:
      // gunzip will uncompress the Gzip archive and give us Tar archive
      // For Joomla 2.5
      gunzip 'Joomla_2.5.1-Stable-Full_Package.tar.gz'
      // Now uncompess Tar archive
      tar -xvf 'Joomla_2.5.1-Stable-Full_Package.tar'
      
      
      // Regarding -xvf:
      // x if for extract
      // v is for verbose
      // f is for file
      
      Now you can go to front end of your website where you should see the installation screen. Following some of the other useful commands to uncompress files that are in other formats:
      // Use these commands while you in same directory as archive file
      // .zip file:
      unzip filename.zip [-d directory_name]
      
      // .tar file:
      tar -xvf file.tar
      
      // .gz file:
      gzip -d file.gz
      
      // .tar.gz file:
      gzip -d file.tar.gz
      tar -xvf file.tar
      
      // .tgz file:
      tar -xvzf file.tgz
      
      // .bz2 file:
      tar -xvfj file.tar.bz2
      
      Once you have Joomla install file on server you can proceed with installation process by navigating to install URL in web browser. For example http://www.example.com/ or if your Joomla is in a sub directory then http://www.example.com/joomla_directory/ Once the installation is complete, remove installation directory using the following:
      rm -rf installation
      rm Joomla_1.5.15-Stable-Full_Package.zip
      
      Now you have a live Joomla website. You can secure file permission by following ssh commands.
      chown -R appacheuser:psaserv joomla_derectory
      find joomla_derectory -type d -exec chmod 775 {} \;
      find joomla_derectory -type f -exec chmod 664 {} \;
      

      Read More...
    • Internet Explorer 6 (IE6) PNG Fix Techniques

      Following are some of the great techniques and scripts to fix IE6 PNG transparency issue. DD_belatedPNG Supersleight jQuery Plugin PNG 8-bit technique (Fireworks) Clever PNG Optimization Techniques PNG Optimization Guide: More Clever Techniques More and more web designers nowadays not fixing the PNG issue for IE6 anymore.

      Read More...
    • Joomla Constants

      Following is list of constants that can be used in Joomla:

      JPATH_ADMINISTRATOR 	The path to the administrator folder.
      JPATH_BASE 	The path to the installed Joomla! site.
      JPATH_CACHE 	The path to the cache folder.
      JPATH_COMPONENT 	The path to the current component being executed.
      JPATH_CONFIGURATION 	The path to folder containing the configuration.php file.
      JPATH_INSTALLATION 	The path to the installation folder.
      JPATH_LIBRARIES 	The path to the libraries folder.
      JPATH_PLUGINS 	The path to the plugins folder.
      JPATH_ROOT 	The path to the installed Joomla! site.
      JPATH_SITE 	The path to the installed Joomla! site.
      JPATH_THEMES 	The path to the templates folder.
      JPATH_XMLRPC 	The path to the XML-RPC Web service folder.
      
      These constants are defined in _path_/includes/defines.php except JPATH_BASE which is defined in _path_/index.php.
      
      Note: These paths are the absolute paths of these locations within the file system, NOT the path you'd use in a URL.
      
      Also <a href="http://docs.joomla.org/JURI/base">JURI/base</a>.<ins datetime="2009-11-19T00:58:51+00:00"></ins>
      
      /* this gives you the root of your url, something like http://www.mydomain.com/whereverjoomlais/       */
      JURI::root();
      
      /* this one gives you the url to your index something like http://www.mydomain.com/whereverjoomlais/ if you are in front-end, and http://www.mydomain.com/whereverjoomlais/administrator/ if in back-end */
      JURI::base();
      
      /* Same but without the domain (like this: /wherejoomlais/administrator ) NOTE: this one is without the trailing "/"  */
      JURI::base( true );
      
      /* Path to your root directory, "/opt/xampp/..." or similar in Linux, "C:\wampp\..." on Windows */
      var_dump( JPATH_ROOT );
      
      /* Path to your admin directory, "/opt/xampp/joomla155/administrator" or similar in Linux, "C:\wampp\joomla155\administrator" on Windows. */
      var_dump( JPATH_ADMINISTRATOR );
      
      /* Path to your current component directory, "/opt/xampp/joomla155/administrator/components/com_free" or similar in Linux, "C:\wampp\joomla155\administrator\components\com_free" on Windows. */
      var_dump( JPATH_COMPONENT );
      
      /* Your directory separator: "/" in Linux, "\" on windows; use this to create a path to a directory so you don't have to worry about the server OS you're using */
      var_dump( DS );
      

      Read More...
    • Joomla Global Language Variable

      Using following code we can get joomla's language and use it in our extensions code.

      $lg = &JFactory::getLanguage();
      $language = $lg->getBackwardLang();
      
      $language will give us the current language selected.

      Read More...
    • Joomla parameters

      There are 21 different standard parameter types supported in the Joomla Framework for all extension types (templates, components, modules and plugins). This section gives a brief description of each parameter type, in alphabetical order. Full details of each parameter type are given on the following pages. Standard parameter types Component parameters

      Read More...
    • Joomla plugin to insert codes in head section

      Following is a template that can be used to develop plugins to inert code into Joomla head section.

      <?xml version="1.0" encoding="utf-8"?>
      <install version="1.5" type="plugin" group="system">
      	<name>System - Name of Plugin</name>
      	<author>Name of  author</author>
      	<creationDate>19th April 2010</creationDate>
      	<authorEmail>
       This e-mail address is being protected from spambots. You need JavaScript enabled to view it
       </authorEmail>
      	<authorUrl>http://www.khawaib.co.uk</authorUrl>
      	<version>1.0</version>
              <copyright>Copyright (c) 2010 Khawaib Ahmed. All rights reserved.</copyright>
      	<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
      	<description> Plugin description.</description>
      	<files>
      		<filename plugin="phpFileName">phpFileName.php</filename>
      	</files>
      	<params>
      		<param name="code" type="text" default="[DEFAULT VALUE]" label="[LABEL]" description=" [DESCRIPTION]"  />
      	</params>
      </install>
      
      <?php
      // no direct access
      defined( '_JEXEC' ) or die( 'Restricted access' );
      
      jimport( 'joomla.plugin.plugin');
      
      class plgSystemAsynGoogleAnalytics extends JPlugin {
      	function plgAsynGoogleAnalytics(&$subject, $config) 	{
      		parent::__construct($subject, $config);
      		$this->_plugin = JPluginHelper::getPlugin( 'system', 'AsynGoogleAnalytics' );
      		$this->_params = new JParameter( $this->_plugin->params );
      	}
      	
      	function onAfterRender() {
      		global $mainframe;
      		
      		// skip if admin page 
      		if($mainframe->isAdmin()) {
      			return;
      		}
      
      		// get params
      		$trackerCode = $this->params->get( 'code', '' );
      		
      		//getting body code and storing as buffer
      		$buffer = JResponse::getBody();
      		
      		//embed Google Analytics code
      		$javascript = "<script type=\"text/javascript\">
      					  var _gaq = _gaq || [];
      					  
      					  _gaq.push(['_setAccount', '".$trackerCode."']);
      						_gaq.push(['_trackPageview']);
      					
      					  (function() {
      						var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      						ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      						var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      					  })();
      					</script>";
      
      		// adding the Google Analytics code in the header before the ending </head> tag and then replacing the buffer
      		$buffer = preg_replace ("/<\/head>/", "\n\n".$javascript."\n\n</head>", $buffer); 
      		
      		//output the buffer
      		JResponse::setBody($buffer);
      		
      		return true;
      	}
      }
      ?>
      
      

      Read More...
    • Joomla Template Variables

      Website Root path

      <?php echo $this->baseurl ?>
      
      Template name
      <?php echo $this->template;?>
      
      $this->baseurl;
      $this->template;
      $this->params; // Template specific params object -- defined in the params.ini file
      // From JDocument:
      $this->base; // Document base URL -- redundant, as far as I can tell
      $this->description; // Document description
      $this->direction; // Contains the document direction setting (default='ltr')
      $this->language; // Contains the document language setting (default='en-gb')
      $this->link; // Document full URL
      $this->title; // Document title
      $this->_generator; // Document generator (default='Joomla! 1.5 - Open Source Content Management')
      

      Read More...
    • Joomla usefull variables

      A list of useful Joomla variables I often need.

      $mainframe->getCfg('offset') - returns the time offset configured in Joomla Global settings.
      $mainframe->getCfg('live_site') - returns live site configured in Joomla Global settings.
      JURI::base()
      

      Read More...
    • Linux server useful commands

      Some useful Ubuntu command lines I use often: Restart Appache

      /etc/init.d/apache2 restart
      Restart MySQL
      /etc/init.d/mysql restart
      Find Ubuntu Server Specs
      cat /etc/lsb-release
      Update the directory permissions
      cd /var/www/vhosts/[domain.com]
      chown -R [username]:psacln httpdocs
      chmod -R g+w httpdocs
      find httpdocs -type d -exec chmod g+s {} \;
      
      Collect Statictics data:
      /usr/local/psa/admin/sbin/statistics >/dev/null 2>&1

      Read More...
    • Loading a module in a component output

      Soluotions 1:

      defined('_JEXEC') or die('Restricted access');
      jimport('joomla.application.module.helper');
      $mod = JModuleHelper::getModule('name_of_module');
      echo JModuleHelper::renderModule($mod);
      
      If you want to output all modules on a certain position, then use JModuleHelper::getModules('name_of_position') and render the array of modules in a foreach-loop. Some XML around it and you have a XML-output (often used that to get modules into Flash). Solution 2:
      Create an article that only contains the module, by using , and then display that article with a template that only outputs <jdoc:include type="component" />
      

      Read More...
    • Log an entry into Joomla Log

      Joomla's JLog class enables to create log files with useful debug info and other log messages. Following is the PHP code that can be used to log messages.

      jimport( 'joomla.error.log' );
      $log = JLog::getInstance('log_file.php'); // get an instance of JLog
      // create entry array
      $entry = array('LEVEL' => '1', 'STATUS' => "SOME ERROR:", 'COMMENT' => $shortUrl->getError() );
      // add entry to the log
      $log->addEntry($entry);
      

      Read More...
    You are here Blog