This week ” Lorem Ipsum Generator Reflection and Testing” was one of our assignment and it was challenging for me. We use arrays, loops, functions and templates.
First, I created basic structure and then I started to write easy part “arrays” and then hard part which are loops. I took help from week4’s assignment “Lab Activity 4” .
Loops are complicated and I am sooo slow but I know they are always same like math formules. Repetition is the key to me learning and remembering.
Pseudocode uses natural language like notes explaining how you would do your steps in coding without actually coding. It is very helpful to know what are you doing. But also so boring and need patience to write. Because I always start with the structure and then I think I’m too lazy to write it on a piece of paper in my head. But yes, it’s really helpful for getting the job organized and getting it right.
User’s input from index page to process page:
$inputParagraphs = $_POST[‘number_of_paragraphs’];
We decide what will be paragraph and sentence length:
$q = 0; (paragraph_quantity)
while($q < $inputParagraphs) {
echo “<p>”;
$paragraph_length = rand(5, 8);
$p = 0;
$paragraph = “<p>”;
while($p < $paragraph_length){
$sentence_length = rand(5, 20);
$s = 0;
$sentence = ” “;
while($s < $sentence_length){
shuffle($word_list);
$sentence = $word_list[0] . ” ” . $sentence;
$s++;
}
Output:
echo ucfirst(trim($sentence));
echo “. “;
$p++;
}
$q++;
echo “<p>;
}
Here is my assignment “Web Project 3: Lorem Ipsum Generator” :
