Wednesday, January 13, 2010

PHP Code snippet:

The below code does a few interesting things:
  • Checks that the story is part of the 1st ten pages (<10)
  • Determines whether the male or female version of the chapter should be displayed
  • replaces placeholder character names with user-generated Facebook friends
  • allows the story to be displayed with PHP code (i.e., allowing the facebook friend names to show up)

// evaluates the story as a mixture of php and html
if ($page_id < 10 && $user_gender =='f')
{
$thestory = $femstory;
}
else
{
$thestory = $story;
}
$thestory = str_replace($plaintext, $markup, $thestory);
eval("\$thestory=$thestory;");
echo $thestory;

No comments:

Post a Comment