Archives line break

From Photostand Wiki

Jump to: navigation, search
archives_line_break(numrow, spacer)

This function is practical whenever you need to add an HTML value (spacer) after a specified number of thumbnails in an horizontal row (numrow).

Using this function in the archives is not mandatory. You may be able to define a fixed width for the container tag that regroups the whole archives and it will work fine too.

Parameters

  • Numrow : Integer value - Default : 5

Number of thumbnails, contained in an horizontal row, that must be displayed before displaying an HTML value.

  • Spacer : String value - Default : <br />

HTML value that must be displayed at the end of each row.

Examples

In the archives.php page

Line break after 10 thumbnails

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>

	<title>Archives</title>

    </head>
    <body>

        <p>
	    <?php
    	    foreach(archives_array(50) as $article)
    	    { 
    	    ?>
     	    <img src="<?php echo archives_thumbnail(); ?>" class="thumbnail" />
            <?php echo archives_line_break(10, '<br />'); ?>
	    <?php
    	    }
	    ?>
	</p>

    </body>
</html>

The example above will display all thumbnails in a main paragraph and will add a
'
after 10 thumbnails, which will make the archives look cleaner.

Here's the same example, but with a better xHTML usage.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>

	<title>Archives</title>

    </head>
    <body>

        <ul>
	    <?php
    	    foreach(archives_array(50) as $article)
    	    { 
    	    ?>
     	    <li><img src="<?php echo archives_thumbnail(); ?>" class="thumbnail" /></li>
            <?php echo archives_line_break(10, '</ul><ul>'); ?>
	    <?php
    	    }
	    ?>
	</ul>

    </body>
</html>

Now each row is, in fact, a list.

Personal tools