I'm having a array which contains all the styles and i have to change them into proper CSS by looping in PHP.
For eg.,
Array
(
[#outlook a] => Array
(
[padding] => Array
(
[0] => 0
)
)
[body] => Array
(
[width] => Array
(
[0] => 100% !important
)
[-webkit-text-size-adjust] => Array
(
[0] => none
)
[margin] => Array
(
[0] => 0
)
[padding] => Array
(
[0] => 0
)
[background-color] => Array
(
[0] => #FAFAFA
)
)
[.preheaderContent div a] => Array
(
[color] => Array
(
[0] => #336699
)
[font-weight] => Array
(
[0] => normal
)
[text-decoration] => Array
(
[0] => underline
)
)
[.preheaderContent div a:visited] => Array
(
[color] => Array
(
[0] => #336699
)
[font-weight] => Array
(
[0] => normal
)
[text-decoration] => Array
(
[0] => underline
)
)
)
Like this i'll have a big array which contains all the style information. So i have to convert this into proper CSS. I know this is very simple. But i am failing somewhere on the recursive loop. This is the function i'm usig for this.
function cssbuild(&$cssArray)
{
foreach ($cssArray as $selector => $style)
{
if(is_array($style))
{
return $this->cssbuild($style);
}
else
{
$cssArray[$selector] = $cssArray[$selector].":".$style.";";
}
}
}
Any idea of how to do this would be greatly appreciated...