View Single Post

Old 08-11-2010   #2 (permalink)
Andy
Co-Pilot & Owner
 
Andy's Avatar
[+] more user info
 
Andy is offline  
Join Date: Jan 2007
Location: Cape Town
Posts: 973
Thanks: 19
Thanked 497 Times in 379 Posts


Hi There,

Thanks for submitting these updates :) its great when members give back!

I have gone through the changes and they are very sensible and having the ability to choose a tmpl file is a nice addition. The only thing that needs a rethink is the inline css being added to the page using the css variables.

Currently they are being added to the <dl> using the inline "style" attribute like so

Code:
<?php //dauthanhhai@gmail.com - start
	$contact_width = $params->get('contact_width', '160px');
	$contact_height = $params->get('contact_height', '160px');
	$contact_margin = $params->get('contact_margin', '0');
	$contact_padding = $params->get('contact_padding', '0');
	?>
	style="width:<?php echo $contact_width; ?>; height:<?php echo $contact_height;?>;margin:<?php echo $contact_margin;?>; padding:<?php echo $contact_padding;?>; float:left;"
	<?php
	//dauthanhhai@gmail.com - end
	?>
Its good practice to keep all styling separate from the html for a number of important reasons, most of which is maintenance, they are less accessible and to keep the html clean and code count as low as possible.

See a good basic article about this here:

Best Practices: Avoid CSS Inline Styles

This is why using a class with php generated CSS is better, so...

The cleaner approach is to add a class to the div and then output the css to the selector using "addStyleDeclaration"

.someClass {
width: $contact_width;
height:$contact_height;
margin: $contact_margin;
padding:$contact_padding;
}

I will play with this a little when I get some time and try implement this change.

Thanks again for sending the updates back to us :)

Cheers,

Andy
  Reply With Quote
Has your question been answered? Please mark the response as the best answer. This helps us give you faster support.

Are you happy with our support? Please make us smile by writing a short review on Best of Joomla

Do you also love Twitter? Follow us on prothemer | jMorph | joomlatips |andyjamesneale
These users thanked Andy.