[eluser]dmol[/eluser]
Hi all,
I'm new to this forum and indeed CI so I'm not sure if I can ask this question here:
I have a CI website that has a standard header,sidebar,main content,footer layout.
The sidebar is dynamically generated from a DB and apart from the main content section of the page, they are the only parts that change.So the main content is one of several views.
When I load the main page, clicking on sidebar links just append that page to the main page (after the footer) which is no use so I need to use a redirect to load the whole page from scratch with the new content page.
I'm trying to use URL helper:redirect and URI->segment to catch which view to display but the problem is that it gets stuck in a redirect loop. How would this normally be done?
pseudo code:
Controller loads
if no URI segment
{
load view -> header
load view -> sidebar
load view -> default main content view
load view -> footer
}
if URI segment
{
$foo = URI segment(2) i.e requested page
redirect('itself/display_page','refresh');
}
function display_page()
{
load view -> header
load view -> sidebar
load view -> main content: view $foo
load view -> footer
}