PDA

View Full Version : i hate css!


slothdog
29th December 06, 12:23 AM
well i dont hate it, i just have a severe dislike for it sometimes.

can you tell me why this php:


function outputbody($item, $template=""){
if ($template=="" || $template=="default"){ //DEFAULT TEMPLATE
?>
<DIV class="rsscontainer">
<div class="rsstitle"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></div>
<div class="rssdate"><?php echo $item->get_date('d M Y g:i a'); ?></div>
<div class="rssdescription"><?php echo $item->get_description(); ?></div>
</DIV>
<?
} //end default template

else if ($template=="reviews"){ //"REVIEWS" TEMPLATE
?>
<DIV class="reviewbox">
<div class="reviewboxtitle"><a href="<?php echo $item->get_permalink(); ?>" ><?php echo $item->get_title(); ?></a><br /></div>
</DIV>
<?
} //end reviews template


else if ($template=="menus"){ //"MENUS" TEMPLATE
?>
<DIV class="menubox">
<div class="menuboxrsstitle"><a href="<?php echo $item->get_permalink(); ?>" ><?php echo $item->get_title(); ?></a><br /><br /></div>
<div class="menuboxrssdescription"><?php echo $item->get_description(); ?></div>
<div class="menuboxrssdate"><br /><b>Uploaded:</b> <?php echo $item->get_date('M, d Y'); ?></div>
</DIV>
<?
} //end menus template

else if ($template=="news"){ //"NEWS" TEMPLATE
?>
<DIV class="newsbox">
<div class="newsboxtitle"><a href="<?php echo $item->get_permalink(); ?>" ><?php echo $item->get_title(); ?></a><br /><br /></div>
<div class="newsboxdescription"><?php echo $item->get_description(); ?></div>
<div class="newsboxdate"><br /><b>Posted:</b> <?php echo $item->get_date('M, d Y'); ?></div>
</DIV>
<?
}



only displays the 'menus' template css and not any of the other ones using this style sheet:


.menubox {
padding: 10px;
margin-bottom: 5px;
margin-top: 5px;
margin-left: 5px;
margin-right: 5px;
border: 1px solid black;
}


.menubox .rsstitle { /*Style for .rsstitle DIV*/
font-weight: normal;

}

.menubox .rssdate { /*Style for .rssdate DIV*/
font-color: gray;
font-size: 90%;
}

.reviewbox {
padding: 10px;
margin-bottom: 5px;
margin-top: 5px;
margin-left: 5px;
margin-right: 5px;
}

.reviewbox .rsstitle { /*Style for .rsstitle DIV*/
font-weight: normal;

}

.reviewbox .rssdate { /*Style for .rssdate DIV*/
font-color: gray;
font-size: 90%;
}

.newsbox {
padding: 10px;
margin-bottom: 5px;
margin-top: 5px;
margin-left: 5px;
margin-right: 5px;
}

.newsbox .newstitle { /*Style for .rsstitle DIV*/
font-weight: normal;

}

.newsbox .newsdate { /*Style for .rssdate DIV*/
font-color: gray;
font-size: 90%;
}

gyda
29th December 06, 01:16 AM
well I don't understand much of PHP, but I think the problem is not relative with CSS
maybe is with those "else if"'s, since the first one is an "if" it appears, but the other three don't... seems a logic there, it might be the code :/
sorry for not helping :|

slothdog
29th December 06, 03:19 AM
i dont think thats the problem because ive had it working, but 3 of the 4 areas shared the same style even though it was clearly defined it should be diffrent.

gyda
29th December 06, 01:33 PM
Ah, I think I'm seeing what's the problem.
It's the names, you have them all together, need a space in:
menuboxrsstitle -> should look like class="menubox rsstitle"
menuboxrssdate -> class="menubox rssdate"
and for all the others too

mattrd
29th December 06, 03:07 PM
you have two classes defined in the css. you have class "menubox" and you have class "rsstitle" Yet in the php code, you only have one class which is "menuboxrsstitle" so instead of putting .menubox .rsstitle in the css, replace it with .menuboxrsstitle

tbobker
1st January 07, 11:59 AM
no he does have that all correct he just hasnt included .menuboxrsstitle as well in the stylesheet. Make sure all the classes are specified in your css.
You say that it is only displaying the menus template well that will be something to do with the php not the css seeing as it is the php that is determing what css to use.