9

The Race Track

I spent some time at the High Plains Raceway in September. The event was an MCCA – CECA open model event. The cars were pretty crazy, so I took some pics. Click here to see all the pics and a couple short vids.

vBulletin: Remove Post Title if it’s Blank

Here’s another good code snippet. vBulletin allows for post titles, but users very rarely actually use this. Thing is, vBulletin displays the post title area even if there’s not one set. You wind up with what looks like either a signature out of place or a missing bit of text. I decided to remove this, but wasn’t able to find anywhere online where folks had mentioned how to. It’s fairly easy

In the postbit_legacy template, find the following code:

<vb:if condition="$post['title'] OR $show['messageicon']">
    <h2 class="title icon">
    <vb:if condition="$show['messageicon']"><img src="{vb:raw post.iconpath}" alt="{vb:raw post.icontitle}" /></vb:if>{vb:raw post.title}</h2>
  </vb:if>

and replace it with:

<vb:if condition="$post['title']==''"><vb:else />
  <vb:if condition="$post['title'] OR $show['messageicon']">
    <h2 class="title icon">
    <vb:if condition="$show['messageicon']"><img src="{vb:raw post.iconpath}" alt="{vb:raw post.icontitle}" /></vb:if>{vb:raw post.title}</h2>
  </vb:if>
</vb:if>

That’s it! All we’re doing is adding an additional if around the existing one, saying “if the post title == ” (nothing), don’t display the post title area.”

Nice Web Author Resources

Nice page of some web resources for folks who make sites.

vBulletin: How to Include Facebook / Twitter / Google Plus in vBCMS with vBSEO Installed

The ModMy sites run on vBulletin, and we use vBSEO for our SEO tool. Beginning in vBulletin 4.+, vBulletin has had a built in CMS called vBCMS for posting articles. Before that most people used vBAdvanced or WordPress for vBulletin 3.x installs.

After moving to vBCMS for our articles, we discovered we could no longer get social sharing buttons (like Facebook, Twitter, Google Plus, Digg, etc) to work on the front page. Because we use vBSEO (which rewrites URLs server-side through PHP) and the button codes are all in JavaScript (which is client-side), attempting to use vBulletin’s standard {vb:raw page_url} was returning the standard vBulletin URL, not the correct vBSEO’d URL. I asked for help at vBSEO.com multiple times, but they simply told me they don’t support vBCMS (great – that’s ALL our articles). I finally found a solution which I thought I’d share here as I’m sure others are looking for it. So here’s what I did to fix this.

I created a plugin and called it vbseod url.

The product was vBulletin, hook location is vbcms_article_populate_end. Execution order I set at 5. The following was the plugin code that eventually worked:

$replace_forvbseo = array('http://modmyi.com','http://www.modmyi.com','content.php?r=','.');
$replace_withvbseo= array('','','','-');

$replace_forvbseo2 = array('-as-','-of-','-in-','-is-','-an-','-and-','-with-','-for-','-to-','-this-','-from-','-by-','-a-','-on-','-the-','-at-','-be-','(',')','*');
$replace_withvbseo2 = array('-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','','','');

$view->page_url_vbseo = str_replace($replace_forvbseo2,$replace_withvbseo2,strtolower($vbulletin->options['bburl'] . '/content' . (str_replace($replace_forvbseo,$replace_withvbseo,($view->page_url))) . '.html'));

This creates a variable you can use in vBCMS called page_url_vbseo. You can of course set that to whatever you’d like, that’s just what I used. You’ll also need to change where I have http://modmyi.com and http://www.modmyi.com to your domain.

For some reason simply using the $replace_withvbseo wasn’t working for CMS articles, so I had to add in some manual stuff. I think I have the majority of them replaced (see $replace_forvbseo2 where I have listed the words I’ve found which still needed to be removed). If you need to add to those, you’ll have to add them in that line.

Then I had a nice variable working which I could put in my templates anywhere by adding {vb:raw page_url_vbseo}.

For instance, in my site, I decided to put Twitter, Facebook, and Google Plus on the homepage as options, so used this code:

<div id="share" style="margin: 3px 0 3px 0;"><a class="twitter-share-button" href="http://twitter.com/share" data-text="Nice article -" data-url="{vb:raw page_url_vbseo}" data-count="horizontal" data-via="modmyi">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><script type="text/javascript">// <![CDATA[
      (function() {     var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;     po.src = 'https://apis.google.com/js/plusone.js';     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);   })();
// ]]></script>
<script type="text/javascript">// <![CDATA[
    (function(d){   var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}   js = d.createElement('script'); js.id = id; js.async = true;   js.src = "//connect.facebook.net/en_US/all.js#appId=246181135426205&xfbml=1";   d.getElementsByTagName('head')[0].appendChild(js); }(document));
// ]]></script></div>

That may change as each platform adjusts their button codes, but it’s just the individual button codes (Google any buttons you’d like to get their code). Notice in there where I have put the {vb:raw page_url_vbseo} code. The correct vBulletin template to make these changes in is vbcms_content_article_preview. To have the buttons appear under the main title of each article like we do on ModMyi.com, insert the share code I just pasted under the following code in the  vbcms_content_article_preview template:

<vb:if condition="$showtitle">
	<div class="title">
		<h3 class="article_preview">
			<a style="color: black;" href="{vb:raw page_url}"><span>{vb:raw title}</span></a> 
		<vb:if condition="$can_edit">
			<a class="edit" href="{vb:raw edit_url}">
			<img class="editimage" src="{vb:stylevar imgdir_cms}/edit_small.png" alt="{vb:rawphrase edit}" />
			</a>
		</vb:if>
		</h3>
	</div>
	</vb:if>

Make sure when you get your button code you tell it NOT to use the URL it’s on, but a custom URL. Then replace it with the above bold code, and that’s how I got the correct code from the large block above.

There you have it!

Tampa Bay Bucs get iPads for Playbooks

No Off Switch Logo

No Off Switch Productions

Just finished a new logo and simple site redesign for my friend AJ Hurley over at No Off Switch Productions. No Off Switch Productions does videography and photography, and is based in the Tampa area.

Steve Jobs Retires

From all of us at ModMyi.com, we’ll miss you as Apple CEO, Steve Jobs. Best of luck in your next chapter.

bummer

bummer

I decided to finally spend more time on this blog. The site has been updated, and I’ll be posting here instead of Facebook or Twitter now, with content then linking back to various social networks. We’ll see how that goes.

The Ezra Matthews Story

The Ezra Matthews Story summary video was shot and edited by a friend who’s family by now, AJ Hurley. We’re grateful for the memories.