Cannot normally load different content in one view. |
[eluser]dimaomni[/eluser]
Hi all, In general: I have three column site. Each column is located in own view. Left column has menu. I want to display different content in middle column when I click on links. What is best practice for this task? I try do it by 2 ways: - Send via GET view's file name and insert this value to $this->load->view($contentName); and it worked, however displayed page were incorrect displayed. - then I tried in middle column(separate view) to use require "". and nothing change as for me. controller cmain: Code: public function index($ilinkId) view vcontent: Code: <?php view vleftmenu: Code: <li><?php echo anchor('front/cmain/index/vabout', 'About');?></li> Now it seems that css doesn't load when I click on the link. Why ??? file structure(short): /site | |_images | |_a lot of |-style | |_ style.css | |__application | |_controllers | | |_front | | |_cmain.php | |_view | | |_front | | |_vcontent.php ...etc |_index.php thank you in advance!
[eluser]dimaomni[/eluser]
in firebug I changed path from style/main.css to /../style/main.css ant it works! But why style/main.css works only for site but not for http://site/index.php/front/cmain/index/vabout ? and etc... I changed path to css /../style/main.css and everything's work ok. So I have 2 question: about path.. And about best practice. Thanks! ![]()
[eluser]InsiteFX[/eluser]
Code: <base href="<?php echo base_url();?>"> InsiteFX
[eluser]CodeIgniteMe[/eluser]
In your view file [quote author="dimaomni" date="1309450263"] Code: <?php You should change Code: require "content/".$content.".php "; Code: require "application/view/front/content/{$content}.php"; Code: $this->load->view("front/content/$content"); When you include CSS files in your browser, you are then doing a Client-side include, which should start from the base path of your site. Try this. Code: <link href="<?=base_url()?>"style/style.css rel="stylesheet" /> |
Welcome Guest, Not a member yet? Register Sign In |