Welcome Guest, Not a member yet? Register   Sign In
make a database call from index.php ???
#1

[eluser]Gewa[/eluser]
Hi,
I am making a multi-site codeigniter app. So i need in index.php to make a call to database and see the website's settings. I need just to be sure that the site is activated to show the content loading appropriate application folder. Is there a way to use db class here? what you could suggest?
#2

[eluser]WanWizard[/eluser]
No, there isn't.

I suggest using code in the index.php to determine the application folder based on the hostname, then deal with availability, access, maintenance mode, what have you, in your application (the MY_Controller seems like a logical place for these kind of checks).
#3

[eluser]Gewa[/eluser]
So you think in controller is better to check ? yeah easyer maybe.... thanks!
#4

[eluser]Gewa[/eluser]
then one thing. is it possible in index.php define a config variable, or a constant which I can acess in the controller?
What would be the best for this?
I need to pass somehow the web-site alias , then to make a check...
#5

[eluser]WanWizard[/eluser]
Easiest is to define a constant.

I have defined some extra as well, as I have the opposite issue: multiple frontends (versions of 'index.php'), with a single application.
#6

[eluser]coffeeandcode[/eluser]
[quote author="Gewa" date="1279813198"]then one thing. is it possible in index.php define a config variable, or a constant which I can acess in the controller?
What would be the best for this?
I need to pass somehow the web-site alias , then to make a check...[/quote]

I use the same WEBROOT, IMG, CSS, etc constants regardless of which framework I'm working with (keeps things consistent if I need to change frameworks), and with CI I define them at the top of index.php. It works great :-)




Theme © iAndrew 2016 - Forum software by © MyBB