February 26th, 2015  | Categories: MS SharePoint 2013, NIFTY TRICKS, Things To Remember

Well here’s another post of nifty things to remember. I’m working with SharePoint 2013 (YUCK!) and I ran into a few idiotic idiosyncrasies about it. Here’s a quick post.

Classic SharePoint Breadcrumbs

SharePoint breadcrumbs are hidden in 2013. They’re not included in the default master page… WTF? And when you enable them in your master page (if you can even figure out how to modify the master page), they’re really stupid. They’re a drop down.

First let’s talk about the master page for a sentence or two… The new master pages are only modifiable via their HTML counterpart. So make a copy of the default seattle.html “master page” and that will create another one for you. Rename it as you like and it’s .master will be renamed too. Really stupid, huh?

So you’re just supposed to remove the display: none on the .ms-breadcrumb-dropdownBox div and that brings back the “breadcrumb” but it’s not your typical breadcrumb. It’s a dropdown breadcrumb which sucks ass.

Want a normal breadcrumb? Here’s the code…

<div class="less_crappy_sharepoint_breadcrumb">

Add this right below the .ms-breadcrumb-top div is what I did. I also removed the crappy suck ass breadcrumb since it’s useless to display it then hide it with CSS. Useless!

Styles In The Masterpage

Apparently since everything is done with this .html file, any ASP code or any other code in style tags (probably script as well) has to be “commented out.” Use the following if you want to put styles in your master page.

