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

18Mar/100

Karole Armitage interviewed by the BBC

Karole Armitage, one of our customers, was just interviewed by BBC America; http://bit.ly/acjzSK.

Filed under: Sundry No Comments
18Mar/100

Recovering super-admin access to Joomla

If for some reason you can’t figure out the superadmin login or password, use phpMyAdmin and go into the jos_users table of your database.

Locate the superadmin user account. It will have a gid (group ID) of 25.

By default its username is admin, but the username may have been (should have been!) changed. It’s a good idea to change it, for security reasons. The “admin” username is the first one hackers will try.

Now, let’s change the password using phpMyAdmin. Edit the user using phpMyAdmin and find the password field. That is MD5-encrypted so we need to think of a new pw and MD5-encrypt it. It should look something like this example:

7da8c7fed439183092er69334b54fe01:UIBWsiwIlkk2wkHCUmC1XxD1tAd1uQgK

You need to generate a new MD5-encrypted password. Do that here:

http://www.iwebtool.com/md5

.. or Google ‘md5 encrypt’ for other similar sites.

Just enter what you want the password to be, and it will tell you the MD5 code for it. Copy that code and put that into the password field in phpMyAdmin. Save.

See if you can log into Joomla and get the full features now using the username you just edited over in phpMyAdmin.

Note that Joomla’s passwords are MD5-encrypted *and* salted, meaning that they have a colon and then a second MD5 string after that. But using an externally generated MD5 string and pasting that in will work, at least for Joomla 1.5.15.

Filed under: Sundry No Comments
11Mar/1010

Detect Joomla section ID when viewing an article

Sometimes when you’re coding a Joomla 1.5 template you may want to be know which section an article is in. For example, let’s say you have designed custom navigation buttons (not using any Joomla module, just your own graphics). If you have a button called “About Us”, you’d want it to stay activated when viewing any page in the About Us part of the site. To do this, create a section called About Us, create a category within that, and put all About pages in there. Now you can reliably detect your articles’ section IDs as a way of keeping your button activated on the correct pages.

Add this in your template PHP code;

$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() ;
}
//echo $sectionid;

Now you can use if statements like this;

if($sectionid == ’4′){
echo “this article is in section 4!”;
}

You can use this for customized navigation, for example, keeping certain buttons highlighted when you’re viewing articles within a certain section. It can be used to display a module only if you’re in a certain section, but it’s useful for more than just modules. Enjoy.

Filed under: Sundry 10 Comments
12Feb/100

New module: Random Youtube Video

download it here

Displays a random video for a specific user. Lets you set the video width and height, control whether to show a “more videos” link or not, and control the wording of that link. Also allows you to display a single YouTube video instead of a random one. It uses the Google Data API for YouTube to grab the user’s video IDs and pick one at random.

Requirements: Joomla 1.5 and Zend 1.9+ (supported by most Apache servers). This has been tested on a LAMP machine (Linux/Apache) but in some cases – Windows servers, perhaps, or if your host doesn’t allow PHP scripts to use the ini_set() function – it may be necessary to manually set the include_path directive in your php.ini to something like ‘include_path = ..:/usr/lib/php:/home/account/public_html/modules/mod_randomyoutube/Zend/library’.

The above assumes your php.ini include_path is /usr/lib/php, but that will be different for every server, so check phpinfo() for that. In the Joomla backend, go to Help > System Info, PHP Information.

Filed under: Sundry No Comments
24Jan/100

Detecting Itemid for a component

A little background: while working on the EventList Twitter Status plugin I got frustrated at having to have an Itemid parameter in the plugin parameters. I wanted the script to automatically append the correct Itemid to the URL that gets submitted to Twitter (via TinyURL). However, it seemed that there’s no built-in way to do this using the Joomla API – not when we’re talking about a backend script. If it were a frontend one, we could easily detect the Itemid contextually, i.e. based on which page is being viewed at the time, for example:

JRequest::getVar(‘Itemid‘);

//(detects current page’s Itemid)

