Srilatha Marru's Blog
Excel to CSV in UTF8 format

I have been struggling to convert Excel to csv in utf8 fomat. Excel didn’t have that option. So as suggested by someone, I used Google Spreadsheet to import my data and then convert to csv.  And the csv file was saved as UTF8.

I hope it saves sometime for you all.

 

Srilatha Marru's Blog
WordPress Events Manager – Get the ical file per category

I am using the wordpress plugin Events Manager http://wp-events-plugin.com/ It had features to download the ical files for an individual event and all the events on the site. Both of these can be achieved with below urls:

http://example.com/events.ics – This url gets the ical file with all the events on the site.
http://example.com/event//ical – This gets an ical for an individual event.

And I want to get the ical file per category.

To get the ical file per category below are the steps to follow:

  1. Modify the ical template templates/ical.php and add a search attribute e.g. ‘category’=>’7′

    http://wp-events-plugin.com/documentation/using-template-files/

    http://wp-events-plugin.com/documentation/event-search-attributes/

  2. To get the category ID I used the following code:

    $uri=$_SERVER['REQUEST_URI'];
    $args=explode('/',$uri);

    /* Get the category ID */
    if($args[1]=='events' && $args[2]=='categories') { $cat_name=$args[3]; $cat_obj=get_term_by('name', $cat_name , 'event-categories'); $cat_id=$cat_obj->term_id; }

  3. The url for the ical file per category will be http://example.com/events/categories//events.ics

I hope this will save some time for you!

Srilatha Marru's Blog
Drupal Menu Block, show parent item with no children

I have been using menu block for setting the left side navigation for many of my sites and it works very well. The only problem I saw was that when a parent menu item is added with no children, the left side navigation doesn’t show up. The left side navigation shows up only when the menu item is children of a parent item or the menu item is a parent item with children.

I wanted to show left side menu block navigation for parent menu item with no children. And here is what I found from a hack on drupal forums. In the menu_block.module, comment the below lines –
/* }
else {
$data['content'] = ”;
}*/

Note: This solves your problem of displaying the parent menu item, but adds another small problem that it displays the “Main menu” title to all pages on the left sidebar. To avoid this, on your “menu block” settings page, add the below exceptions for menu block and for more pages as you see necessary.


search/*
contact-us
privacy-policy
user/*
admin/*
news/*

The menu block configuration I have set up is:
Block title as link checked.
Main Menu: Main Menu. (As I wanted left side navigation for main menu)
Starting Level: 2nd level secondary.
Fixed Parent Item: Main Menu.

Srilatha Marru's Blog
Enable multiple file upload in Drupal 7

Problem:  To add multiple file uploads to each page.

Solution:   In drupal 7 file field exists in the core modules as opposed to adding a file field withh cck in drupal 6.

  1. Enable the file field in the drupal core modules.
  2. Go to content types and manage fields and add the file field to the basic page type or article if needed.  (at admin/structure/types/manage/page/fields)
  3. Now go to file settings (click on edit for the file field).
  4. Got to “File field settings”  and select the number of values.  Select the number which will be the max number of files you will upload for a page.
  5. And save settings.

There you go and you can upload multiple files for each page in drupal.

 

Srilatha Marru's Blog
Second level url pattern with path auto Drupal

For my drupal site I am including 2nd level url pattern.   If  a page exists  ’our facilities’ exists under ‘About us’ the intended url is /about-us/our-facilities

In the path auto, url aliases, replace [node:title] with [node:menu-link:parent:title]/[node:title]



AUTHOR

profileWeb Developer working in advertising agency.

Recent tweets

The Twitter REST API v1 is no longer active. Please migrate to API v1.1. https://dev.twitter.com/docs/api/1.1/overview.