Welcome Guest, Not a member yet? Register   Sign In
"Require_Once" Help Please
#1

[eluser]razerone[/eluser]
Hi.

I have a module in my application / module folder/ install

I need that to require_once('application/module/install'); I got it to work but every time I click on my domain name it goes to that page.

I have a view controller that it goes to once installed it will go to a folder called install complete I have a controller & view for that. On the view I have a link saying to to home page Once I click on that I would like it to some how disable the require once from index.php page. And only works when up load it to new server.

Any ideas.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Stage3 extends CI_Controller {

function index() {
$this->load->view('header');
$this->load->view('stage3');
$this->load->view('footer');
}
}
#2

[eluser]noideawhattotypehere[/eluser]
Random idea, might not be the best but this will work

Code:
require_once(‘application/isinstalled.php’);
if(!defined('INSTALLED') {
require_once(‘application/module/install’);
}
after completing your installation make a function that puts this into isinstalled.php
Code:
<?php
define('INSTALLED', true);

You could also use CI config system but im too lazy to explain :p
#3

[eluser]razerone[/eluser]
[quote author="noideawhattotypehere" date="1382017215"]Random idea, might not be the best but this will work

Code:
require_once(‘application/isinstalled.php’);
if(!defined('INSTALLED') {
require_once(‘application/module/install’);
}
after completing your installation make a function that puts this into isinstalled.php
Code:
<?php
define('INSTALLED', true);

You could also use CI config system but im too lazy to explain :p[/quote]

Thanks I am in the process of making a install database wizard for codeigniter just two stages two go saves people from going in the back end and entering in details. This module will get you to enter in details and then it will auto fill database config file. for HMVC codeigniter. I have got the database stage to work just working on auto base url form and auto email form all on different stages of install process for people who want custom hmvc template engine.
#4

[eluser]razerone[/eluser]
[quote author="noideawhattotypehere" date="1382017215"]Random idea, might not be the best but this will work

Code:
require_once(‘application/isinstalled.php’);
if(!defined('INSTALLED') {
require_once(‘application/module/install’);
}
after completing your installation make a function that puts this into isinstalled.php
Code:
<?php
define('INSTALLED', true);

You could also use CI config system but im too lazy to explain :p[/quote]

Just tried it would not work
Code:
require_once('application/modules/install');

if(!defined('INSTALLED') {
require_once('application/modules/install');
}
#5

[eluser]razerone[/eluser]
I am getting this error

Parse error: syntax error, unexpected '{' in /home/cws01/public_html/index.php on line 5


Code:
require_once('application/modules/install/installed');

if(!defined('INSTALLED') { <-- Error

require_once('application/modules/install');

}

installed.php application / install / controllers / installed.php

Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Installed extends MX_Controller {

function installed() {
  
  define('INSTALLED', true);
}

}
#6

[eluser]noideawhattotypehere[/eluser]
ofc, i missed a ) in there :p dont blindly copy paste everything. if you run that define it wont be saved when visiting that page another time. you need to save it into some file that is being included before your install module.
#7

[eluser]ivantcholakov[/eluser]
Just a hint:

Instead of
Code:
require_once(‘application/isinstalled.php’);

write
Code:
require_once ‘application/isinstalled.php’;
(without the brackets) if you don't care about the returned result. This is a more speedy way.




Theme © iAndrew 2016 - Forum software by © MyBB