<!--MS:<style type="text/css">-->
.ms-core-listMenu-horizontalBox li.static > a {
    display: none !important;

Lame, huh?

Oh, and watch out. For some reason SharePoint 2013 don’t do the > anymore so you’re probably going to have to put things like that in the style sheet… (always a good idea anyway).

Hiding The First Top Menu Item

How stupid is this? By default your site name is next to the logo… like you need it twice or something. Want it gone? Tough cookies. You’ll have to hide it with CSS.

Here’s your CSS:

.ms-core-listMenu-horizontalBox li.static > a {
    display: none !important;
.ms-core-listMenu-horizontalBox li.static > ul a {
    display: block !important;

Stupid! I hate SharePoint and I hate SharePoint 2013! How can anyone think this CMS is good. It’s a heavy footprint and look at all the work you have to do for basic things!

I might update this post with more stuff you shouldn’t have to do to get SharePoint to look and function the way websites should OOTB.

#SharePointGetALife #SharePointYouSuck #SharePointWTF

February 13th, 2015  | Categories: Drupal, Drupal 7, NIFTY TRICKS, Things To Remember

Well this post isn’t exactly a PROBLEM/SOLUTION post but more of an entry to put the few things I need to remember on Drupal 7. Here are three things I should remember for the next time I need help with it. I’m naming it I just in case I want more than one.

Limit Site Search Results By Content Type

If you ever need to exclude some content types from the site search, do the following:

  1. Install and enable the search_config module.
  2. Go to #overlay=admin/people/permissions%23module-search_config and at the bottom you can limit anonymous users by content type.

Remove Authoring Information From Search Results

On the search results page, by default, the authoring information is displayed. This kind of stuff should be turned off my default (in my opinion) since sites usually do not expose this information to the user. Only blogs or news articles have author info so it should be turned off for site search, on pages, etc but that’s a different vent. Anyway to turn this information off, do the following:

  1. In /modules/search copy the search-result.tpl.php and paste it into the theme root (like /sites/all/themes/your_theme/ )
  2. Remove the authoring information code.
  3. Save the page.
  4. Clear the Drupal cache.

Search Title & Content Body In View Block

  1. In the view, select the Tontent: Title and Content:Body under the Fields
  2. If you do not want the Body (or any other thing exposed in the list) select the “Exclude from display” in the Configure field: Content:Body.
  3. Under Filter Criteria, choose the “Global: Combine fields filter”.
  4. Check the “Expose this filter to visitors, to allow them to change it”, “Single filter”.
  5. For the Operator, choose “Contains” and select both/all fields under “Choose fields to combine for filtering”.

Permissions On The /sites/default/files Folder

I struggled with permissions issues for like two days. Between going back and forth with IT on what’s allowed and what isn’t allowed. Blogs everywhere say that the files directory should be 777. But that’s access to everything for everybody.

Ours has this access for the directory:


Every folder underneath this one should be granted the same privileges. By the way, this is on a UNIX box.

January 7th, 2015  | Categories: Drupal, Drupal 7, JavaScript, JQuery

I don’t think I’m going to explain this very well. Here’s a short story long.

So what I was trying to do was kind of confusing as it is. I’ll try to explain… In Drupal 7 there is a cool module called field group table. I needed this module to display data in a table format. However, one of the limitations of this module is that it doesn’t display the label in the th for grouped elements. So say you have an address that you’d like to display in a table. You can use this module but it won’t display the group name in the th. It’ll go above the information.

The "location" text and "CRS Coordinator" text is above the data and not in the t h

I used some slick JQuery to move the “Location” text inside the empty th like so:

$(".table_site_map_info .group_table td #site_map_location_th div span").first().appendTo(".table_site_map_info .group_table th.field-label-hidden:eq(0)");

That did the trick. However I noticed that there was a space added and the “Location” and “CRS Coordinator” didn’t line up correctly with the “Phone” (which isn’t a group).

The "location" and "CRS coordinator" were moved to the t h but there was a space before them which doesn't align

Unfortunately the JQuery trim function needs a parameter and all the examples on JQuery and around the web always had it using a JavaScript variable. I just needed to trim elements; not variables.

So in other words, I wanted to do something like $(“.table_site_map_info .group_table th”).trim() . However that didn’t work.

I had to go back tho the drawing board kind of. I first got it out of its span (which I thought initially was the spacing problem). I used:

$(".table_site_map_info .group_table th span").contents().unwrap();

This didn’t work. It got rid of the span but it still had the space. After looking at the HTML in FireBug, I saw an added space in the th. I needed to remove the space. Unfortunately, like I said earlier, the trim function was useless. I had to individually set each HTML element to its trimmed self.

So, here’s my code:

$(".table_site_map_info .group_table th.field-label-hidden:eq(0)").text($.trim($(".table_site_map_info .group_table th.field-label-hidden:eq(0)").text()));

Sorry that this is a long post and it’s mostly useless but I hope it can help someone. I wanted to post this to remember it.

a screen shot of what it's supposed to look like

If anyone has a more efficient way to do all the above using JQuery or Drupal, I’d love to hear it.

August 8th, 2014  | Categories: Drupal, Drupal 7

So I want to create a carousel on the homepage of a website. The carousel items should be their own content type. Two of the carousel items need to generate a random publication and a random study (both content types). These can be generated by creating a View for both. I need to call this view though inside the carousel item content type.

I used the module_invoke method like this inside the body of the node (using the PHP filter):


$block = module_invoke(‘views’, ‘block_view’, ‘studies-block_1’);
print render($block);


It outputted the content great. Exactly what I wanted it to do. However, it generated the following errors:

Warning: Invalid argument supplied for foreach() in element_children() (line 6428 of C:\xampp\htdocs\drupal_project\includes\common.inc).
Warning: Illegal string offset ‘#children’ in drupal_render() (line 5893 of C:\xampp\htdocs\drupal_project\includes\common.inc).
Warning: Illegal string offset ‘#children’ in drupal_render() (line 5903 of C:\xampp\htdocs\drupal_project\includes\common.inc).
Warning: Illegal string offset ‘#children’ in drupal_render() (line 5941 of C:\xampp\htdocs\drupal_project\includes\common.inc).
Warning: Illegal string offset ‘#printed’ in drupal_render() (line 5948 of C:\xampp\htdocs\drupal_project\includes\common.inc).

Apparently these kinds of errors are very difficult to track down. It usually means some third-party module has passed in something wrong to one of Drupal’s common functions.

Since I’m using the render function from Drupal 7, I decided to output what the $block would be. It’s an array. As I’m already using PHP inside a block, what’s the harm in using some more? I just needed the first part of the array…


$block = module_invoke(‘views’, ‘block_view’, ‘studies-block_1’);


Very handy to know the module_invoke function to call specific blocks so you can include them in your content without having to put them into the structure… however it does make the content harder to maintain as you’ll have to remember where you’re calling the blocks.

July 1st, 2014  | Categories: Drupal, Drupal 7, MS IE

I’m using HTML5 in my theme. I want older browsers (ie, IE) to recognize some of the new tags such as header, footer, etc. Google has a shiv out there you can download. I use this on like all my sites.

You can link to it directly but I want the print shiv as well… I’m not sure where they keep that so you can directly link to it.

I’m a novice at Drupal 7 and they’ve changed a bunch since Drupal 6. The JavaScript calls are different. Also these JS files are a little unique as I want to put them in an less than IE9 comment.

After playing around with getting the URL to the theme, having that not work exactly since I’m working on a local environment, I got the function calls I needed to link to the /javascript/ folder I created in the theme where the shivs will go.

I modified the html.tpl.php file which is in the themes folder. I added the following two lines of code which go to the two shivs:

<!--[if lt IE 9]><script src="<?= base_path().path_to_theme(); ?>/javascript/html5shiv.js"></script><![endif]-->
<!--[if lt IE 9]><script src="<?= base_path().path_to_theme(); ?>/javascript/html5shiv-printshiv.js"></script><![endif]-->

If there’s another way, I’d like to know. I’m sure there’s a module out there you can download to get the HTML5 support like a shiv, but I think linking to the shivs is a lot easier.

May 22nd, 2014  | Categories: MS Windows 7

I recently got a new computer at work. After installing everything I had and configuring it the way it was before, I noticed that I didn’t have the option to create a new text document on right click.

I used this feature multiple times a day. I had to figure out how to get it back. My current menu on right click looked like this:

Right Click spawned menu without an option for a New Text Document

After digging around online for a bit, I saw you needed to modify your registry keys in Windows 7 to get the option. I don’t work very much with the registery. Oh who am I kidding, I have worked very little with the Windows registery.

A few forumns in the google search “windows 7 new text document on right click” lead me to the right idea.

I first had to get into the registry. To do this, I went to Start and typed “regedit.exe” into the search field.

From start, type regedit into the search field

There I navigated to Computer –> HKEY_CLASSES_ROOT –> .txt . I double clicked on the (Default) and instead of what it was before, I put “txtfile”.

Type in txtfile for the Value data for the (Default)

No restart necessary. I now have the ability to create a new text document when I right click.

When right clicking, I have the option to create a new text document

January 22nd, 2014  | Categories: CSS, Mozilla Firefox, MS IE

I need to put content after a very specific float. There are a few floats going on in the banner of one of our websites. The first float is handling the left/right content. The other float is inside the right content and handling the alignment of the search and submit buttons.

We now want text to go underneath the search and submit button. The problem is just putting the text under these elements, it doesn’t leave much room for spacing:
there is no spacing after the search and submit button

Furthermore, it looks awful in IE:

The search and submit buttons move down and the rest of the content is towards the bottom

After trying to add a margin on almost everything in the box (which did not work), I added a height to the search area. The below content knows that it’s not big enough to fit in there so it breaks.

I could then give the search div a padding of 3px on the top and bottom. Now it looks nice in all browsers:

The text at the bottom has space away from the search field

June 18th, 2013  | Categories: CSS, Google Chrome, IPad/IPhone

I’ve run into this issue a lot in Chrome since our site likes to use URLs for link text. Not a good practice in my opinion but whatever. The issue is when the URL is so long, the text cannot be broken.

Long URL Causing Overflow

This issue also happens on mobile devices. It will cause an overflow which makes the text run over causing a horizontal scroll, which is never good.

Using just word-wrap: break-word sometimes doesn’t work in Chrome for some reason. I found that adding a max-width in whatever the container the long text is in will work. For example, my new CSS is:

ul.material_content_list li ul.blank_list li {
max-width:                    470px;
word-wrap:                    break-word;

Now the page looks fine:

URL Properly Broken & Not Overflowing

March 28th, 2013  | Categories: .NET, C#, MS SharePoint

I needed to find the default or “welcome page” of a SharePoint site. I needed this because I need to pass in a query string parameter to it. For example, if I passed in the string “http://www.mysite.com/staff”, it would give me “Pages/index.aspx”.

After surfing the net, the threads I read on Microsoft and other sites were not helpful at all. Most lead me to complex lines of code that used different utilities that I wasn’t familiar with. (I’m not that familiar with this stuff as it is.)

I finally decided to ask the question on stackoverflow. My question was How do I get the default/welcome page of a SharePoint 2010 site?.

In a few minutes, a dude answered with a link to a thread on Microsoft. It was pretty helpful although it wasn’t complete as it gave me a few errors:

  • First it gave me an unrecognizable PublishingWeb. To solve that, I had to add the Microsoft.SharePoint.Publishing reference to the web part.
  • Second it gave me a cannot convert type SPFile to string. Trying .toString() didn’t work. Turns out SPFile has a Url function which returns a string.

The finished function is:

private string GetSPSiteUrl(string u) {
	string siteurl = "";

	using (SPSite site = new SPSite(u)) {
		using (SPWeb web = site.OpenWeb()) {

			if (PublishingWeb.IsPublishingWeb(web)) {
				siteurl = PublishingWeb.GetPublishingWeb(web).DefaultPage.Url;
			else {
				siteurl = web.RootFolder.WelcomePage;

	return siteurl;

As it turns out, this code works for sites that have permissions. Since our site is anonymous access, it gives an NT prompt.

The way to fix this issue is to add RunWithElevatedPrivileges.

private string GetSPSiteUrl(string u) {
	string siteurl = "";

	// run this code with elevated privileges
	SPSecurity.RunWithElevatedPrivileges(delegate() {

		using (SPSite site = new SPSite(u)) {
			using (SPWeb web = site.OpenWeb()) {

				// get the default page
                        	if (PublishingWeb.IsPublishingWeb(web)) {
					siteurl = PublishingWeb.GetPublishingWeb(web).DefaultPage.Url;
				else {
					siteurl = web.RootFolder.WelcomePage;

	return siteurl;
October 12th, 2012  | Categories: CSS, IPad/IPhone


This one had me tripped up for a bit but I already knew the problem. Background colors get cut off sometimes in the Ipad when the width is too big for it. When you scroll over, the background color of the div isn’t there and it’s the background color of the page.

Here’s a screen shot from ipadpeek.com (which is an awesome site to test your site on):

IPad Screen Shot With Part Of Background Cut Off When Scrolling To The Right

I tried googling of course. I found a few forums that had the same issue.

It didn’t take long to reach a forum where someone had solved the IPad problem on stackoverflow.

I added a min-width of 1000px to my main block and that fixed it.