Or to detect the URL of a specified menu item:

$menuitem = “34″; //this can be set manually or by your script
$item = JFactory::getApplication()->getMenu()->getItem( $menuitem );
$url = JRoute::_($item->link . ‘&Itemid=’ . $item->id);

However, the above method means that you must already know the Itemid, since the menu id *is* the Itemid. So it’s only good for detecting the URL.

So how do we find out an appropriate Itemid for URLs created on the fly in the backend?

After scouring a lot of posts on the Joomla forum and elsewhere, and also after reading all the available documentation, I got frustrated and just wrote a quick and dirty query:

$queryitemid = “SELECT * FROM #__menu WHERE type=’component’ AND link LIKE ‘%com_eventlist%view=eventlist%’ ORDER BY id ASC LIMIT 1″;
$db->setQuery($queryitemid);
$itemid = $db->loadResult();

if((!itemid) || ($itemid == ”) || ($itemid == NULL)){
//echo “resorting to backup Itemid detection<br>”;
//if default ‘eventlist’ view not found in menu, look for other menu items and use the first one (lowest itemid)

$queryitemid = “SELECT * FROM #__menu WHERE type=’component’ AND link LIKE ‘%com_eventlist%’ ORDER BY id ASC LIMIT 1″;
$db->setQuery($queryitemid);
$itemid = $db->loadResult();

}

if(($itemid != ”) && ($itemid != NULL)){
$itemid = $itemid;
}

else{
//if EventList is now in a menu, use the Itemid set in the plugin parameters.
$itemid = $this->_params->get(‘itemid’);
}

I used a LIKE query to select the “eventlist” view type for the com_eventlist component. I could have avoided use of LIKE by doing a more complex query, and I’m not sure it would have offered much of a performance gain over this LIKE usage. Maybe if this were a script that’s being run a lot, but this only runs when someone adds an event or venue.

Filed under: Sundry No Comments
24Jan/102

EventList Twitter plugin v 1.5 out

Update your Twitter status when you add an event to the EventList component. Joomla 1.5 native. Comes with language translation capability and includes English and now also French. You can now add venues as well as events, and have them send a tweet. You can turn off tweets for venues, and you can format the date and time however you want. Download at http://www.plethoradesign.com/downloads/.

  • v. 1.5: added French language definitions
  • v. 1.4: added PHP date() formatting for date & time. Fixed venue addition bug, also allowed for display of venue within event tweet. Removed unused “user layer”.
  • v. 1.3: you can now display the event date and time in your tweet.
Filed under: Sundry 2 Comments
11Jan/100

Joomla EventList Twitter Plugin – version 1.3

I updated the plugin so you can now choose to display the event date and time. If there is no time specified, it uses just the date. This is *optional* so you can specify it via the plugin parameters, the same place where you put in your Twitter username and password.
http://www.plethoradesign.com/downloads/

8Jan/100

Webcam Test using Flash

I needed to test end users’ webcam video and audio for a client, and found examples of both instant webcam video playback and microphone audio playback (after the user allows access), but no examples combining the two. I put the two together in a single, simple Flash CS3 ActionScript 2 file available here.

5Jan/102

Joomla EventList Twitter plugin v 1.2 out

Some users reported file_get_contents warnings from their server. I modified the plugin to detected whether fopen wrappers are enabled, and if not, use CURL instead. If that’s not available it will simply use your site’s main URL as the event link in your tweet .. otherwise the URL will get cut off by Twitter’s 140 character limit.
Your server doesn’t support the file_get_contents function, but I think I have a solution.

Solution #1 would be to edit your site’s PHP.ini file and set this:
allow_url_fopen = On
It may currently be set to allow_url_fopen = Off, but needs to be on.

See this link for a full description of what to do;
http://www.logaholic.com/support-center/index.php?x=&mod_id=2&id=8
Note that you may need to add this line inside your /httpdocs/php.ini file as well as inside /httpdocs/administrator/php.ini, and you may need to create those php.ini files and FTP them to the server.
On some servers, a PHP.ini file is only allowed in certain locations, like /etc/ or /cgi-bin. But in most cases it should be in the folders I described.
That may fix it.

