I have a simple CMS that I have set up.
In the database it has a row for short-story content and a row for full-story content on the same table.
I 开发者_开发技巧am trying to write an if else statement that basically shows the full story content if it has more characters or words inside.. or to show the short-story if the full-story == "NOTHING" :
if $full-story == 0 { echo 'short-story-content' }
else { echo 'full-story-content' }
if (strlen($row['full_story']) > strlen($row['short_story']))
{
echo $row['full_story'];
}
else
{
echo $row['short_story'];
}
function displayStory($full, $short) {
$story = $short;
if(strlen($full) > strlen($short) {
$story = $full;
}
return $story;
}
精彩评论