Re: Open Source CMS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For a work in progress, view http://www.mwclans.com/new_index.php

The login fields are a 'component' I include in the header.
The links are generated from the 'links' table; the primary_navigation links
are a class by the same name, and the 'footer_navigation' are also a
different category. All links on this page are generated from the Links
table, and each row has 90% of the properties the HTML 'a' tag can have (eg.
fields: id, link_text, href, target, onmouseover, onmouseout, onclick, name,
class, etc.). The class is the same as the category.

The content is pulled from an include file with the same ID number as this
page ("home" page), which is "1", and the scripts.

There are additional features, like a theme class which pulls a theme ID
from the DB (a `site_settings` table).

Here is an example of the source code for the above link:




<?php
$thispage = 1;
// define root directory
if (!defined('ROOT'))
{
    // Locate config.inc.php and set the basedir path
    $folder_level = ''; $i = 0;
    while (!file_exists($folder_level . 'config.inc.php'))
    {
        $folder_level .= '../';
        $i++;
        if ($i == 5){ die('Config file not found.'); }
    }

    // ROOT = base_directory/
    DEFINE('ROOT', $folder_level);
}

// include configuration file
include(ROOT . 'config.inc.php');

// include headers
include(ROOT . 'common/global.inc.php');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xmlns:v="urn:schemas-microsoft-com:vml" >
<head>
    <title><?php echo $siteTitle ?> - <?php echo $pageTitle  ?></title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml;
charset=utf-8" />
    <meta name="description" content="<?php echo $pageDescription ?>" />
    <meta name="robots" content="index, follow" />
    <link rel="shortcut icon" href="<?php echo ROOT ?>favicon.ico"
type="image/x-icon" />
    <?php include(ROOT . 'includes/scripts_' . $pageScripts . '.inc.php') ?>

    <link rel="stylesheet" type="text/css" href="<?php echo ROOT
?>lib/style/theme_<?php echo $currentStyle; ?>.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo ROOT
?>lib/style/layout.css" />
    <link rel="stylesheet" type="text/css" href="<?php echo ROOT
?>lib/style/notify.css" />
    <!--[if lt IE 7]>
    <style media="screen" type="text/css">
    .col1 {
        width:100%;
    }
    </style>
    <![endif]-->
</head>
<body>
<?php include(ROOT . 'includes/XFBML.inc.php') ?>
<div id="header">
    <?php include(ROOT . 'includes/header.inc.php') ?>
    <ul>
    <?php
        $result = $db->query('SELECT * FROM `links` WHERE `category` =
\'primary_navigation\'');

        while ($listitem = $db->fetch_array($result))
        {
            echo "\t" . '<li><a href="' . $listitem['href'] . '"';
            if (!empty($listitem['class']))
            {
                if (strtolower($listitem['text']) == strtolower($pageTitle))
                {
                    echo ' class="' . $listitem['class'] . ' active"';
                }
                else
                {
                    echo ' class="' . $listitem['class'] . '"';
                }
            }
            echo '>' . $listitem['text'] . '</a></li>' . "\n";
        }
    ?>
    </ul>
    <p id="layoutdims">&nbsp;</p>
</div>
<div class="colmask holygrail">
    <div class="colmid">
        <div class="colleft">
            <div class="col1wrap">
                <div class="col1">
                    <!-- Column 1 start - center -->
                    <?php
                        $result_1 = $db->query('SELECT * FROM `directories`
WHERE `id`=' . $pageFolder);
                        $row_1 = $db->fetch_row($result_1);
                        $folder_url = $row_1[2];
                        include(ROOT . $folder_url . 'content/' . $pageName
. '.inc.php'); # content/Homepage.inc.php
                    ?>
                <!-- Column 1 end -->
                </div>
            </div>
            <div class="col2">
                <!-- Column 2 start - left -->
                <?php
                    if (!empty($pageComponentsLeft))
                    {
                        $result = $db->query('SELECT * FROM `components`
WHERE `id` IN (' . $pageComponentsLeft . ');');
                        $count = $db->affected_rows;
                        $i = 1;

                        if ($count > 0)
                        {
                            while ($row = $db->fetch_array($result))
                            {
                                require_once($row['url']);
                                if ($i < $count)
                                {
                                    echo "\n" . '<br />' . "\n";
                                }

                                $i++;
                            }
                        }
                    }
                ?>
                <p>The CSS used for this layout is 100% valid and hack free.
To overcome Internet Explorer's broken box model, no horizontal padding or
margins are used. Instead, this design uses pixel widths and clever relative
positioning.</p>

                <!-- Column 2 end -->
            </div>
            <div class="col3">
                <!-- Column 3 start - right -->
                <?php
                    if (!empty($pageComponentsRight))
                    {
                        $result = $db->query('SELECT * FROM `components`
WHERE `id` IN (' . $pageComponentsRight . ');');
                        $count = $db->affected_rows;
                        $i = 1;

                        if ($count > 0)
                        {
                            while ($row = $db->fetch_array($result))
                            {
                                require_once($row['url']);
                                if ($i < $count)
                                {
                                    echo "\n" . '<br />' . "\n";
                                }

                                $i++;
                            }
                        }
                    }
                ?>
                <p>The holy grail 3 column liquid Layout has been tested on
the following browsers:</p>
                <!-- Column 3 end -->
            </div>
        </div>
    </div>
</div>
<div id="footer">
    <?php
        $sql = 'SELECT * FROM `components` WHERE `id` = ' . $siteFooter . '
AND `display` = 1';
        $result = $db->query($sql);
        $row = $db->fetch_row($result);

        if ($db->affected_rows > 0)
        {
            # /components/footerlinks.inc.php
            include(ROOT . $row[2]);
        }

    ?>
</div>
<!-- notification div -->
<?php
if ($Notify)
{
    include(ROOT . 'common/print_notices.php');
}
?>
<!-- END notificatoin div -->
</body>
</html>




Again, any questions/comments/critiques are welcome!!

Allen



On Wed, Jan 20, 2010 at 7:29 PM, Hendry <hendry.htc@xxxxxxxxx> wrote:

> Hi,
>
> Anyone can share your favorite PHP open source CMS to work with and
> what's the reason? I'm looking for something that easily extensible.
> I've googled and found severals but I'm still confused, some from the
> lists:
> - Drupal
> - Tomato CMS
> - modx
> - xoops
> - Symphony
>
> Thanks
>
> # Hendry
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux