Welcome Guest, Not a member yet? Register   Sign In
if page is equal to home
#11

[eluser]ppwalks[/eluser]
right i will post my code for you to look at:

if you use the index to swap files you can do it like this:
index.php - all views are in sub folder "main"
Code:
<?php $this->load->view('main/header'); ?>
     <div id="main-page">
         &lt;?php $this->load->view("main/".$main); ?&gt;
            </div>
            <br />
  </div>


&lt;?php $this->load->view('main/footer'); ?&gt;


So as I load the view say products my controller still loads the 960 wide view but I have split it as you would with html treat them indepentantly so my products page I simply call another view within the view.

so here is my products view

Code:
<ul id="venus-stone-products">
<li class="menu_sidebar">
     &lt;?php $this->load->view('main/main_sidebar'); ?&gt;
</li>
<li class="all_products">
  <h1 class="products-h1">All Products</h1>
         <ul id="all-product-view">
  &lt;?php
   if (count($products) > 0){
    foreach ($products as $key => $product){
    echo "<li class=\"product\"> \n";
    echo "<ul>";
    echo "<li class=\"left\">\n";
    echo "<img src=' ".base_url() .$product[' alt='".$product[' title='".$product['/><br /> \n";
    
    echo "<h2>".$product['name']."</h2>\n";
    
    echo "<span class=\"style\"><b>Style/ Colour:</b> " . $product['style'] . "</span><br />\n";
    echo "<span class=\"price\">Price: £" . $product['price'] . "</span><br />\n";
    echo "</li>\n";
    echo "<li class=\"right\">\n";
    echo "<h3>Quick Overview</h3>";
    echo  "<p>" .word_limiter($product['longdesc'], 50). "</p><br />\n";
     $moreInfo = array (
        'src' => base_url().'images/more-info-btn.png',
        'alt' => 'More Product Information',
                'class' => 'more-info-btn',
        );
    echo anchor('paving_stone/' . $product['id'] , img($moreInfo), array('title' => $product['name'], 'class'=>'more-info' ))."\n";
    ?&gt;
                <br />
                &lt;?php
                  $addCart = array (
        'src' => base_url().'images/add-to-cart-btn.png',
        'alt' => 'Add Product to Shopping Cart',
                'class' => 'shopping-cart',
        );
     echo anchor('cart/'.$product['id'],img($addCart), array('alt' => 'Add To Cart', 'class'=>'add-to-cart'));
        
        
    echo "</li>\n";
    echo "</ul>\n";
    echo "</li>\n";
    }
    } else {
     echo "<p class=\"no-records\">No Records found</p>";
     }
  ?&gt;
  </ul>
        <div id="pagin">
        &lt;?php echo $this->pagination->create_links(); ?&gt;
        </div>
</li>
</ul>

As you can see i have just loaded the view inside of the curent view
and will only load on that page providing you load the views dynamically like i previously have shown you


Messages In This Thread
if page is equal to home - by El Forum - 04-25-2012, 04:13 AM
if page is equal to home - by El Forum - 04-25-2012, 05:51 AM
if page is equal to home - by El Forum - 04-25-2012, 05:57 AM
if page is equal to home - by El Forum - 04-25-2012, 06:11 AM
if page is equal to home - by El Forum - 04-25-2012, 06:13 AM
if page is equal to home - by El Forum - 04-25-2012, 06:23 AM
if page is equal to home - by El Forum - 04-25-2012, 06:26 AM
if page is equal to home - by El Forum - 04-25-2012, 06:29 AM
if page is equal to home - by El Forum - 04-25-2012, 06:30 AM
if page is equal to home - by El Forum - 04-25-2012, 06:34 AM
if page is equal to home - by El Forum - 04-25-2012, 06:41 AM
if page is equal to home - by El Forum - 04-25-2012, 06:46 AM
if page is equal to home - by El Forum - 04-25-2012, 11:22 AM
if page is equal to home - by El Forum - 04-25-2012, 11:39 AM
if page is equal to home - by El Forum - 04-25-2012, 11:45 AM
if page is equal to home - by El Forum - 04-25-2012, 11:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB