Virginia Web Designers: Joomla, Drupal, Open-Source, CSS, and PHP Northern Virginia / Maryland / Washington DC web designers

10Dec/110

Forcing Moodle admins to use English but regular users use another language

Add this to your theme’s PHP pages wherever you want this functionality. Add it above the <html> tag … in our case we force regular users to see the site in Farsi, but admin users see it in English. We also hid the language menu (comment out “echo $OUTPUT->lang_menu();”).

Here’s the code:

<?php

function curPageURL() {
 $pageURL = 'http';
 //if ($_SERVER["HTTPS"] == "on") {
 if ($_SERVER["SERVER_PORT"] != "80") {
	 $pageURL .= "s";
 }//other way to detect SSL??
 $pageURL .= "://";
	 if ($_SERVER["SERVER_PORT"] != "80") {
	  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
	 } else {
	  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
	 }
 return $pageURL;
}
$url = curPageURL();
$admins = get_admins();
    $isadmin = false;
    foreach ($admins as $admin) {
        if ($USER->id == $admin->id) {
            $isadmin = true;
            break;
        }
    }
    if ($isadmin) {
		if(
		!isset($_GET['lang']) ||
		(isset($_GET['lang']) && ($_GET['lang'] != 'en'))
		){
			if(strstr(curPageURL(),'lang=fa')){//if not home page
				$url = str_replace('lang=fa','lang=en',$url);
        		header('Location: '.$url);
			}
			else{//URL must not have an = in it, therefore it has GET vars and has a ? as well. It is possible to have a ? without ='s though, so we check for = and not ?.
				///header('Location: '.curPageURL().'?lang=en');
			}
		}
    } else {
        if(
		!isset($_GET['lang']) ||
		(isset($_GET['lang']) && ($_GET['lang'] != 'fa'))
		){
			if(strstr(curPageURL(),'=')){//if not home page
				$url = str_replace('lang=en','lang=fa',$url);
        		//header('Location: '.$url);
			}
			else{//URL must have an = in it, therefore it has GET vars and has a ? as well. It is possible to have a ? without ='s though, so we check for = and not ?.
				//header('Location: '.curPageURL().'?lang=fa');
			}
		}

?>

12Sep/110

Front Page Slideshow Link Problem

FPSS is a great slideshow addon for Joomla, Drupal, and standalone slideshows.
They have a new version for Joomla 1.7, with a much improved interface. When it comes to linking slides, it seems you can choose to display links for all slides, or not. But what if you want links on some slides but not others? In such a case, if the user did not supply a URL, the link will say “http://www.yoursite.com/URL”. You could enter “#” or “javascript:;” as the URL, but one cannot expect non web developers to remember to do this. The user should not be required to take additional action just to NOT link a slide.

We wrote a quick fix for this. Open up the default.php template file for the FPSS layout you’re using. We used JJ-Oobs so we opened up /modules/mod_fpss/tmpl/JJ-Obs/default.php. Right after “foreach($slides as $slide):” insert the following

if($slide->link == 'URL'){
$slide->link = 'javascript:;';
}

We used a “javascript:;” URL rather than “#” because this way if you slideshow is far down the page, clicking it will not take you back to the top of the page … using “#” can conflict with named anchors but “javascript:;” does not.




2Apr/110

Buh-bye, IE6

Microsoft now officially seeks to persuade people to stop using Internet Explorer 6:

http://www.theie6countdown.com/

Filed under: Sundry No Comments
1Apr/110

Gmail Motion looks great!

Check out Gmail Motion – allowing you to manage Gmail with body language!

Filed under: Sundry No Comments
29Dec/100

Update your Facebook status with Twitter

A very handy feature of Facebook and Twitter is the ability to link the two, so that when you post a tweet, it will automatically get posted to Facebook too.

Here’s how:

  1. Sign up for Twitter and Facebooks accounts (in case you’ve been living under a rock the past decade).
  2. Log in to your Facebook account and then visit http://apps.facebook.com/twitter/. It will walk you through the setup.

If you use or are considering using Joomla, check out Autotweet NG, which can send a tweet every time a Joomla article or K2 item is added. We have used this with K2, and the only complaint / bug worth mentioning is that copying a K2 item does not seem to create a tweet .. you have to create a NEW item and save it. Autotweet NG also offers a commercial version which has some pretty advanced Facebook integration (including posting images from K2), but if you just want text, the Facebook Twitter app will probably be just fine.

WordPress also offers a number of plugins that can send a tweet upon for each new post, or that can display your Twitter status as a widget. We use Twitter Tools.

28Dec/102

Joomla / K2; disabling modal image popups on some items

We are in the middle of designing a new version of plethoradesign.com using Joomla and K2. Most images in our web design portfolio have a large version that can be clicked and enlarged, but in some cases this was not desirable; for example for logos. There was no way to turn off this feature (not easily anyway), so it was time to add this option to K2.

Thanks to a post over at the K2 Forums, we customized our K2 installation so it is now possible to turn off the popup modal link on an item-by-item basis.

Download: k2-item-image-link-option.zip

Changed files;
administrator/com_k2/models/item.xml
components/com_k2/templates/default/item.php

The code in item.php is set up so items will show popup links on images by default, but if the item options have been set to disable the popup, it will not be linked.

Filed under: Sundry 2 Comments
17Dec/100

E-commerce and “just-in-time” shipping

I recently ordered something from Barnes and Noble’s site, only to be notified the item was not available and I would have to wait. So I did. I was then notified I would need to wait another 30 days (I was given the option to cancel). I opted to wait, because it’s a somewhat rare item and BN carries it a significant discount.

I’m glad they provided the option to cancel, but what is the point of ordering online when I may have to wait up to a month and who knows, longer?

Clearly BN either does not track how many items they have in stock, or they do not care, and will try to fulfill the order once they have collected payment. This follows the philosophy of “money now is always better than money later” – which I would tend to agree with, but it’s not good when this alienates customers. A 30-day wait during the holiday season is unacceptable! In my case it was for a birthday, which has already passed.

JIT (Just-in-time) is great and has worked well for Toyota, but the customer should not be forgotten in all of this.

Tagged as: No Comments
15Dec/100

Joomla 1.6 RC1 Now Available

Joomla has finally announced the first release candidate of Joomla 1.6. The final release is due January 11, 2011, with no current plans for a second release candidate. So, the end (of 1.5) is near!

Filed under: Sundry No Comments
12Nov/101

Stop Skype plugin from messing up your phone numbers!

Ever see a phone number get all messed up by the Skype plugin for Firefox and Internet Explorer? It’s annoying. You’re thinking “I’ll just add this phone number, save the page / module / block / whatever” and be done with it, but you’d be wrong. Many Skype users unwittingly see many phone numbers displayed as clickable Skype links that let them place a call directly to that number.

You can stop this from happening in a couple ways:

  • You could make the phone number a graphic
  • Insert some hidden code into the phone number that prevents the Skype plugin from detecting it as a phone number.

Example

Before:

Phone: (555) 123-4567

After:

Phone: (555)&lt;span style="display: none;"&gt;.&lt;/span&gt; 123-4567

The hidden period is enough to stop the Skype plugin from workings its magic / evil. This technique was tested using Joomla but will work anywhere.

Filed under: Sundry 1 Comment
12Oct/100

EventList Twitter now supports Bit.ly

Twitter is taking its sweet time rolling out their t.co URL shortening, so I added bit.ly support to our Joomla EventList Twitter status plugin (more details).

Filed under: Sundry No Comments
8Oct/100

Phoca Download CB Plugin

A Community Builder plugin for Joomla 1.5 that displays a user’s files. If the user is viewing his/her own profile, the user can also delete the file from the frontend, which is not yet supported officially by Phoca Download itself!  Download it here

Filed under: Sundry No Comments
11Jul/100

Easy tab highlighting with included PHP menu

I recently reworked a simple PHP site that uses standalone PHP files containing only HTML. We needed to redesign the navigation bar, which was simple a series of clickable images. These files were not generated by a Dreamweaver template or anything like that, meaning that we would have had to manually change each file every time there was a change to the menu. That seemed very annoying to me, so I created a file called navbar.php and included it into all the pages, using the standard PHP include;

<?php include(‘navbar.php’);?>

The tabs are highlighted for the current page, so if you are on “About Us”, the About Us tab should be highlighted. To accomplish this, I wrote a simple function;

<?php
function isactive($filename){
$urlfilename = basename($_SERVER['SCRIPT_FILENAME']);
if($filename == $urlfilename){
echo “-hover”;
}
}
?>

A sample navigation tab would then look like this;

<a href=”consulting.php”><img src=”images/navbar-consulting<?php isactive(‘consulting.php’);?>.gif” name=”consulting” width=”104″ height=”35″ border=”0″ id=”consulting” onmouseover=”MM_swapImage(‘consulting’,”,’images/navbar-consulting-hover.gif’,1)” onmouseout=”MM_swapImgRestore()” /></a>

That simply uses the function to tell it which file name to match to the current page’s file name:

isactive(‘consulting.php’);

The end result is that on consulting.php, the HTML output for that tab would look like this:

<a href=”consulting.php”><img src=”images/navbar-consulting-hover.gif” name=”consulting” width=”104″ height=”35″ border=”0″ id=”consulting” onmouseover=”MM_swapImage(‘consulting’,”,’images/navbar-consulting-hover.gif’,1)” onmouseout=”MM_swapImgRestore()” /></a>

.. and that is done automatically using a single included file.


Filed under: Sundry No Comments
6Jul/100

please vote for EXIHT in Afric…

please vote for EXIHT in Africa.. an anti human trafficking nonprofit. Your vote will help with their funding: http://bit.ly/d3p5Ip

Filed under: Sundry No Comments
28Jun/100

Using MySQL to insert missing text depending on field length

Suppose you have a MySQL database table containing US 5-digit zip codes, except some of them are just three or four digits long because they had leading zeros, and those sometimes get dropped. Here’s how to add them back in;

For 3-digit zip codes:

UPDATE zipcodes SET zip = CONCAT(’00′, zip) WHERE LENGTH(zip) = 3

This will turn ’123′ into ’00123′.

For 4-digit zip codes:

UPDATE zipcodes SET zip = CONCAT(’0′, zip) WHERE LENGTH(zip) = 4

This will turn ’1234′ into ’01234′.

Filed under: Sundry No Comments
25Jun/100

Impressions of Joomla 1.6 Beta 3

Well, Joomla came out with another 1.6 beta, and it has certainly come a long way. I remember testing a 1.6 beta two years ago. Here are some highlights;

Access Level Control (ACL)

It now features a robust ACL system, though some of the inheritance rules will take some getting used to. This is often cited as a feature Drupal has and Joomla lacks, but soon enough that will be a moot point. From my understanding there will be just one more beta in about two weeks, and then it should be time for 1.6!

Nested categories

Joomla always suffered from a rigid approach to categorization, with Sections and Categories. A section could contain categories, but there could be no sub-categories. This long-running annoyance has finally been been vanquished with Joomla 1.6. It uses only categories (no more sections!), and they can be nested as deeply as you want. I’m sure at some point someone will nest a category 666 levels down, and run into a terrible bug there … but in theory it should be fine, because a category would simply be assigned to a parent category .. the number of sub-levels should have no bearing on it.

Drupal has of course supported nested categories for a long time, where they are called Taxonomy. I think Drupal’s Taxonomy is still more advanced than Joomla 1.6′s category system, but for many, perhaps most users, just having nested categories is en0ugh. Those who want to do more advance PHP magic will naturally be more inclined towards Drupal anyway, and to words like Taxonomy.

The elimination of Joomla’s sections does mean that template code that relies on section IDs will have to be changed to be 1.6-compatible. It will have to check for category IDs instead. It also opens up an interesting possibility of (for example) using a database query to select only those categories that are nested within the current category. That could come in handy in displaying category ‘blogs’ or headlines in a more automated fashion than creating menu links. And speaking of menu links;

Menu Management

Joomla’s menu management has gotten very slick;

  • Changing the menu type is now faster.
  • Much more control over the menu items: meta data, page titles, robot rules, page class styling,  menu link title & CSS attributes.
  • Module assignment from a menu item. You can still assign modules to menu items, but now you can also do this from the menu item itself, rather than having to edit the module separately.
  • Batch processing multiple menu items
  • Language filtering; show your menu item only for certain languages, or for all of them. Would be nice if you could select several languages and hide it on others, but that may be coming.
  • Set template style

Redirect manager

Joomla 1.6 has a new component for managing URL redirects. Presumably this writes to the .htaccess file and created a 301 redirect.

Banner Manager

This is not too different from the 1.5 version, but features “Tracks”, which tracks clicks and impressions in date-filterable and CSV-exportable fashion. Finally we will be able to do some more robust reporting.

I am however baffled that banner clients still have no way to log in and view their banner’s statistics. I think most clients would want that, and offering that ability will help site owners gain more advertisers.

I wrote a Joomla 1.5 hack that got around this by using the “alias” field of the banner client to hold a username. That allows us to associate a banner client with a username, and then we can use that to display banner statistics to a given Joomla user (and only that user). Looks like I will have to port that hack to 1.6. Sigh.

24Jun/103

loving @freshbooks for my invo…

loving @freshbooks for my invoicing. http://bit.ly/aGjNTp

Filed under: Sundry 3 Comments
16Jun/100

Freshbooks and time management

FreshBooks is a great tool for managing and monitoring time spent on projects. That helps make you more efficient and profitable. We have been using it for nearly two months, and it has worked wonders for us in terms of time tracking and invoicing. We highly recommend it.

It’s a wonderful invoicing tool, offering smooth integration with Basecamp, online payment for your customers, and even snail mail for those times you need to mail an invoice the old-fashioned way. Using Authorize.net you can also set up recurring payments.

16Jun/100

Monitoring Joomla for file changes

It is often desirable to monitor a site for file changes, so that you can be alerted to unwanted file changes. Those could indicate hacker activity. There is server-side software that can do this for sites, but since our focus is Joomla, we wanted to take a moment to recommend the Eyesite component: http://extensions.lesarbresdesign.info/eyesite. To get the most out of this, you will need to set up a cron job so that it will email you whenever there are outstanding file changes.

Filed under: Sundry No Comments
1Jun/100

Find Joomla section ID for article or category

Sometimes when coding a Joomla template it may be handy to know the section ID of the article or category the user is viewing.

Here is some PHP code you could insert in your template to achieve this (for Joomla 1.5);

$db =& JFactory::getDBO();
if(JRequest::getVar(‘view’)==’article’){
$query = “SELECT sectionid FROM #__content WHERE id=’”.JRequest::getVar(‘id’).”‘”;
$db->setQuery($query);
$sectionid = $db->loadResult();
}
if(JRequest::getVar(‘view’)==’category’){
$query = “SELECT sectionid FROM #__content WHERE catid=’”.JRequest::getVar(‘id’).”‘”;
$db->setQuery($query);
$sectionid = $db->loadResult();
}

Using this, you could for example control which graphics or CSS file are loaded depending on the section of the article/category.

Filed under: Sundry No Comments
18May/100

Skype “Call Me” button – no SSL support!!

To my dismay and total surprise, Skype does not offer an SSL version of its Call Me or Status buttons (link). I emailed them about this and they confirmed that it is not possible at this time, but that they would keep it in mind as a feature request. To me this is not a feature, but a basic must-have. HTTPS connections are a staple and a fact of life that should not have been overlooked. It should not be complicated to enable that, but considering that they have been in business for seven years, perhaps there is some fundamental roadblock preventing this.

Google Analytics uses JavaScript to determine whether the connection uses HTTP or HTTPS. Skype also uses an external JavaScript file, but forcibly loads it over HTTP, which is a problem for sites running on an HTTPS connection (SSL), because it will trigger “mixed content” and “potentially unsafe” content warnings in some browsers, depending on visitors’ browser settings. That can reduce customer trust, which in turn can have an impact on online sales or user stickiness.

If you need to use Skype buttons on a site that is accessed over SSL, beware.

Tagged as: , , , No Comments
14May/100

Basecamp & project management

We’ve recently started using Basecamp for project management and love it. It lacks robust user access level control, but this is not a must-have for us at the moment. The software makes it very easy to track tasks, comment on them, attach files, set milestones, and so forth. While using it I did notice a usability issue related to the commenting system. Normally, new comments are highlighted with a green icon. However, the system was highlighting even your own comments – if they were new.  Now, why would I want to re-read my own comment? I’m only interested in new comments by others!

Thankfully, I let Basecamp staff know about this usability glitch, and the VERY NEXT DAY they had resolved it! It’s nice to see that kind of responsiveness.

14May/100

Joined the local chamber of commerce!

We’ve joined the Loudoun County Chamber of Commerce (northern Virginia / metro DC). We hope to get involved in some committees and start attending networking events. This seems like a great way to meet other local business owners and cross-pollenate, besides the obvious benefit of lead generation.

Filed under: Sundry No Comments
13May/102

Spec work and 99designs.com

99designs.com is a crowd-sourcing method for generating web and graphic designs quickly. It is also fairly cost-effective.

99designs.com has some things going for it that are attractive to customers, but I’m a little concerned about how they have designers competing. I wonder what kind of pay the designers get, and where they’re based. My understanding is the designers don’t get paid unless their design won the “contest”. This is spec work, which undermines and devalues this industry in my opinion. Why work with a disgruntled designer or one that doesn’t respect him or herself?

For example, to post a project, a client would pay a flat fee of $39, which should ward off frivolous project requests, and the winner of the design contest would be awarded the project budget via escrow. The trouble I have with this is that the final budgets, while reasonable for one designer (if on the low end), do not pay the “losers” of the design contest. I think this is wrong. In essence, 99designs.com is a competitor to elance.com and odesk.com, but presents its projects as design “contests” when in fact it is a way for clients to procure designs without needing bids. It’s spec work. I don’t think anyone should work for free, even the ones that lose the contest.

While a client might get a bunch of design options for little money this way, this process cut out the whole discovery phase of the project. For example, as a client you might want a new header and logo for your site. You can request this and receive many responses, and there’s a good chance one of them will strike your fancy. Normally there would be at least a small phase of getting to know the customer, their needs, business model, etc. That is entirely missing in the 99designs.com model. It might work in the end, but it’s exploitative. In some cases, designers on there are even under 18 (reference).

It’s a freelance marketplace masquerading as design contests … for little or no pay, and using child labor.

Filed under: Sundry 2 Comments
12May/100

building new company site in D…

building new company site in Drupal. Got mockups done, and functionality already in place. Joined the local Chamber of Commerce too.

Filed under: Sundry No Comments
12May/100

waiting for Android 2 for Moto…

waiting for Android 2 for Motorola Cliq XT for speech to text emailing

Filed under: Sundry No Comments
8May/100

Capture traffic with Google Local

If your business has a physical location that customers can visit, consider getting listed in Google Local. It helps your site get valuable search engine traffic at no extra cost. I have even seen cases of businesses using this to replace their PPC campaign (AdWords).

Of course, there are businesses out there that will use fake addresses just so they can get listed. Google verifies by mail OR by phone … and these days it is possible to order a VOIP number for any location. One can only expect that Google will stop that practice at some point. Even if they don’t, having potential customers go to a non-existent address is not going to make them very happy!

Check out Google Local. It is an underutilized part of SEO.

Filed under: Sundry No Comments
1May/101

Css’s first-child pseudo-selector

Have you ever seen news articles that display the first letter in a very large font size? On web sites this is most often achieved using a graphic. That means keeping a library of graphics for all the letters in the alphabet, which I think makes editing a little cumbersome. Luckily, CSS3 offers us the ‘first-child’ pseudo-selector.

Example;

Lorem ipsum ei cetero legendos appellantur per, indoctum iudicabit ei duo, in per ignota persius perfecto. Duo ne alii summo consequuntur, vitae suscipit gloriatur cum ei, augue atomorum vulputate ea eum. Usu eu erant mediocrem, posse bonorum voluptatum et pro. Sea iisque gubergren rationibus cu, ne mea takimata mandamus laboramus. Duo utroque sententiae interesset te, luptatum scripserit suscipiantur et pri. Dicta verear appetere vim ne, nam eu alii ridens, aeque legendos ne mei.

HTML:

<p class=”firstparagraph”>Lorem ipsum ei cetero legendos appellantur per, indoctum iudicabit ei duo, in per ignota persius perfecto. Duo ne alii summo consequuntur, vitae suscipit gloriatur cum ei, augue atomorum vulputate ea eum. Usu eu erant mediocrem, posse bonorum voluptatum et pro. Sea iisque gubergren rationibus cu, ne mea takimata mandamus laboramus. Duo utroque sententiae interesset te, luptatum scripserit suscipiantur et pri. Dicta verear appetere vim ne, nam eu alii ridens, aeque legendos ne mei.</p>

CSS:

p.firstparagraph:first-letter{

color:#000;

font-size:40pt;

line-height:35pt;

filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=../images/hIEfix.png,sizingMethod=crop); zoom:1;

text-shadow: #ccc 2px 2px 1px;

float: left;

position: relative;

padding-right:6px;

vertical-align:text-top;

}

Reference

Filed under: Sundry 1 Comment
30Apr/100

Avoid ‘Domain Registry of America’ – it’s a scam

Many of you will have received mailings from these people, which look more like a bill than a promotional mailing. They scare people into transferring their domains to them. They use some very deceptive practices, levy high fees, and are loath to issue refunds. It’s a scam. Avoid them.

Filed under: Sundry No Comments
29Apr/100

Css’s first-child pseudo-selec…

Css’s first-child pseudo-selector is great!

Filed under: Sundry No Comments
28Apr/100

Got an android phone!

Got an android phone!

Filed under: Sundry No Comments