Wednesday 29 July 2009

Adding a class suffix to a module that doesn't have one.

They are moments when you just have to love Joomla, and this was definatly one of those moments as this was very very easy to fix.

I had downloaded the extendsion Simple Tags http://extensions.joomla.org/extensions/search-&-indexing/tags-&-clouds/5422/details#action .

The only problem with it was the box wasn't displayed as I wished. What I wanted was to make it inline with my other menus that had the class name module_menu. On installation of the extension it was only 'module' and there was no input area in admin to add a class suffix.

THE SOLUTION: all I had to do was add this line to the file mod_simpletags.xml above the final < / params > tag.

< param name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" / >

and that was it Joomla did the rest for me :)))

Thursday 16 July 2009

css - margin-top not working safari

This was my problem.

I had a table that was using the command 'margin-top' to position itself inside a < div >
It displayed fine in Internet Explorer and Firefox but not in Safari.


my original code was

.module div div div table{
margin-top:45px;
}


I found the solution for this by trial and error.

While testing though I found it helpful to activate the Safari developer tools. You do this by going to ->
Edit->preferences-> then clicking on the tick box for 'Show Develp menu in menubar' at the bottom of the pop-up box.

The solution was to leave the class above blank and target the tbody that lies below the table - ie ->
.module div div div table tbody{
display: block;
margin-top:45px;
}


Please note in your code you may find it easier to just put a class in the table and access it from there, rather than using the tree of < div >s that I have.

css - show full background image on hover link

I found it quite difficult to find the solution to this one.

So I thought I'd blog it so the solution may be easier to find. Here's some search terms i tried.

css show full background image hover link
css background on hover link problem
css background image show full
css hover background stretch

The solution for this I found through this link.

http://www.daniweb.com/forums/thread109916.html

Basically it's the css on the :link and not the :hover that you need to change. This is where I was going wrong.

the solution then for me was


a.link:link, a.link:visited {
text-decoration: none;
color: #fff;
font-size: 14px;
display:block; /*This Cover Full TD */
width:100%; /*This Will Make Fixes Size Link (Use Image width)*/
text-align:left;

}

.link:hover {
background:#000 url(../images/menu_bg1.gif) center center fixed;

}


you will then need to stick the class name in you link html, ie

Example

Wednesday 15 July 2009

Adding a feature to a Joomla Component

This is a small change I made to a ccboard ( which is an excellent Joomla forum addon by the way ) .
You will need to have the module for ccboard latest_posts.

Before I go on I found two documents online that were very helpful in understanding how to make changes to a Joomla Component
http://docs.joomla.org/Creating_custom_template_parameter_types
http://help.joomla.org/content/view/777/125/

Basically allows you to show recent posts from a specific catergory. The default '0' will show all cats.
Before you start BACKUP.



OPEN modules/mod_ccboard_latest_posts/helper.php

FIND:

function getItems($numposts)


REPLACE WITH:


function getItems($numposts, $forumid)

FIND:

if ( $numposts < 1) {
return;
}

UNDERNEATH ADD:

if ($forumid == '0' || $forumid == NULL){
$forumid = '%';
}


FIND:

$query = 'SELECT p.id, p.forum_id, p.topic_id, p.post_time, ' .
'p.post_subject, u.username, p.post_user, p.post_username ' .
'FROM #__ccb_posts AS p ' .
'INNER JOIN #__ccb_forums AS f ON f.id = p.forum_id ' .
'INNER JOIN #__users AS u ON u.id = p.post_user ' .
'WHERE f.published=1 AND f.view_for <= ' . $user->get('gid') . ' ' .
'ORDER BY p.post_time DESC';


REPLACE WITH:

$query = 'SELECT p.id, p.forum_id, p.topic_id, p.post_time, ' .
'p.post_subject, u.username, p.post_user, p.post_username ' .
'FROM #__ccb_posts AS p ' .
'INNER JOIN #__ccb_forums AS f ON f.id = p.forum_id ' .
'INNER JOIN #__users AS u ON u.id = p.post_user ' .
'WHERE f.published=1 AND f.view_for <= ' . $user->get('gid') . ' AND p.forum_id LIKE \''.$forumid.'\' ' .
'ORDER BY p.post_time DESC';


-> SAVE


OPEN modules/mod_ccboard_latest_posts/mod_ccboard_latest_posts.php

FIND:

$numposts = $params->get('numposts');

ADD UNDERNEATH:

$forumid = $params->get('ForumID');


FIND:
$items = ccboardLatestPostsHelper::getItems($numposts);

REPLACE WITH:

$items = ccboardLatestPostsHelper::getItems($numposts, $forumid);


-> SAVE

OPEN modules/mod_ccboard_latest_posts/mod_ccboard_latest_posts.xml


FIND:

ccBoard
Joomla


ADD UNDERNEATH:




-> SAVE

-> UPLOAD FILES

Friday 3 July 2009

Transferring a website using SSH

The following is a list of SSH commands to move a website from one location to another.

Once you SSh'd in then change directories to one higher than the directory you want to zip

>> example - if you're in the directory you want to zip already

cd ..

>> otherwise

cd public_html/


>> now to zip the website


tar -czvf fileName.tar.gz folderName/




- Now you need to SSH into the website you
're transferring to.


!!! when doing this on the project in had I first needed to delete what was on there.

> to do this I deleted the directory in question

rm -r public_html/

> and recreated that directory

mkdir public_html/

////////////////////////////////

now get yourself in the folder you want...

and use the following commands to to unzip your website

>>

wget http://www.siteyourzipisat.co.uk/fileName.tar.gz

tar -zxvf fileName.tar.gz


//////////////////////////////////////

hopefully it'll be as easy as that for you as well :)




possible search terms used to find this article.

ssh unzip tar.gz
ssh zip website
ssh unzip website
ssh compress site
ssh compress website
ssh transfer website
ssh transfer joomla website