Disable Caching On Specific View In Drupal 8

PROBLEM
I may be the only one who struggled with this for a good half hour… and in Drupal time, that’s nothing. I have a view that’s a block of a random piece of content. Unfortunately, Drupal caches everything. So how do I get it to display something random if it doesn’t display something random until the cache is refreshed in Drupal?

SOLUTION
Turns out it was easy! (It’s not easy to find the solution online, however.)

In the view, under the Advanced tab, there is Caching. Turn that to none.

That’s it! Have to remember that!

SharePoint 2013 Notes I

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">
<!--SPM:<asp:sitemappath 
    runat="server" 
    sitemapprovider="SPContentMapProvider" 
    rendercurrentnodeaslink="true" 
    nodestyle-cssclass="breadcrumbNode" 
    currentnodestyle-cssclass="breadcrumbCurrentNode" 
    rootnodestyle-cssclass="breadcrumbRootNode" 
    SkipLinkText=""/>--> 
</div>

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;
}
<!--ME:</style>-->

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

Drupal 7 Notes I

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:

drwxrwsr-x

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

Two Column List With CSS

PROBLEM
I wanted to do a list of items in two columns with a border around the list. I didn’t want to use two floated divs in order to get the look I wanted (nor tables). Also, I didn’t want to break up the list. I wanted the HTML to be simple.

I started out with some old code I found which used floats and widths on each li. However after the list I needed to do a clear so the border would go around the entire list. This clear caused problems since it cleared my other floated divs (for page layout).

Here’s the HTML I wanted to use:

<div class=”summary_container”>
<ul class=”two_column_ul”>
<li>Overview</li>
<li><a title=”Training & Education” href=””>Training & Education</a></li>
<li><a title=”Staff” href=””>Staff</a></li>
<li><a title=”Collaborators” href=””>Collaborators</a></li>
<li><a title=”Research Areas” href=””>Research Areas</a></li>
<li><a title=”Scientific Articles” href=””>Scientific Articles</a></li>
<li><a title=”Scientific Resources” href=””>Scientific Resources</a></li>
<li><a title=”Image Library” href=””>Image Library</a></li>
</ul>
<!– this is where the clear would go if necessary <div class=”clear”></div> –>
</div>

SOLUTION
After attempts at floating and clearing the float, I eventually gave up. I tried to do an inline-block on the li, which worked great in FireFox but IE choked.

The CSS I finally used was the following:

div.summary_container {
border: 1px solid #DEE6F3;
padding: 5px 5px 15px;
}

div.summary_container ul.two_column_ul {
margin: 0 0 0 20px;
padding: 0;
list-style: none;
}

div.summary_container ul.two_column_ul li {
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
*display: inline;
margin: 0;
padding: 6px 0 0 14px;
width: 220px;
}

I hope this can help someone else.

Creating Favicons

ISSUE
For a while now I’ve wondered how to get a web navigation/web icon/toolbar icon to display on my website. Most major sites now have them:

Favicon Screen Shot

FIX
After googling things like “web navigation icon”, “web toolbar icon”, “browser website icon”, I finally came across what it’s really called, a “Favicon”. Read all about them at wikipedia.

I created a small image (32×32 px) using Flash. I then uploaded it to my websites (longlivethemonkey.com, Quotes, and Jeepers) and added the following code in the htmlhead.inc (inside the <head></head> of your xHTML) file:

<link rel="icon" type="image/png" href="images/lltm_icon.png" />

So now I get a pretty little icon at the top. When you read about the Favicons in wiki, it states that since Microsoft’s IE isn’t standards complient, if you name your icon differently than what Microsoft expects it to be, it won’t show up in IE >=7 (not sure about 8). The line of code above works in Firefox, Opera, and Safari. I guess Chrome hasn’t caught up with it yet.

UPDATE 1
I figured out how to make it so IE gets it. The file needs to be a .ico file and it must go before your code for your other icon. The code is:

<link rel="shortcut icon" href="/images/lltm_icon.ico" type="image/vnd.microsoft.icon">

You can convert your PNG to a ICO here. No software necessary.

UPDATE 2
With WordPress it’s easy. In your Dashboard under Appearance go to Editor. Click on your Header file (should be header.php). Put the code as you would in a regular file, in the head. Works like a charm.