CodeIgniter Forums

Full Version: Implementation of BackEndPro
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]elektron[/eluser]
Please,

I know what I am asking are basics. Any way I don't get the point of MVC. So for my reference could You be so kind to waist a little time to explain me how this code should look implemented in codeigniter with BEP.
And where is the correct location for this files.


i.e.
my navigation menu (working fine under .html and .php) is separated as follows

- menuStruct.php

Code:
<?php
    // Main menu items
    $mainMenu['Home']      = 'index.php';
    $mainMenu['About us']  = 'about.php';
    $mainMenu['Projects']  = 'projects.php';
    $mainMenu['Contact']   = 'contact.php';
    $mainMenu['User area']    = 'user.php';
    
    // Sub menu items
    $subMenu['Projects']['SubMenu-1'] = 'p2.php';
    $subMenu['Projects']['SubMenu-2'] = 'p3.php';
    $subMenu['Projects']['SubMenu-3'] = 'p4.php';
    $subMenu['Projects']['SubMenu-4'] = 'p5.php';
?>

- menuHandler.php

Code:
<?php
function createMenu($actLink){
    include_once('menuStruct.php');
    echo '<ul class="sf-menu">';
    // Get actual Main menu    
    foreach ($mainMenu as $menu => $link) {
        echo '<li';
              if ($_SERVER['SCRIPT_NAME'] == '/MW_FE_MENU_OK/'.$link)
              echo ' class="current_page_item"';
        echo '><a href="'.$link.'" title="'.$menu.'">'.$menu.'</a>';
        if  (isset($subMenu[$menu])) {
         echo '<ul>';
           foreach ($subMenu[$menu] as $menuSub => $linkSub) {
                  echo '<li><a href="'.$linkSub.'" title="'.$menuSub.'">'.$menuSub.'</a></li>';
           }
         echo '</ul>';  
        }
        echo '</li>';
    }
    echo '</ul>    ';
}
?>

- header_blok.php

Code:
//... some code
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>mojWEB – Premium Portal</title>
<link rel="stylesheet" href="css/blue_web.css" type="text/css" media="screen" />
//... some code
<script type="text/javascript" src="js/mojWEB_custom.js"></script>
//... some code
</head>

- js_blok.php

Code:
<script type="text/javascript">
//<![CDATA[
        jQuery(function(){
            jQuery('ul.sf-menu').superfish();
        });
//]]>
</script>
<!--[if lt IE 9]>
<script type="text/javascript">
//<![CDATA[
        jQuery(function(){
            jQuery('ul.sf-menu').superfish({
            speed : 1
            });
        });
//]]>
</script>
<![endif]-->

//... other java

- blue_web.css

Code:
#header {width: 100%;border-top: 3px solid #0C3569;background: #FFF url("../images/bg_div_header.jpg") bottom left repeat-x;min-height: 11em;height: auto;}
.center {width: 9;margin: 0 auto;}

//some other css

.ss_logo {display: block;width: 214px;height: 52px;text-indent: -9999px;background: transparent url("../images/logo_bg.png") left top no-repeat;float: left;margin: 20px 0 30px 0;}
.ss_logo a {display: block;width: 100%;height: 100%;outline: none;cursor: pointer;}

//...

- flash_blok.php

Code:
<script type="text/javascript" src="js/swfobject.js"></script>
<link rel="shortcut icon" href="Fav.ico" type="image/x-icon" />
</head>
<body bgcolor="#bbbbbb" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" scroll="no">
    <div id="flashcontent">
        <strong>You need to upgrade your Flash Player.</strong>
    </div>
    <script type="text/javascript">
        var so = new SWFObject("flash/slideshow.swf", "sotester", "100%", "100%", "8", "#ffffff");
        so.addParam("allowFullScreen", "TRUE");
        so.addParam("scale", "noscale");
        so.addParam("menu", "false");
        so.write("flashcontent");
    </script>

- somepage.php

Code:
<?php     include_once('header_blok.php');?>
<?php require_once("menuHandler.php"); ?>
<body>
    <div id="header">
    <div class="center relative">
    <h1 class="ss_logo"><a href="index.php" title="mojWEB  Premium Portal">mojWEB – Premium Portal</a></h1>
         <div id="nav_main">&lt;?php createMenu('index.php'); ?&gt;</div>
    </div>
    </div>
//...
// content
//...
&lt;?php include_once("flash_blok.php"); ?&gt;

//...
// footer
&lt;/body&gt;
&lt;?php     include_once('js_blok.php');?&gt;
&lt;/html&gt;

I hope reply of this extensive post could be also a good guide for other codeigniter BEP beginner users. As it is implementation of front end in working environment.