Access Prohibited when copying and pasting new home.php

Asked

Viewed 132 times

0

I have a project and it is all in English on the main page being "home.php", I can access it normally in place using "localhost/Colwithgit", however, I need to make a version of this page in Portuguese, so I made a copy of home.php and renamed to home_br.php, however, when accessing this file with "localhost/Colwithgit/application/views/home_br.php" it gives the following error:

inserir a descrição da imagem aqui

I searched the Internet a lot, but I couldn’t figure it out. I use Windows 10 and I’m using shaman with Codeigniter. I tried to change in httpd-xampp.conf but this file of mine goes up to line 109 and in the tutorials I saw, I had to touch line 122 and it also does not have the place where it adds the instruction. What can I do to access this file?

1 answer

0


Hello! In Codeigniter you can never access view or model directly through the URL. Access to these files is via controller. Note that in your URL you notably access the application directory, the views directory and the own view, in this order:

localhost/CoLWithGit/application/views/home_br.php

To see this view, prepare a function, within some controller at your choice, call and display it, for example in a controller who called himself "alpha":

public function minha_view_portugues() {  
    $this->load->view('home_br.php');
}

You would access the view through:

localhost/CoLWithGit/alpha/minha_view_portugues

However, I recommend rather than employ views different depending on the language, employ the noble solution for internationalization and localization offered by Codeigniter which is the Language Class library:

https://www.codeigniter.com/userguide3/libraries/language.html

Although the library requires an initial study, its use saves days of rework, abstracts the language problem on the site, and exposes the content so that it is possible to be translated by translators external to the project in a second moment. Good luck!

  • 1

    Man, thanks a lot, it worked! I’m having problems on the page exactly like the other one that’s right, but now some images have disappeared even with the same directory.... But thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.