Latest Updates

November 23, 2015

IIS Server, remove index.php from URL in Magento

Posted By: Unknown - 4:53 PM

This article would help you if you hosted your Magento website in IIS server and you want to remove index.php from URL for make URLs SEO friendly.

Let's change setting in Admin Panel

Go to Magento admin panel –> system –>configuration –>web –>Search Engines Optimization –> Use Web Server Rewrites –> Yes

Create web.config file under Magento root folder

add the following content to the file (tracing is optional)



  
    
      
        
        
          
          
            
            
            
          
          
        
      
    
    
      
        
          
            
          
          
        
      
    
  

June 5, 2015

Identify the website operated in which device type whether is it Computer or Mobile

Posted By: Unknown - 8:52 PM


Below is the C# method to check whether it is Computer or Mobile.

public static bool isMobileBrowser()
        {
            //GETS THE CURRENT USER CONTEXT
            HttpContext context = HttpContext.Current;

            //FIRST TRY BUILT IN ASP.NT CHECK
            if (context.Request.Browser.IsMobileDevice)
            {
                return true;
            }
            //THEN TRY CHECKING FOR THE HTTP_X_WAP_PROFILE HEADER
            if (context.Request.ServerVariables["HTTP_X_WAP_PROFILE"] != null)
            {
                return true;
            }
            //THEN TRY CHECKING THAT HTTP_ACCEPT EXISTS AND CONTAINS WAP
            if (context.Request.ServerVariables["HTTP_ACCEPT"] != null &&
                context.Request.ServerVariables["HTTP_ACCEPT"].ToLower().Contains("wap"))
            {
                return true;
            }
            //AND FINALLY CHECK THE HTTP_USER_AGENT 
            //HEADER VARIABLE FOR ANY ONE OF THE FOLLOWING
            if (context.Request.ServerVariables["HTTP_USER_AGENT"] != null)
            {
                //Create a list of all mobile types
                string[] mobiles =
                    new[]
                {
                    "midp", "j2me", "avant", "docomo", 
                    "novarra", "palmos", "palmsource", 
                    "240x320", "opwv", "chtml",
                    "pda", "windows ce", "mmp/", 
                    "blackberry", "mib/", "symbian", 
                    "wireless", "nokia", "hand", "mobi",
                    "phone", "cdm", "up.b", "audio", 
                    "SIE-", "SEC-", "samsung", "HTC", 
                    "mot-", "mitsu", "sagem", "sony"
                    , "alcatel", "lg", "eric", "vx", 
                   "philips", "mmm", "xx", 
                    "panasonic", "sharp", "wap", "sch",
                    "rover", "pocket", "benq", "java", 
                    "pt", "pg", "vox", "amoi", 
                    "bird", "compal", "kg", "voda",
                    "sany", "kdd", "dbt", "sendo", 
                    "sgh", "gradi", "jb", "dddi", 
                    "moto", "iphone"
                };
                // "NEC", 
                //Loop through each item in the list created above 
                //and check if the header contains that text
                foreach (string s in mobiles)
                {
                    if (context.Request.ServerVariables["HTTP_USER_AGENT"].
                                                        ToLower().Contains(s.ToLower()))
                    {
                        return true;
                    }
                }
            }

            return false;
        }

May 24, 2015

Customizing Admin Panel theme in WordPress via Plugins

Posted By: Unknown - 11:03 AM

 
 Color schemes in word press are basically skins that style what the admin area looks like. It's basically a CSS file, where you can control elements like what the navigation and links look like, all of the different modules and windows that you will see with in the admin area.

A user can control what color scheme they see on a per user basis. So, one user logs in and they could have one color scheme and another user logs in and they could see another color scheme. Or there are ways to override this so that everybody sees the same one.

What we're gonna do is were gonna look at a couple plugins that add color schemes.

First lets take a quick look at what color schemes look like. When we log into the admin area and come down to Users, click into our Profile. We can see the admin color schemes right here.

 

 So when we click through these, we can see that it's using CSS to apply different styles within the admin area. What we are going to look at is how to get more options available here as well as code our own custom ones so that we can control what this admin area would look like a good case would be if you have a site design that is branded for a particular company on one end. You could also brand that on the back end and control those colors to appear here.

So, let's go ahead and take a look at how to do this using the plug-in based approach.

If we come in under plugins and we look for Admin Color Schemes, we could go ahead and activate it.





And then we should be able to come back into our user area and see that we have a bunch more options now available to us.



So this is one option that we have for using plug ins to just give us more color scheme options, and we can update our profile and again if somebody else were to log in they would see the default one but they can come in and pick their own, unless you do something.

So that's our first plug-in approach. The second one is using the Admin Color Schemer plugin.



