Welcome Guest, Not a member yet? Register   Sign In
MULTI TEMPLATES?
#1

[eluser]cocopops[/eluser]
Hello!

I am new to codeigniter and i am expereimenting a bit with templates n stuff. The website is www.lonnagency.se and i use multilanguages for the website so, when u click on the english flag on the first page, u come to for example view_home, view_ladies, view_gents etc. when you click on the big logo/picture on the front page you come to view_homeSV, view_ladiesSV, view_gentsSV (SV = svenska = swedish).


in the views folder, i have a php file called TEMPLATE, which determines the outlook of the page in which order the head, navigation, main and footer comes in etc. here is one part of the code from the template.php document:

Code:
<?php if($start_main): ?>
          <div id="start_container">
              
              <div id="angel1"></div>
                <div id="start_main">
                &lt;?php echo $start_main; ?&gt;
                </div>
                <div id="angel2"></div>
            
            </div>
            
        &lt;?php else: ?&gt;
            
        <div id="container">
            <div id="header">
            &lt;?php echo $header; ?&gt;
          </div>
        
            <div id="navigation">
                &lt;?php echo $navigation; ?&gt;
            </div>

but the problem is, i have one file in the views folder called view_navigation.php, which determines the navigation, BUT the links in it are linked to the ENGLISH site, ex:

Code:
<a href="&lt;?php echo base_url();?&gt;index.php/ladies"><img src="&lt;?php echo base_url(); ?&gt;images/buttons/ladies.gif" style="margin-left:33px; margin-top:30px;"/></a>

so, i have one template that consist of a navigation code which in term is only navigating to the ENGLISH site links from the SWEDISH page.

i dont really know how i should get through this now? how should i manage to get a template that could work for both, depending on if im on view_homeSV.php or view_home.php etc? should i have MULTIPLE TEMPLATES?

help me out folks!! i appreciate all help! thaanks!!
#2

[eluser]umefarooq[/eluser]
Hi you don't need multiple template you need multiple languages here is the link where you can see how to use multi languages.

http://maestric.com/doc/php/codeigniter_i18n

you have to check which language and call you template and you can manage you navigation also with that.
#3

[eluser]cocopops[/eluser]
but i didnt put multiple language that way..i did it completely different, so its not about the language, its about how the navigation is showing

because i want the owner of the website to easily be able to edit the content of the website text, so she can do it throw scaffolding. so there are two boxes in the scaffolding page where you can edit the text, one for english one for swedish. ive made doublets of each page, one showing the english text and one showing the swedish text...its just this with the navigation, since its using one template..
#4

[eluser]umefarooq[/eluser]
yes let her add both text but you can check that which language you have select right now then you can display that language text on the page you displaying. with the help of following code you can check which language is.

Code:
$this->uri->segment(1);

if you saving data in database let it be there

Code:
$lang = $this->uri->segment(1);
if($lang == 'en')
$data['content'] = $row->en_content;
else
$data['content'] = $row->sv_content;

$this->load->view('home',$data);

no need to create more view separately for both languages you can use same views




Theme © iAndrew 2016 - Forum software by © MyBB