CodeIgniter Forums
Setting "Home" Page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Setting "Home" Page (/showthread.php?tid=22696)

Pages: 1 2


Setting "Home" Page - El Forum - 09-17-2009

[eluser]mrwilson1[/eluser]
I am trying to get my base url to be www.shivabeach.com/

My directory structure looks like this

public_html/ci/system/application/ etc etc

My primary page named index.php is in the views directory, which is obviously a long long ways from the root directory to be picked up if someone types in the www.shivabeach.com. How do I set the base url in the config file (if there)to be a normal url or how do i set it to always go to www.shivabeach.com/ci/etc?

I guess what Im trying to say is, if someone comes to www.shivabeach.com I want my website to show up Smile

Thanks.


Setting "Home" Page - El Forum - 09-17-2009

[eluser]InsiteFX[/eluser]
Copy your index.php file to public_html, then set the base_url in your config.php file.

Enjoy
InsiteFX


Setting "Home" Page - El Forum - 09-18-2009

[eluser]mrwilson1[/eluser]
I have set the base_url to the base directory (www.shivabeach.com) in the config file and copied the file over to the public_html. However it will load nothing from the controller nor respond to codeigniter codes such as linking, heading etc.ie "<?php echo link_tag('css/shiva.css');?>" Is my problem the method of loading the file from the controller?

<code>$config['base_url']= "http://shivabeach.com/";</code>

Normally this would be $this->load->view('index.php', $data)I have tried many different ways of loading this and nothing works. I have a feeling I am attacking this from the wrong angle here. I guess my problem is that the index.php file is the first page hit when a person arrives, and the config / controller files dont even come into issue as they are well away from the index file.

Am I explaining this correctly or just missing something here? I know this can be done Smile


Setting "Home" Page - El Forum - 09-18-2009

[eluser]überfuzz[/eluser]
Well you definitely got a lot of footwork in your post. I not entirely sure of what you want... :-S

Have you tried to rout your default controller?

routes.php in config folder.
Code:
$route['default_controller'] = "default_controller";



Setting "Home" Page - El Forum - 09-18-2009

[eluser]mrwilson1[/eluser]
I knew I wasn't being clear. Smile
all I want is for when someone comes to the site, to have the right index.php pop up.Or config my site to pick up the index.php where ever it is.
with codeigniter the normal home page would be:
<code>http://www.shivabeach.com/ci/index.php/blog</code> and thats fine. How do I make it so when someone comes to my website that's the default page?
my base url is
<code>$config[‘base_url’]= “http://shivabeach.com/”;</code>
My route is set at
<code>$route['default_controller'] = "blog"; </code> which is the controller I want loaded.
My index page is
<code>$config['index_page'] = "index.php";</code>
I now have the php file in the views directory because I cannot get it to work in the public_html directory.

To put it another way, do I have to make a normal index.php page, put it in the root then link to pages made with codeigniter?


Setting "Home" Page - El Forum - 09-18-2009

[eluser]überfuzz[/eluser]
Did you re-rout your default controller?

Make a controller that loads a view file.
test.php - is to be uploaded in the application/controllers folder
Code:
&lt;?php

class Test extends Controller {

    function Test()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->view('test_view');
    }
}

test_view.php - is to be uploaded in the application/viewers folder
Code:
<h1>Darn it's working</h1>

Set the default controller like this:
Code:
$route['default_controller'] = "test";

Now you can try www.yoursite.com/index.php/test and www.yoursite.com and see what it shows.


Setting "Home" Page - El Forum - 09-18-2009

[eluser]mrwilson1[/eluser]
I have no problem making a page that works and have done so. I have done the above in making my index.php file which is fully accessible at www.shivabeach.com/ci/index.php/blog

Or was, even after making your view and controller I cant get anything to show up now.

I keep getting errors like this "Fatal error: Call to undefined function heading() in /home/shivabe1/public_html/ci/index.php on line 16" so even if the test page works I cant get past the index.php to see it.

Im just going to delete it all and reinstall it and start over and see what goes from there.

Thank you very much. And no, not going to give up Smile


Setting "Home" Page - El Forum - 09-18-2009

[eluser]mrwilson1[/eluser]
Ok, I replaced my index.php with the one that came with codeigniter. Now I see my pages and the test file. I now understand that all pages to be viewed have to reside in the views directory.

That still leaves me with the original problem, of how to make http://www.shivabeach.com/ci/index.php/test (or whatever) the default page when someone types in www.shivabeach.com. Right now all they get is an index of public_html.


Setting "Home" Page - El Forum - 09-18-2009

[eluser]cahva[/eluser]
Move the index.php from ci folder to the parent folder (document root of your site). Then edit the index.php and change $system_folder and $application_folder point to their locations.

eg. if you have the default installation those would be like this:

Code:
$system_folder = 'ci/system';
$application_folder = 'ci/system/application';



Setting "Home" Page - El Forum - 09-18-2009

[eluser]mrwilson1[/eluser]
Now THATS what Im looking for! Thank you!

That worked perfectly. Pls accept my apologies for not explaining what I wanted more coherently