CodeIgniter Forums

Full Version: Create a link
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

I am a beginner with CodeIgniter and I just need to do one things. So here it is, how can I make a link to ah html files on a other document? I have done <a href="../mydocument/myfile.html"> but I don't know if I pointing to my file.

And I am on a serveur.

So if ou understand my request, can you help me?

Thanks a lot.

P.S: sorry for the mistakes I'm not a English native.
The docs have listed several ways to call your desired URL using the URL Helper @ http://www.codeigniter.com/user_guide/he...elper.html
Just to make sure if we understand you: do you want to point to a different page inside your CodeIgniter structure (your own website), or do you want to link to content on other websites?
Keep in mind that CodeIgniter doesn't work with html files at all. All files are php files. But even then, you don't call any php files directly. All requests are done via the main index.php file.
The page's address (url) is constructed by calling the correct method inside a controller.

Example:
Controller name: Welcome.php
Method: public function display_welcome()

Let's assume that your website's main address is http://mywebsite.fr
To show the welcome message, you have to use this url:
http://mywebsite.fr/welcome/display_welcome

If you load the url helper, then there's a very easy way to generate hyperlinks:
PHP Code:
echo anchor('welcome/display_welcome','Click here to open the welcome page'); 
This will create the same hyperlink as mentioned before.

I hope this will help you.