Simple Beauty Website Baker Template

This is a port of simple beauty found at oswd.com to websitebaker with some modifications.

You can download the template here.

Here are some Screenshots

First – this is what you get with a simple install. I made it so you don’t need a banner – though it certainly looks better with one I think.

Here it is with a banner.  Though I suppose you don’t need a screenshot for this.  OTOH maybe I’ll change the template again so…

websitebaker module: Random pic with text

This module includes a function you can call to randomly pick an image from a directory. It is based on a module written by John Maats, and I just added the captioning. 

Here is a link to the zip.

<?php
/* Random image snippet
   Call this nsippet with:
   RandomImage ('/media');
   in your template */

function RandomImage($dir) {
        //read folder and get the picture names
        $folder=opendir(WB_PATH.$dir.'/.');
        while ($file = readdir($folder))
        $names[count($names)] = $file;
        closedir($folder);

        //remove any non-images from array
        $tempvar=0;
        for ($i=0;$names[$i];$i++){
                $ext=strtolower(substr($names[$i],-4));
                if ($ext==&quot;.jpg&quot;||$ext==&quot;.gif&quot;||$ext==&quot;.png&quot;){
			$names1[$tempvar]=$names[$i];$tempvar++;
		}
        }

        //random
        srand ((double) microtime() * 10000000);
        $rand_keys = array_rand ($names1, 2);

        //random image from array
        $image=$names1[$rand_keys[0]];

        //name of image for alt text
        $name=substr($image,0,-4);

        //print associated Text
        echo &quot;<p><b>$name</b></p>";

        //read in the file if it exists

        if(file_exists(WB_PATH.$dir . '/' . "$name" . ".txt"))
        {
                $myfile=file(WB_PATH.$dir . '/' . "$name" . ".txt");
                echo '<p>';

                foreach ($myfile as $val)
                {
                  echo "$val ";
                }
                echo '</p>';
        }

        //image dimensions
        $dimensions = GetImageSize(WB_URL.$dir.'/'.$image);
        echo '<img src="'.WB_URL.$dir.'/'.$image.'" alt="'.$name.' image" />';
}
?>

websitebaker modules

Here are two modules I wrote for website baker. One allows you to sort
news arbitrarily, the other allows you to post multiple groups.

Writing these is how I wiped out this very website :) I didn’t have the installer quite right at the time. If you’re installing this, back things up just in case. But they really shouldn’t break anything. I swear.


anews.zip

gnewswrapper.zip

Here is a screenshot of anews. It allows you to sort news posts by title, date, reverstitle, or reversedate. Plus everything else the news module does, as it is just an extension of that.

Here is a screenshot of gnewswrapper. It allows you to post stuff by section from arbitrary groups.

From the readme:

Although the news module is extremely versitile, it lacks an easy way to post products or data items. For example:

-if you have a website that lists various types of faculty
-if you have a page that lists your various types of products
-if you have a page that lists courses for the current term

The news module can almost handle many of these problems. However, there are several shortcomings when the news module is ued for this purpose.

1. Although entries can be reordered, they are ordered by date. It can be a pain to click the up or down arrows until you get an order tham makes sense. With products, it might be better to have the entries ordered by price, for example. For faculty it would most likely be by their name.
2. Multiple groups, and only the groups selected cannot be easily specified. See the example below.

The group wrapper and anews modules provide a solution to this problem.

Example Usage
———-
Problem: I have hundreds of faculty, council members, and staff I want to specify at various points on the webpage. I have a CS page where I want to list the CS faculty. Elsewhere on the website, I have a University Contact page where I want to list everyone.

Solution:

-Create a single anews page that stores all people. Create different groups for CS Faculty, Council Members, etc. Make this page hidden.
-Sort it as desired, probably by name
-Create a group wrapper page and add the groups that you want displayed.

Todo
———–
It’s definitely conceivable of a time where this is insufficient.

-if you want to show items, but not necessarily the whole group
-if you want to show items in an order not specified

It should be pretty easy to extend the module to include these cases

————
These modules were written by Rich Lundeen

Follow

Get every new post delivered to your Inbox.

Join 36 other followers