Welcome Guest, Not a member yet? Register   Sign In
Problems with the form helper and scaffolding when you change the app base and don't show index.php
#1

[eluser]Doug Lerner[/eluser]
I changed the base, moved the main framework stuff above the webroot, and added a .htaccess file so I could have URLs like

http://mydomain.com/CI/app1/users/addUser

instead of the clunkier

http://mydomain.com/CI/CodeIgniter/index...rs/addUser

But when you do this (1) scaffolding doesn't work any more and (2) the form open function in form helper also sets a URL that doesn't work anymore.

Is there a way around this?

Thanks,

doug
#2

[eluser]Doug Lerner[/eluser]
Actually, do people make much use of the form helper at all?

I mean, if one purpose of MVC is too keep as much code as possible out of the view, isn't it better to just write your form tags in regular old HTML? Isn't that easier for the designers?

doug
#3

[eluser]Pascal Kriete[/eluser]
Did you change your base_url to reflect the filesystem change? Also, did you remove index.php from the config file?

Those are the two things that I could see causing problems.
And yes, I do use the form helper - albeit just for the form_open tag.
#4

[eluser]Doug Lerner[/eluser]
[quote author="inparo" date="1215801659"]Did you change your base_url to reflect the filesystem change? Also, did you remove index.php from the config file?

Those are the two things that I could see causing problems.
And yes, I do use the form helper - albeit just for the form_open tag.[/quote]

index.php doesn't have to be set in the config file to represent the default index function for classes? Or is that just separate?

Thanks,

doug
#5

[eluser]Doug Lerner[/eluser]
OK. I got it to work. I set the ['index_page'] variable to a blank.

And then I figured out I needed to set this

$config['base_url'] = "http://www.mydomain.com/CI/app1";

to the root of my *application* - not to the root of CodeIgntor, (as it says in the comments). I have the actual CodeIgniter main files above the public_html root. That is defined in the main index.php file (why not in config.php?) as:

$system_folder = "/home/myname/ci-system-1.6.3";

so the ['base_url'] was something different from what I thought it was.


Now scaffolding is working and I think everything is ok.

I think I need to write up everything I did step-by-step to remember all I did and all I need to change if I "clone" this framework to work on another app.

I am still getting confused about which $this I am talking about sometimes.


doug
#6

[eluser]Pascal Kriete[/eluser]
Perfect, exactly what I was shooting for. Glad you got it worked out, despite my rather imprecise suggestion.

All the path definitions in index.php are used to locate the other files, so they're filesystem paths. CI uses the application_folder variable to find the config file, so you can't move it to config.php Smile .

base_url is used in conjunction with index_page to dynamically generate correct urls (such as anchor tags).

Hope that clears it up a bit.
#7

[eluser]Doug Lerner[/eluser]
[quote author="inparo" date="1215867946"]Perfect, exactly what I was shooting for. Glad you got it worked out, despite my rather imprecise suggestion.

All the path definitions in index.php are used to locate the other files, so they're filesystem paths. CI uses the application_folder variable to find the config file, so you can't move it to config.php Smile .

base_url is used in conjunction with index_page to dynamically generate correct urls (such as anchor tags).

Hope that clears it up a bit.[/quote]

Yes, that helps. Thanks.

doug

p.s. You mean the system_folder variable rather than the application_folder variable, right?
#8

[eluser]Pascal Kriete[/eluser]
Come to think of it, it's both. For the config file, it'll be the application_folder variable since it's in the application folder. However, the config class (which loads the file) is included by using the system_folder variable. So one won't work without the other.
#9

[eluser]Colin Williams[/eluser]
Quote:I mean, if one purpose of MVC is too keep as much code as possible out of the view, isn’t it better to just write your form tags in regular old HTML?

MVC separates database interaction from business logic from display. It doesn't necessarily mean you need to strip code from your views, just database interaction and business logic. I think keeping views to only spitting out variables is a good goal, but I do find form helper functions extremely useful, especially when the nature of the form is dynamic, or you've got massive arrays to load into dropdowns (choose state, choose country, etc.) In these cases, the form helper does reduce the amount of code needed in the view.

And any professional designer will be able to handle the form helper functions, especially with the user guide handy.
#10

[eluser]Doug Lerner[/eluser]
[quote author="inparo" date="1215869591"]Come to think of it, it's both. For the config file, it'll be the application_folder variable since it's in the application folder. However, the config class (which loads the file) is included by using the system_folder variable. So one won't work without the other.[/quote]

Ah, found it.

$application_folder = ".";

That was also in the index.php file.

doug




Theme © iAndrew 2016 - Forum software by © MyBB