Welcome Guest, Not a member yet? Register   Sign In
PHP basic to CI?
#1

[eluser]JingCleoVil[/eluser]
I am new from CI this is just I wanted to know to have a Master Page so that i will not redundantly make the layout in all pages. Here is my basic code.

index.php - This is my Master Page.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;

&lt;head&gt;
    &lt;title&gt;Artisan Websolutions&lt;/title&gt;
    &lt;link rel="SHORTCUT ICON" href="images/favicon.png" /&gt;
    &lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&gt;
&lt;/head&gt;

&lt;body&gt;
<div id="global_wrapper">
    <div id="wrapper">
        <div id="nav_top">
            <div class="nav_left"></div>
            <div class="nav_mid">
                &lt;?php include("includes/nav.php");?&gt;
            </div>
            <div class="nav_right"></div>
        </div>
        <div id="cont_wrapper">
            <div class="cont_upper"></div>
            <div class="cont_mid">
                <div id="cont_main">
                    &lt;?php
                        $default ='home';
                        $page = isset($_GET['page']) ? $_GET['page'] : $default;
                        if (!file_exists('includes/'.$page.'.php')) {
                            echo 'no such file';
                        }
                        include('includes/'.$page.'.php');
                    ?&gt;
                </div>
            </div>
            <div class="cont_lower"></div>
        </div>
        <div id="footer">&lt;?php include("includes/footer.php")?&gt;</div>
    </div>
</div>
&lt;/body&gt;
&lt;/html&gt;

nav.php - my main navigation
Code:
<ul id="navigation">
    <li><a href="?page=home"><span><img src="images/home_n.png"></span></a></li>
    <li><a href="?page=aboutus"><span><img src="images/aboutus.png"></span</a></li>
</ul>

home.php - my main page

Code:
<div class="main_content">
<h1>My Main Page</h1>
<p>Blah blah blah</p>
</div>

home.php - About US

Code:
<div class="main_content">
<h1>About Us</h1>
<p>Blah blah blah</p>
</div>

Its obviously when you click "about us" link the page will display here
Code:
<div id="cont_main">
?php
$default ='home';
$page = isset($_GET['page']) ? $_GET['page'] : $default;
if (!file_exists('includes/'.$page.'.php')) {
    echo 'no such file';
}
include('includes/'.$page.'.php');
</div>

Now I just wanted to do a basic CI code to make this thing happen same process but CI made .Thanks!

PS: SOrry for my English.


Messages In This Thread
PHP basic to CI? - by El Forum - 05-30-2009, 07:02 AM
PHP basic to CI? - by El Forum - 05-30-2009, 07:40 AM
PHP basic to CI? - by El Forum - 05-30-2009, 07:53 AM
PHP basic to CI? - by El Forum - 05-30-2009, 09:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB