Joomla 1.5 Flash Ads with AllV…
Joomla 1.5 Flash Ads with AllVideos Reloaded http://tinyurl.com/6fubx3v
Flash Ads with Joomla’s Banner…
Flash Ads with Joomla’s Banner System http://tinyurl.com/6lxlqbb
just completed: PHUHS Football Booster Club
PHUHS Football Booster Club http://tinyurl.com/6hc79a3
Fixing Itemids for Joomla / K2's tag view
This article is about K2, which works with Joomla.
We created menu items pointing to “generic” tag views. Each tag has its own Itemid, which is fine. However, when you click on “read more” for any of the items on the generic tag page, the ‘read more’ link uses the default K2 Itemid rather than the Itemid of the current page / menu item. This does seem like a bug to me. The read more links should use the Itemids of the current page or at least the menu item that brought the viewer to that ‘read more’ link.
In our case, K2′s default Itemid is 17 (as set in the menu). We also have a menu item for a tag view, with an Itemid of 37.
The ‘read more’ URLs should have been in this format:
index.php?option=com_k2&view=itemlist&layout=generic&tag=Health%20Care&task=tag&Itemid=37
.. but were showing up as:
index.php?option=com_k2&view=itemlist&layout=generic&tag=Health%20Care&task=tag&Itemid=17
We have written a small override that solved this for us, since I could find no other way to solve this. We dislike core modifications but in this case it seemed to be the only way:
In /components/k2/models/item.php around line 62 (search for “read more link” .. it should be the first one), add this:
//mod to replace K2 Itemid with current page’s Itemid.
if(JRequest::getVar(‘Itemid’) && JRequest::getVar(‘layout’) && (JRequest::getVar(‘layout’) == ‘generic’) && JRequest::getVar(‘task’) && (JRequest::getVar(‘task’) == ‘tag’)){
//MAKE SURE TO CHANGE “Itemid=17″ TO WHATEVER ITEMID YOUR K2 USES:
$link = str_replace(‘Itemid=17′,’Itemid=’.JRequest::getInt(‘Itemid’),$link);
}
//end
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.
Conditional CSS and ASP.net themes
ASP.net themes will be default load every CSS file found inside /App_Themes/your_theme/. If you have an IE7-only CSS file in there, that too will be loaded by default. That defeats the purpose, obviously.
There are some programmatic ways of excluding sub-folders or specific files, but they are complicated, and I don’t think it should be that complicated to achieve conditional CSS. The irony is that what follows is a workaround to achieve conditional CSS using Microsoft technology, and the only reason this is needed is because Internet Explorer 6, 7, and 8 do not render pages quite according to standards (though IE8 is much, much better than the previous two). I think it’s funny that we have to use a workaround JUST to be able to render pages appropriately in Microsoft’s own browsers, using ASP.net themes.
The solution is pretty simple; don’t use the “.css” file extension. You can rename your CSS file from “ie7.css” to “ie7.css.conditional” or “ie7.css.whatever”.
Then, include it into your master page;
The above assumes the use of dynamic themes, hence the use of Page.Theme.
Downgrading from SQL Server 2008 to Express
Ever needed to downgrade from SQL Server 2008 to SQL Server 2008 Express, but ran into problems, such as application framework authentication (aspnet) problems? Try this simple fix; delete the files/folders from C:\Users\{YourUserName}\AppData\Local\Microsoft\Microsoft SQL Server Data.
This may also helps those upgrading from Express to the full-fledged SQL server. This trick was the only thing that worked for me after many hours of debugging.
I hope it helps someone!
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.
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!
ASP.net MenuItem mouseovers? Not so fast ..
I had some ASP.net 4.0 Hyperlinks and Images and tried converting them to MenuItems, but it’s not possible to set a mouseover without some REALLY clunky workarounds (see here .. and other examples as well). Also, you can’t assign an ID to a MenuItem, nor a class, so you can’t do it with CSS either. Well, you could (using CSS’s nth-child selector) … but not cross-browser. I’m a bit baffled that the MenuItems don’t take an ID, CSS class, OR mouseover easily!! It’s a very common requirement or at least a commonly used design feature / effect, and ASP.net’s been around long enough to have added this at some point!
Maybe I’m missing something obvious here .. ?
Also, since I was using images for the menu items, I needed to hide the text. I managed to hide the text from the menu items, keeping only the image. But when you edit the menu, you can no longer see the menu item names, so you may get lost when trying to edit the menu items. It isn’t ideal, especially if you need to hand the project off to a customer who wants to edit the menu on their own. Again … why the lack of elegance when .net can do so many great things otherwise? There should be a simple option to hide the text.
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)<span style="display: none;">.</span> 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.
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).
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
EventList Twitter Plugin Updated
Twitter has switched to oAuth authentication, meaning that instead of the plugin using your login and password, it will use a series of keys and secret words. It also means the old versions of the plugin will no longer work. Users should uninstall the previous version (making a note of their settings), and install the new version. Get the new 1.6 version here. (plugin version 1.6, for Joomla 1.5 … not Joomla 1.6 which is still in beta!!).
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;
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.
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
Email Links vs. web-based e-mail clients
Take a look at http://www.lunarpages.com/sales-questions/. Their “Send us your question” button is nice … but they really ought to list the email address on the page too. Clicking it will launch your default e-mail program, even if you don’t use one. For many people that means it will try to open Windows Mail, Outlook, or Thunderbird, even if they only use Gmail or Hotmail.
Not everyone uses Outlook, Thunderbird, etc (e-mail clients), and assuming that can cost you potential leads and business.
Someone who uses only web-based e-mail will want to be able to quickly copy and paste the e-mail address. Now, you can of course right-click and copy the link address, but then you still have to remove the “mailto:” part. Why put your visitors through so much unnecessary trouble if you really want them to contact you?
There are some valid concerns about attracting spam, but those can be mostly overcome using JavaScript cloaking. I think it would be preferable to receive some spam AND more e-mails from your site visitors, than it would be to receive less spam and fewer e-mails from your site visitors, but maybe it’s just me.
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′.
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.
Client login for Joomla 1.5 banner component
For the longest time I have been frustrated that the standard banner component doesn’t let banner clients login and view theirbanner statistics. I had been using OpenX but it is a resource hog and is really overkill when all I want is to be able to show a client how many clicks they’ve had so far. I don’t want them to just take my word for it.
Well, after trying out various solutions besides OpenX, I thought to myself 2 hours ago, “why can’t I just use Contact field in thebanner client area and enter a Joomla username, and then write a custom model for com_banners to display the statistics if the current Joomla user is the same as the one listed as the contact for a client?”
So that’s what I did. It is actually two queries. #1 checks the current username and selects all clients with that username (should be just one .. I limited it to one in the query), and selects the correct cid (client id). #2 selects all active banners for a given cid and spits them out, showing the banner, clicks, impressions, and CTR. I also added in some custom HTML to display a PayPal button … ideally this should be done in a View, not a Model, but the Banners component doesn’t seem to follow the MVC structure 100% so I didn’t either.
I did have to modify a few other files. Here are my modifications – this is on Joomla 1.5.18 but should work for any 1.5 release.
It’s as easy as 1-2-3;
1.
/components/com_banners/controller.php:
Add this after the end of function click():
2.
/components/com_banners/bannerstats.php
This is a new file – containing this code:
// Create the controller
$controller = new BannersController( array(‘default_task’ => ‘bannerstats’) );
// Perform the Requested task
$controller->execute(JRequest::getVar(‘task’, null, ‘bannerstats’, ‘cmd’));
// Redirect if set by the controller
$controller->redirect();
3.
/components/com_banners/models/bannerstats.php
This is a new file containing this code:
// Check to ensure this file is included in Joomla!
defined(‘_JEXEC’) or die( ‘Restricted access’ );
$document = &JFactory::getDocument();
jimport( ‘joomla.application.component.model’ );
jimport( ‘joomla.application.component.helper’ );
/**
* @package Joomla
* @subpackage Banners
*/
class BannersModelBannerstats extends JModel
{
function bannerstats(){
$banneruser = & JFactory::getUser();
$dbgetclient = &$this->getDBO();
echo “<h2>”.$banneruser->name.”‘s Ads</h2>”;
echo “<p>Already a customer? If your ad is about to reach the paid for number of clicks, you can make another payment using this button:</p>”;
echo ‘<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post” target=”_blank”>
<input name=”cmd” value=”_xclick” type=”hidden”>
<input name=”lc” value=”US” type=”hidden”>
<input name=”business” value=”youremail@yourdomain.com” type=”hidden”>
<input name=”pal” value=”4UXZK24C297M6″>
<input name=”item_name” value=”The name for this transaction” type=”hidden”>
<input src=”/images/x-click-but01.gif” name=”submit” alt=”Make payments with PayPal – it\’s fast, free and secure!” border=”0″ type=”image” width=”62″ height=”31″>
<br>
‘;
$dbgetclient = &$this->getDBO();
echo “<h2>Active ads for: “.$banneruser->username.”: </h2>”;
$getclient = “SELECT cid FROM #__bannerclient WHERE contact=’”.$banneruser->username.”‘ LIMIT 1″;
$dbgetclient->setQuery( $getclient );
$getclientresult = $dbgetclient->loadObjectList();
for($i = 0; $i < count($getclientresult); $i++) {
$cid = $getclientresult[$i]->cid;
//echo “cid: “.$cid.”<br />”;
}
$dbgetbanner = &$this->getDBO();
$getbanner = “SELECT * FROM #__banner WHERE cid=”.$cid.”";
$dbgetbanner->setQuery( $getbanner );
$getbannerresult = $dbgetbanner->loadObjectList();
for($i = 0; $i < count($getbannerresult); $i++) {
echo “<img src=’”.JURI::root().”images/banners/”.$getbannerresult[$i]->imageurl.”‘ border=’0′><br />”;
echo ‘URL: ‘.$getbannerresult[$i]->clickurl.’<br />’;
echo ‘Clicks: ‘.$getbannerresult[$i]->clicks.’<br />’;
echo ‘Views: ‘.$getbannerresult[$i]->impmade.’<br />’;
echo ‘CTR (clickthrough rate): ‘.number_format((100*($getbannerresult[$i]->clicks)/($getbannerresult[$i]->impmade)),2).’ %<hr />’;
}
}
}
?>
You can then create a link in the User Menu pointing to index.php?option=com_banners&task=bannerstats.
It will detect the current logged-in user’s username, check the “contact” field of the banner clients, and select the active banners for that client. Needless to say, the contact field should contain that person’s username and nothing else, or it will not work.
In the future maybe there can be a special field allowing us to choose a username or enter one, instead of using the Contact field which is not really meant for that. I had considered making this a separate component, but it is really something I would like to see become part of the regular com_banners component.
Feedback is welcome – as far as I can tell this is secure and works, but others may have a better idea about that.
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.
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.
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);
Using this, you could for example control which graphics or CSS file are loaded depending on the section of the article/category.
Google Chrome incorrectly reporting “mixed content” on SSL-encrypted pages
Chrome will show a green icon the left of a URL that is SSL-encrypted and does not use “mixed content”. In other words, a page that displays only secure content over an HTTPS connection. That’s great, and increases user trust. However, if the site contains 20 pages and one of them contains an external non-HTTPS JavaScript file, Chrome will display a red “skull and bones” icon to the left of the URL bar, and that icon will remain displayed next to that site’s URLs for that visitor until they close Chrome.
For example, Skype offers a status button to display a user’s Skype status. That relies on a JavaScript file that resides on Skype’s servers and is only available over an HTTP connection. So, to use this on an all-SSL site, you’d probably need to put it inside an iframe.
I suppose Chrome’s developers might think that if one page on a site contains such content, they’d better keep warning the user about other pages on that site too, even though the other pages do not contain mixed content. I would prefer tit actually be accurate.
www subdomains (or lack thereof)
Why do some major sites not have working www subdomains? For example, a domain registrar I have used in the past, ziggle.com, is not accessible from www.ziggle.com. This seems like a mistake to me, but maybe they have their reasons. I came across another example of this a few days ago but can’t remember which site it was. If the DNS is set up right and the .htaccess file contains the following (if using Apache), there should be no problem;
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.theirsite\.com[NC]
RewriteRule ^(.*)$ http://www.theirsite.com/$1 [R=301,L]
