Archive for category Sundry

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.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter
No Comments

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.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter
No Comments

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.
Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter
No Comments

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/

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter

Tags:

No Comments

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.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter

Tags:

No Comments

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.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter

Tags:

1 Comment

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

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter
1 Comment

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 »

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter
No Comments

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.

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter
2 Comments

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.
Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • MySpace
  • RSS
  • Slashdot
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter
4 Comments