This is going to create our own custom color scheme on the fly using color pickers. Now we can begin to pick all of our own colors. They have some advanced options so that if you want to control more things like the menu background, which very likely you will want to set a number of these extra colors, so we can click save and use.





They have some advanced options so that if you want to control more things like the menu background, which very likely you will want to set a number of these extra colors, so we can click save and use.

If we come into users though we'll find that it has now embedded our custom one here so that we can come back to it and select it.

April 30, 2015

Upgrade DNN website to the latest version

Posted By: Unknown - 9:00 AM

follow up below steps to upgrade DNN website from old to new one.

1. Download Version Upgrade file from here


2. Extract downloaded Zip file to root of your existing old version of DNN website. It is replacing all your old files with new one.



3. Run your website.
4. When you run your website, it will be automatically redirect to Upgrade Wizard page.


5. Just provide your HOST Username/Password and Click on Install button.
6. Now it will start process of mapping your old database tables & store procedures with   new one.
7. After complete the process to 100%, click on Visit Website button.
8. Done. Your website updated.

April 29, 2015

How to create dynamic page in DNN

Posted By: Unknown - 6:21 PM


Most of the people using DotNetNuke an Open Source CMS platform to manage his content in his website but don't know how to create dynamic pages. Here is the some guidance to make pages dynamic, fetch data from database and display on the page.

Here I show you how to bind Country names in DropDownList control using DNN module.

  • First of all open your DNN website in Visual Studio. You can see the DesktopModules folder in your root directory, right click on the directory and add new directory give it to name as your module name, for example "CountryState". Now right click on the CountryState folder and Add->Add New Item->Select Web User Control and give it to name as your module name like "CountryState.ascx", it will show you CountryState.ascx and CountryState.ascx.cs files in DesktopModules/CountryState folder.

CountryState.ascx.cs file looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DesktopModules_CountryState_CountryState : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

  • Next step to update inherit class "System.Web.UI.UserControl" to "PortalModuleBase". This is because of the PortalModuleBase class defines a custom base class inherited by all desktop portal modules within the Portal. The PortalModuleBase class defines portal specific properties that are used by the portal framework to correctly display portal module.



Next step to add DropDownList control in .ASCX file as we already doing in .ASPX page and write logic in .ASCX.CS file to fill out DropDownList.

.ASCX MarkUp:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="CountryState.ascx.cs" 
    Inherits="DesktopModules_CountryState_CountryState" %>


.ASCX.CS Logic:

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke.Entities.Modules;

public partial class DesktopModules_CountryState_CountryState : PortalModuleBase
{
    SqlConnection moConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString);
    SqlCommand moCommand = new SqlCommand();
    SqlDataAdapter moAdapter = new SqlDataAdapter();
    DataSet moDataSet = new DataSet();
    string msQuery;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bindCountryList();
        }
    }

    protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
    {
        msQuery = "select * from states where CountryID="+ ddlCountry.SelectedValue +";";
        Execommand(msQuery);
        moAdapter.Fill(moDataSet);

        DataTable loTable = new DataTable();
        loTable = moDataSet.Tables[0];

        ddlState.DataSource = loTable;
        ddlState.DataTextField = "StateName";
        ddlState.DataValueField = "StateID";
        ddlState.DataBind();
        ddlState.Items.Insert(0, new ListItem("Select State", "0"));
    }

    private void bindCountryList()
    {
        msQuery = "select * from countries;";
        Execommand(msQuery);
        moAdapter.Fill(moDataSet);

        DataTable loTable = new DataTable();
        loTable = moDataSet.Tables[0];

        ddlCountry.DataSource = loTable;
        ddlCountry.DataTextField = "CountryName";
        ddlCountry.DataValueField = "CountryID";
        ddlCountry.DataBind();
        ddlCountry.Items.Insert(0, new ListItem("Select Country", "0"));
    }

    public void Execommand(string fsString)
    {
        try
        {
            moDataSet.Reset();
            moCommand = new SqlCommand(fsString, moConnection);
            moAdapter = new SqlDataAdapter(moCommand);
            moConnection.Open();
            moCommand.ExecuteNonQuery();
            moConnection.Close();
        }
        catch (Exception) { }
    }
}

  • Now logged-In in your website using your Host credential. 
  • In DNN panel, go-to Host->Extensions.
  • Click on Create New Module button on right top corner of the Extensions Page.


  • Create New Module button open a popup window with Create Module Form DropDownList. Select Control from that Drop-Down. 
  • It will show you form, select your .ascx web user control  in that from as below and click on Create Module button.

  • Finally Drag-N-Drop module on your page.

  • Enjoy! ;)

Source Code: Download Here

Github Articles

WordPress Articles

Copyright © 2015 Keval's Blog™ is a registered trademark.

Designed by Templateism