Allowing specific HTML tags in JomSocial Wall Posts | June 18th, 2010

By: thescotsman

JomSocial doesn’t let you put much in the Wall Posts. If you want to boost the functionality a bit without blowing a big hole in your security, here is a quick tutorial on allowing specific HTML tags:

/components/com_community/libraries/wall.php
around line 162,
comment out:

  1. //$wall->comment= htmlspecialchars( $wall->comment , ENT_QUOTES , ‘UTF-8′, true );

and insert:

  1. $wall->comment = nl2br($wall->comment);
  1. $wall->comment = urlencode($wall->comment);

and around line 197, right after this line:

  1. $avatarHTML= cGetUserThumb( $wall->post_by , ‘avatar’);

add the following:

  1. $wall->comment = urldecode($wall->comment);
  1. $wall->comment = strip_tags($wall->comment, "<a>, <br>");

add any other tags you want to allow in the comma-separated string in the 2nd argument of the strip_tags() function.

Share and Enjoy:
  • Print
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Live
  • MySpace
  • PDF
  • Ping.fm
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Buzz
  • Yahoo! Bookmarks

Make Your WordPress Blog Look Great on iPhones | April 6th, 2010

By: christhebrain

There is a great plugin for WordPress that will take your blog and turn it into a slick iphone optimized web-app. It is called WPTouch, and you can download it here:
http://www.bravenewcode.com/products/wptouch/

WPTouch has a lot of customization options, but it didn’t quite give us the control over the header we wanted, we have also include the following hack to put any image in the header you want.

The following code is in wp-content/plugins/wptouch/themes/default/header.php

  1. <div id="headerbar">
  2. <div id="headerbar-title">
  3. <!– This fetches the admin selection logo icon for the header, which is also the bookmark icon –>
  4. <img id="logo-icon" src="<?php echo bnc_get_title_image(); ?>" alt="<?php $str = bnc_get_header_title(); echo stripslashes($str); ?>" />
  5. <a href="<?php bloginfo(‘home’); ?>">
  6. </a></div>
  7. </div>

This code is displays the icon you have picked for your site as well aas the header title you have defined. If you wish to use an actual image, instead of the icon and text, comment out the above code and replace it with the following:

  1. <a href="<?php bloginfo(‘home’); ?>">
  2. <img src="/images/pathtoimage.jpg" border="0" alt="image title" />
  3. </a>

I recommend a header image of 480px wide and 80px (or less) tall. If the image is 480px wide, it will show the first 320px while vertical, and then the whole 480px when horizontal.

Have fun!

Share and Enjoy:
  • Print
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Live
  • MySpace
  • PDF
  • Ping.fm
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Buzz
  • Yahoo! Bookmarks

Joomla Ad Space Image Rotator | April 2nd, 2010

By: thescotsman

We created this image rotator for clients who needed to rotate images, each corresponding to a different URL.  We could find other image rotators, but they didn’t let us set different URLs for each image.  We also just couldn’t get the customization we wanted.

Our image rotator sets in a module position and let’s you pick a size, timed interval (in seconds), # of images you want to rotate, and of course, the images and URLS you want.  It is very flexible, allowing you to use it for anything from side banner ads to rotating headers.

This is a FREE, GPL, module for Joomla that you may use AT YOUR OWN RISK.  We don’t offer support, but feel free to leave a comment of any suggetions for improvement and we may get around to it… eventually… maybe…  We like it, hope you do too.

CLICK HERE TO DOWNLOAD

Share and Enjoy:
  • Print
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Live
  • MySpace
  • PDF
  • Ping.fm
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Buzz
  • Yahoo! Bookmarks

Making RokBox Work | March 2nd, 2010

By: thescotsman

We have had our own share of difficulty with the uber-stylish RocketTheme RokBox plugin.  If you are having trouble getting RokBox to work, see if our notes below help you out.  You can download RokBok here: http://www.rockettheme.com/extensions-joomla/rokbox

The RokBox plugin for joomla automatically creates links for thumbnail images, but it SHOULD display the larger image in a pretty little pink pop-up box with lace trim and unicorns. Here is how:

first, the easy part:
Create an empty ‘div’ element somewhere near to where th image thumbs are located.
Make the div = ‘RokBoxBox’ like:

  1. <div id=’RokBoxBox’></div>

Once the following is done, that’s all you need to make it work….

style the id so that is it display: none – here is my css:

  1. #RokBoxBox {
  2. display: none;
  3. position: absolute;
  4. left: 275px;
  5. background-color: white;
  6. padding: 10px;
  7. border: 1px gray groove;
  8. z-index: 100;
  9. }