Solution #2
It means in your case the Twitter links will have to use the actual site URLs rather than TinyURL ones, but it should work.

So, in /plugins/system/eventlisttwitter.php, around line 103, find:

function _createTinyUrl($strURL) {
global $mainframe;
$tinyurl = file_get_contents(“http://tinyurl.com/api-create.php?url=”.$strURL);
return $tinyurl;
}

…. replace that with this:

function _createTinyUrl($strURL) {
global $mainframe;
if(ini_get(‘allow_url_fopen’)){
$tinyurl = file_get_contents(“http://tinyurl.com/api-create.php?url=”.$strURL);
return $tinyurl;
}
elseif(1==3){
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,’http://tinyurl.com/api-create.php?url=’.$strURL);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
else{
return JURI::base();
}
}

If modifying the code is too daunting, uninstall and then reinstall the plugin, using the attached plugin zip file. It’s also on my site at http://www.plethoradesign.com/downloads/.
The above modified code should work for you even without touching php.ini, so it may actually be the easiest solution. If your host doesn’t support PHP’s CURL libraries, the Twitter link will simple link to your site, rather than the individual event. Otherwise the event URL will get cut off because of Twitter’s limit of 140 characters.

4Sep/091

EventList Venues for Google Earth KML

A Google Earth KML-exporter add-on for EventList 1.0.1 for Joomla 1.5.
It lets you provide visitors a link with which they can directly open or download a KML-format file of all your published venues, complete with venue descriptions, links (if the venue contains one), and automatic creation of markers with latitude and longitude.
That is generated from the basic address information for the venue – you do not need to enter latitude or longitude anywhere. There is just one file to upload, but make sure to read the requirements in the readme.txt file that comes with the zip file.

See it in action here: http://www.novamineralclub.org/calendar. Click on the Google Earth icon at the far right above the calendar.

Download here

Filed under: Sundry 1 Comment
11Aug/090

Let your users have their own calendars!

A Community Builder plugin that can be displayed as a tab on a user’s personal profile, so each user can have a separate calendar. The user just needs to enter the unique ID of the calendar in the plugin parameters in their profile. You can set a default calendar and time zone, and individual users can set their own time zones and calendars as well. This plugin comes with English and Dutch language files. Tested on Joomla 1.5.14 with Community Builder 1.2.1. It should work with or without legacy mode on. Should function in Joomla 1.0 too, though multilingual functionality probably will not work.

Download it here »

Filed under: Sundry No Comments
30Jul/094

EventList Twitter Status Update Plugin

I just ported the Twitter Status plugin to make it work with the EventList component. When you add an event, it gets posted to Twitter automatically. Just like the original Twitter Status plugin, you can restrict this to particular categories. Very useful for keeping people informed of upcoming events.

Version 1.0 – July 30, 2009. Joomla 1.5 native only. Comes with language translation capability, but only English is included by default. GPL / open-source.

Download it here

Special thanks to Tomasz Dobrzyński, upon whose Twitter Status plugin this was based.

Filed under: Sundry 4 Comments
28Jul/093

Events and calendars in Joomla

When building sites for customers, I have noticed people often need to announce upcoming events on their sites, and assume they need a full-page calendar displaying a month-view. However, it may in many cases be easier to display a simple list of upcoming events – even as simple as a single page, for example a regular Joomla article. This is especially true when there are not that many events in a  given month. What if you have only two events per month? Is it still sensible to devote all that screen real estate to empty calendar days? It seems more direct to just list the events and their dates in such a case. From the visitors’ point of view, they want to find out what’s coming up, so the fastest way to get them that information is the best way.

The reverse is also true. You may have so many events that it would be silly to cram them on one long page, one after the other. You may even need to set up some event categories, for example academic calendar events versus cultural events.

There are several Joomla solutions (including a couple extensions) that I have used for both ends. In order from simple to complex:

  • Simple Joomla article that is manually edited. Requires no additional customer training, but only works for small numbers of events.
  • Get a free Google Calendar and embed it. Learn to live with the lack of full control over its styling.
  • EventList extension (schlu.net). This is a great open-source extension that displays upcoming events in a very straightforward way. It also lets visitors register (though not pay for) events. With this you can offer visitors RSS feeds and iCal formats of your calendar as well. iCal (.ics) files can be imported into Microsoft Outlook and Google Calendar, and many other calendar applications. It does NOT offer a traditional month/week view except as a module, but that should be fine. Take a look at this recent calendar I did for the Brooklyn Music School.
  • JCal Pro, the aptly named Events Calendar (a.k.a. JEvents), for displaying a month, week, or more at a time. JEvents also integrates with DT Register and Community Builder to allow for paid event registrations.
  • Take a look at the calendar extensions at Joomla’s site.
Filed under: Sundry 3 Comments
8Jul/090

Rounded form elements with CSS3

Modern CSS3-compatible browsers such as Firefox and other Mozilla flavors now support rounded corners for form elements. While Internet Explorer 8 may be an improvement over 7, it still does not support the CSS3 standard as well as might be hoped for. Here is an example of what can be achieved:

Without CSS3:

With CSS3:

Note that the second textarea element has a thicker white border, different background color, and different text color. It is easily possible to assign different border colors and radiuses to different elements. It is important to set a background color, even if it is to be the same as the page background color. I have found that if you don’t, your rounded borders may not be displayed.

Sample HTML/inline CSS code:

<form>

<input style=”-moz-border-radius: 5px;-webkit-border-radius: 5px;background-color:#444;color:#fff;border: 1px solid #CCC;” name=”subject” type=”text” />

<textarea style=”-moz-border-radius: 10px;-webkit-border-radius: 10px;background-color:#222;border: 2px solid #fff;color:#fff;” name=”subject”></textarea>

<input type=”submit” value=”submit” />

</form>

Filed under: Sundry No Comments
20Jun/091

PNG fix for IE6

Designing and modifying templates (especially for Joomla) I am increasingly finding PNG’s incredibly useful because they maintain JPG quality but support transparency. Problem is (you guessed it), Internet Explorer 6 doesn’t like them. I overcome this by adding this line of CSS into my template’s HTML file’s <head></head> section – in this case a Joomla 1.5 template’s index.php file:

<!–[if lt IE 7]>
<style type=”text/css”>
img, div {
behavior: url(<?php echo JURI::base().”templates/”.$this->template; ?>/iepngfix.htc);
}
</style>
<![endif]–>

Download iepngfix.htc

I have used this successfully on numerous sites. There are actually some Joomla plugins that achieve the same thing, however I prefer retaining manual control over these things right in the template. If IE6 gives a JavaScript popup warning about DIV elements, you can try to change the above by removing the DIV from the CSS code. Reload and see if the layout has been broken or not.

Filed under: Sundry 1 Comment
17Jun/090

Upcoming art show(s) in Boston

new_leafFor those of you who will be in Boston in July, check out JP Licks in Jamaica Plain for my sister’s artwork. She lists her upcoming shows and past shows on her site. Hers is also a site I recently converted to Joomla.

17Jun/090

Armitage Gone Dance Think Punk Videos & photos

Lou Reed, Laurie Anderson, and Karole Armitage

Lou Reed, Laurie Anderson, and Karole Armitage

In 2006 I designed a brand-new (and, incidentally, award-winning) site for a New York dance company called called Armitage Gone! Dance. At that time it was designed using Dreamweaver templates, and it was maintained using Adobe Contribute. I recently converted it to Joomla.

Check out the new video and photos of Armitage Gone Dance’s 2009 Think Punk event. Among those in attendance were Lou Reed, Calvin Klein, David Salle, Karole Armitage, Jeff Koons, and Rufus Wainwright. I like to follow my customers’ growth, and hold out hopes of being invited so I can get to meet some of these people … if you’re reading, Lou, contact me.