Example #1
0
					<?php 
while (dumb_luck("4")) {
    ?>
					<li class="teaser byline-icon">
						<div class="teaser-byline">
							<time datetime="<?php 
    dummy("text@datetime");
    ?>
"><?php 
    dummy("text@date-ddmm");
    ?>
</time>
						</div>
						<a href="tpl-article.php">
							<?php 
    if (dumb_luck("100%")) {
        ?>
								<figure>
								<img class="b-lazy" 
										src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" 
										data-src="<?php 
        dummy("image@100x,2:1,");
        ?>
" 
										data-src-tablet="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" 
										data-src-phone="<?php 
        dummy("image@100x,2:1,");
        ?>
" 
										alt="Image description" />
						<div class="btn-group">
							<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
							Most commented <span class="caret"></span>
							</button>
							<ul class="dropdown-menu">
								<li><a href="#">Most ...</a></li>
								<li><a href="#">Most ...</a></li>
								<li><a href="#">Most ...</a></li>
								<li><a href="#">Most ...</a></li>
							</ul>
						</div>
					</div>

				<ul class="list list-avatar-2 ">
					<?php 
while (dumb_luck("3")) {
    ?>
					<li>
					

					<div class="list-body">

						<a href="tpl-article.php">
						<span class="teaser-author"><?php 
    dummy("text@author");
    ?>
</span>
						<figure>
						<img class="b-lazy" 
							src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" 
							data-src="<?php 
Example #3
0
					<ul class="flex-row">
						<li class="flex-item col-md-12 col-sm-6 col-xs-12">
							<aside class="box  mt-10-xs">
							
								<h2 class="box-title box-border">
									Berlingske recommends.
									<small>
										Keep up with what our journalists read
									</small>
								</h2>

								
								
								<ul class="list list-avatar-1">
									<?php 
while (dumb_luck("4")) {
    ?>
									<li>
									<div class="list-body">
										<a href="tpl-article.php">
										<figure>
										<img class="b-lazy" 
									src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" 
									data-src="<?php 
    dummy("image/!author-bw@40x50,");
    ?>
" 
									alt="Image description" />
										</figure>
										<footer class="pre-title">Recommended by <?php 
    dummy("text@author");
		 alt="Image description" /></a>
			</figure>
			<?php 
}
?>
			<a class="header" href="tpl-article.php"><?php 
dummy("text@headline");
?>
</a>
		</li>
		<?php 
while (dumb_luck("2")) {
    ?>
		<li>
			<?php 
    if (dumb_luck("25%")) {
        ?>
			<figure>
				<a href="tpl-article.php"><img class="b-lazy" 
		 src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" 
		 data-src="<?php 
        dummy("image@250x,2:1");
        ?>
" 
		 data-src-phone="<?php 
        dummy("image@450x,2:1");
        ?>
" 
		 alt="Image description" /></a>
			</figure>
			<?php 
									<div class="teaser-byline">
										<span class="teaser-source"><a href="#">Politiko</a></span> <time datetime="<?php 
    dummy("text@datetime");
    ?>
"><?php 
    dummy("text@time");
    ?>
</time>
									</div>

									<h3 class="header">
										<a href="tpl-article.php"><?php 
    dummy("text@headline-b");
    ?>
 <?php 
    if (dumb_luck("20%")) {
        ?>
<i class="icon-lock"></i><?php 
    }
    ?>
</a></h3>
										<div class="byline-avatar">
										<figure>
										<img class="b-lazy" 
										src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" 
										data-src="<?php 
    dummy("image/!author@32x,1:1");
    ?>
" 
										alt="Image description" />
										
Example #6
0
function dumb_question($p)
{
    // Parse the command
    list($cmd, $params) = explode(':', $p, 2);
    // If the command is 'order', delegate to dumb_luck
    if ($cmd == 'order') {
        return dumb_luck($params);
    }
    // If the command is 'url', we are going to check the query string
    if ($cmd == 'url') {
        // Parse the params into key/value pairs
        $params = str_replace(" ", "", $params);
        if (!$params) {
            if (count($_GET) > 0) {
                $pre = '?';
            } else {
                $pre = '';
            }
            return $pre . http_build_query($_GET);
        }
        $pairs = explode('&', $params);
        foreach ($pairs as $pair) {
            // Parse the pair into a key and a value
            list($key, $value) = explode('=', $pair, 2);
            if ($value === null) {
                // just check for this in the url:
                if (!array_key_exists($key, $_GET)) {
                    return false;
                }
            } else {
                // Check if the given question is not true
                if (!array_key_exists($key, $_GET)) {
                    return false;
                } else {
                    if ($_GET[$key] != $value) {
                        return false;
                    }
                }
            }
        }
        // All the questions were "not not false", so they must all be true. It's a crazy world.
        return true;
    }
    // For 'segment' commands, we check the .htaccess generated query string
    if ($cmd == 'segment') {
        // Requirement check
        if (!getenv('DUMMYURL')) {
            echo "<em>You can't ask about <b>segments</b> using dumb_question without first enabling the optional .htaccess file. Look in &#8220;dummy/docs&#8221; for more info.</em>";
            return false;
        }
        $segments = explode('/', $_GET['dummyurl']);
        // note that $segments[0] = '' after this
        if (!$params || strpos($params, '=') === false) {
            // Print the segment content
            if (!$params) {
                return $_GET['dummyurl'];
            }
            $n = intval($params);
            if ($n >= count($segments)) {
                return;
            }
            echo $segments[$n];
            return;
        } else {
            // Test the segment content
            // This is the same approach as in the above code for command 'url'
            $params = str_replace(" ", "", $params);
            $pairs = explode('&', $params);
            foreach ($pairs as $pair) {
                list($key, $value) = explode('=', $pair, 2);
                if ($key >= count($segments)) {
                    return false;
                }
                // make sure we don't index too far
                if ($segments[$key] != $value) {
                    return false;
                }
            }
            return true;
        }
    }
    // Wrong command, you will be punished!
    echo "<em>Unknown command in <b>dumb_question:</b> {$cmd}</em>";
    return false;
}
Example #7
0
    &lt;? while (dumb_luck("5-10")): ?&gt;
      &lt;? if (dumb_luck("50%")): ?&gt;
        <li><a href="#">&lt;? dummy("text@headline") ?&gt;</a></li>
      &lt;? else: ?&gt;
        <li>&lt;? dummy("text@headline") ?&gt;</li>
      &lt;? endif ?&gt;
    &lt;? endwhile ?&gt;
    </ul>
  </pre>
</div>

<p>Though the exact number will change every time you reload the page, roughly half of the items in the following list will be wrapped in a link. It's a very basic example, but one that uses all the core features of Dummy.</p>


<div class="snippet text-snippet">
  <ul><? while (dumb_luck("5-10")): ?><? if (dumb_luck("50%")): ?><li><a href="#"><? dummy("text@headline") ?></a></li><? else: ?><li><? dummy("text@headline") ?></li><? endif ?><? endwhile ?></ul>
</div>

<p>When used together, asset generation, probability, and loop range logic can create highly variable layouts with very little effort in code. This makes it possible to quickly test how the change of an item, attribute or parameter in one place propagates on a range of different scales. It can provide new insights on the performance or design efficacy of your work at the earliest stages of a project, and every time you reload the page.</p>


<div class="snippet code-snippet">
  <pre class="brush: php">
    <h1>&lt;? dummy("text@headline") ?&gt;</h1>
    &lt;? if (dumb_luck("25%")): ?&gt;
      <p class="intro">&lt;? dummy("text@long-teaser") ?&gt;</p>
    &lt;? endif ?&gt;
    <p>By &lt;? dummy("text@author") ?&gt; | Published &lt;? dummy("text@date") ?&gt;</p>
    &lt;? while (dumb_luck("3-8")): ?&gt;
      <p>&lt;? dummy("text@paragraph") ?&gt;</p>
    &lt;? endwhile ?&gt;
Example #8
0
        <li><a href="#">&lt;? dummy("text@headline") ?&gt;</a></li>
      &lt;? else: ?&gt;
        <li>&lt;? dummy("text@headline") ?&gt;</li>
      &lt;? endif ?&gt;
    &lt;? endwhile ?&gt;
    </ul>
  </pre>
</div>

<p>Though the exact number will change every time you reload the page, roughly half of the items in the following list will be wrapped in a link. It's a very basic example, but one that uses all the core features of Dummy.</p>


<div class="snippet text-snippet">
  <ul><?php 
while (dumb_luck("5-10")) {
    if (dumb_luck("50%")) {
        ?>
<li><a href="#"><?php 
        dummy("text@headline");
        ?>
</a></li><?php 
    } else {
        ?>
<li><?php 
        dummy("text@headline");
        ?>
</li><?php 
    }
}
?>
</ul>
														</article>
													</li>
												<?php 
}
?>
											</ul>
										</div>

									</div>

									<div role="tabpanel" class="tab-pane " id="tab3">

										<div class="row row-narrow">
											<ul class="flex-row ">
												<?php 
while (dumb_luck("10")) {
    ?>
													<li class="col-xs-1-5th col-sm-1-5th col-md-1-10th">
														<article class="teaser-blogger ">
															<a href="tpl-article.php">
																<figure class="teaser-img">
																	<img class="b-lazy" 
																		src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" 
																		data-src="<?php 
    dummy("image/!author@80x,1:1");
    ?>
" 
																		data-src-tablet="<?php 
    dummy("image/!author@140x,1:1");
    ?>
" 
Example #10
0
?>
</a></span>
						</div>	
						

						
						<div class="article-comments-container clearfix" id="article-comments-container">
							<div id="disqus_thread"></div>	
						</div>

					</div>
					
					
					<div class="article-tags">
						<?php 
while (dumb_luck("1-7")) {
    ?>
						<a href="tpl-section-tag.php" class="btn btn-sm btn-light"><?php 
    dummy("text@item");
    ?>
</a>
						<?php 
}
?>
					</div>
				</div>
				</article>

				<ul class="flex-row">
				
					<li class="flex-item col-xs-6 teaser-pagination " >
				</div>

			</li>
			

			<li class="flex-item col-md-4 col-sm-12 col-xs-12 bl-md">
				
				
				<div class="row">
					<div class=" col-md-12 col-sm-6 col-xs-12">
						<aside class="box">
				
							<h2 class="box-title box-border ">Most shared. <small class="right">On facebook <i class="icon-facebook-squared col-facebook"></i></small></h2>
							<ul class="list list-top list-reader-count">
								<?php 
while (dumb_luck("5")) {
    ?>
								<li><a href="tpl-article.php"><?php 
    dummy("text@headline-b");
    ?>
									<span class="reader-count"><i class="icon-thumbs-up-alt"></i> <?php 
    dummy("text@number");
    ?>
</span>
								</a>
								</li>
								<?php 
}
?>
							</ul>
    dummy("image@230x,2:1");
    ?>
" 
							data-src-phone="<?php 
    dummy("image@500x,2:1");
    ?>
" 
							alt="Image description" />
						</a></figure>
							<a href="tpl-article.php"><?php 
    dummy("text@headline");
    ?>
</a>
						</li>
						<?php 
    while (dumb_luck("2")) {
        ?>
							<li><a href="tpl-article.php"><?php 
        dummy("text@headline");
        ?>
</a></li>
						<?php 
    }
    ?>
						
					</ul>	
					
				</div>
				<div class="deck-footer">
					<a href="section.php" class="btn btn-sm">Show more</a>
				</div>