insert this javascript in the page header, or in the header of the joomla template – better yet, copy and save it to imgBox.js and put an external link, e.g.

  1. <script language="javascript" type="text/javascript" src="/scripts/imgBox.js"></script>

here is the actual js code:

  1. function show_hideImgBox(anchor,targetDivId ) {
  2. if(!document.getElementById(targetDivId)) {
  3. return true;
  4. }
  5. var link = anchor.href;
  6. var targetElement = document.getElementById(targetDivId);
  7.  
  8. if(targetElement.style.display == ‘block’) {
  9. targetElement.style.display = ‘none’;
  10. } else {
  11. targetElement.innerHTML = “<a href=’#’ onclick=\”show_hideImgBox(this,’” + targetDivId + “‘);\” style=’cursor: pointer;’>Click to Close
  12. <img src=’” + link + “‘ /></a>”;
  13. targetElement.style.display = ‘block’;
  14. }
  15. return false;
  16. }

now, the slightly scary-for-non-php-programmers bit:
From your joomla root directory, open the file
/plugins/content/rokbox.php

around line 208, find the code:

  1. <a href=”’ . $link . ‘”

there are several lines with this. Right before the “if” block “if (!strlen($thethumb) …) etc,
place the following php code:

  1.      
  2. $targetDiv = $botParams->targetDiv;                    
  3. if($targetDiv == )                        
  4. $targetDiv="RokBoxBox";                    
  5. $jsLoadBox = " onclick=\"return show_hideImgBox(this,’$targetDiv’ );\" ";

VERY IMPORTANT: add this code snip right after the “<a ” in each line with the href code (insert spaces)

‘.$jsLoadBox.’

so that each line looks like:

  1. if (!strlen($thethumb) && !strlen($thetype) && strlen($thetext) > 0) {
  2.                         if (strlen($themodule)) $text = $text . ‘<a’.$jsLoadBox.‘href="’ . $link . ‘" rel="’ . $compatibility . $thesize . $thealbum . $displaythumb . $themodule .‘" title="’ . $thetitle . ‘">’.$thetext.‘</a>’;
  3.                         else $text = $text . ‘<a ‘.$jsLoadBox.‘href="’ . $link . ‘" rel="’ . $compatibility . $thesize . $thealbum . $displaythumb . ‘" title="’ . $thetitle . ‘">’.$thetext.‘</a>’;

if you want to be able to change the name of the target ‘div’ element, insert the following in rokbox.xml into the <params> section:

  1. <param type = "text" label="target Div (optional)" name="targetDiv" default="RokBoxBox" description="DIV element in which to load enlarged image" />
Share and Enjoy:
  • Print
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Live
  • MySpace
  • PDF
  • Ping.fm
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Buzz
  • Yahoo! Bookmarks

Joomla Category Listing/Link Hack – Make Category Links Go Anywhere | January 2nd, 2010

By: thescotsman

Here is a weird hack, but useful.  Right now, when you click a “Category” link, like under a Section listing, it takes you to a listing of that Categories articles.  What if you need a user to see something else first?  This hack below let’s you have a field in the Joomla Administration where you can setup an alternative link for any category.  This way, when someone clicks an automatically generated Category URL in Joomla, they go wherever you want them to.  “Why would I need this?” you ask.  Well, some clients think of websites that are just that crazy…..

1.  Open phpMyAdmin and add “alternative_link” field to jos_categories

2. Open /libraries/joomla/database/table/category.php and add the line:
var $alternative_link = null;

The best place to add it is below this line:
var $params = null;

3. Add the following code to /administrator/components/com_categories/admin.categories.html.php at around line 382,
making sure it is in it’s own tabe row:

  1. <tr>
  2. <td class="key">
  3. <label for="alternative_link">Alternative Link</label>
  4. </td>
  5. <td><input type="text" name="alternative_link" id="alternative_link" value="<?php echo $row->alternative_link;?>" />
  6. </td>
  7. </tr>

4. Alter the line (sould be line 28) that loads the category link in the file: /components/com_content/views/section/tmpl/default.php
so that it loads the alternative link IF it is set:
old code:

  1. <a href="<?php echo $category->link; ?>" class="category">

new code to insert in place of the line above:

  1. <a href="<?php if($category->alternative_link) echo $category->alternative_link; else echo $category->link; ?>" class="category">
Share and Enjoy:
  • Print
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Live
  • MySpace
  • PDF
  • Ping.fm
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Yahoo! Buzz
  • Yahoo! Bookmarks