Welcome Guest, Not a member yet? Register   Sign In
  Default Installation Failed
Posted by: El Forum - 10-09-2007, 03:00 AM - No Replies

[eluser]meridimus[/eluser]
Hey Guys,

Just installed a fresh version of CI to my new development server at work and for some reason the default page is Error 404. All I've changed is the root directory (and double checked it's correct) and the database variables. When I've installed previously it always has a welcome message, I'm not seeing this, just a 404.

The server is running IIS on Windows Server 2003 with PHP Version 5.1.6

It's just a test server since I'm the only PHP coder, I'm used to either a WAMP or linux environment so any heads up on what problems could exist under this setup would be good to know. PhpMyAdmin is running fine and I can connect to the MySQL server with CocoaMySQL from my mac.

If you need any further information let me know.

Thanks!


  looking library, something like scaffolding
Posted by: El Forum - 10-09-2007, 12:44 AM - No Replies

[eluser]GSV[/eluser]
I need SUBJ with sort ability and posibilities to set fields and some properties for representing.

Thank you.


  [FIXED] language in url working local not on mt hosting
Posted by: El Forum - 10-08-2007, 06:22 PM - No Replies

[eluser]yusufdestina[/eluser]
I've just finished a site where the language is specified in the url like: http://www.mysite.com/en/
If no language is given it takes a default one.
based on this thread : http://ellislab.com/forums/viewthread/47189/
I'm using two hooks for this.

Code:
$hook['pre_system'] = array(
                                'class'    => 'user_pref',
                                'function' => 'user_language',
                                'filename' => 'user_pref.php',
                                'filepath' => 'hooks'
                                );
$hook['post_controller_constructor'] = array(
                                'class'    => 'set_lang',
                                'function' => 'setLanguage',
                                'filename' => 'set_lang.php',
                                'filepath' => 'hooks'
                                );
hooks/user_pref.php
Code:
<?php
class user_pref {
    var $languages = array (
        'en' => 'english',
        'nl' => 'dutch',
        'fr' => 'french'
    );
        
    var $browser_lang;
        
    function user_pref(){
        list($this->browser_lang) = explode(",",getenv('HTTP_ACCEPT_LANGUAGE'));
    }
    function user_language() {
        if(isset($_SERVER['PATH_INFO'])){
                $pref = explode('/', trim($_SERVER['PATH_INFO'], "/"));
                if (isset ($this->languages[strtolower($pref[0])])) {
                       $GLOBALS['language'] = $pref[0];
                        array_shift($pref);
                        $_SERVER['PATH_INFO'] = implode('/', $pref);
            } else {
                $GLOBALS['language'] = 'nl';
            }
        }else {
                  $GLOBALS['language'] = (isset ($this->languages[strtolower($this->browser_lang)]))? strtolower($this->browser_lang) : 'nl';
            //$GLOBALS['lang'] = 'nl';
            }
    }
}
?>
hooks/set_lang.php
Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');
class set_lang{
    var $sitelang;
    var $lang;
    
    function set_lang(){
        $this->obj =& get_instance();
    }
    function setLanguage(){
        $this->obj->sitelang  = $GLOBALS['language'].'/';
        $this->obj->language  = $GLOBALS['language'];
    }
}
?>
No extra modifications in the routes file are needed, note this works fine localy and tested recently on another server online, but fails on Media Temple (gs) running php5.
This is what i get when browsing without a language set in the url:
Code:
DEBUG - 2007-10-08 16:26:53 --> Config Class Initialized
DEBUG - 2007-10-08 16:26:53 --> Hooks Class Initialized
DEBUG - 2007-10-08 16:26:53 --> user_pref Class Initialized
DEBUG - 2007-10-08 16:26:53 --> user_pref Class constructer var browser_lang: en-us
DEBUG - 2007-10-08 16:26:53 --> user_pref Class method user_language Initialized
DEBUG - 2007-10-08 16:26:53 --> user_pref Class method user_language PATH_INFO not set
DEBUG - 2007-10-08 16:26:53 --> user_pref Class method user_language using default language
ERROR - 2007-10-08 16:26:53 --> 404 Page Not Found -->
This is when i define a language in the url
Code:
DEBUG - 2007-10-08 16:28:48 --> Config Class Initialized
DEBUG - 2007-10-08 16:28:48 --> Hooks Class Initialized
DEBUG - 2007-10-08 16:28:48 --> user_pref Class Initialized
DEBUG - 2007-10-08 16:28:48 --> user_pref Class constructer var browser_lang: en-us
DEBUG - 2007-10-08 16:28:48 --> user_pref Class method user_language Initialized
DEBUG - 2007-10-08 16:28:48 --> user_pref Class method user_language PATH_INFO is set.
DEBUG - 2007-10-08 16:28:48 --> user_pref Class method user_language -> found language in array set GLOBALS lang: nl
My .htaccess file...
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /dev
    
    RewriteRule ^public/css/(.*\.css) combine.php?type=css&files;=$1
    RewriteRule ^public/js/(.*\.js) combine.php?type=javascript&files;=$1
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^(/index\.php|/img|/js|/css|/robots\.txt|/favicon\.ico)
    
    RewriteRule ^(.*)$ index.php/$1 [L]
    
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>
Help....


  New Layout View Library Supporting Partial Views
Posted by: El Forum - 10-08-2007, 03:44 PM - No Replies

[eluser]Gyorgy Fekete[/eluser]
Update 2 available here: http://ellislab.com/forums/viewthread/62521/

Hello,
Let's face it CodeIgniter is good, but sucks on partial views. So I created a layout based view on top of the existing view method that CI offers.

How it works:
I view can be a partial view (a part of the page) or a layout view which defines where the partial views are on the page. For ex:

layout view

Code:
&lt;?=$header;?&gt;
&lt;?=$content;?&gt;
&lt;?=$footer;?&gt;

header view
Code:
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
...

Now the tricky part comes in. In theory a partial view could be also a layout view. This is no problem for the library. You can set a new layout inside a master layout and add partials to that layout or create a new layout inside of it and so on...

As you can see I suck on writing tutorials. So I'm just going to paste here the library and attach an example files.

Code:
&lt;?php
class Layout
{
    var $obj;
    var $_layout;
    var $_parts = array();
    var $_datas = array();
    
    /**
    * @param array If a config file exists CI autoloads it then we have to parse it.
    */
    function __construct($configData = null)
    {
        $this->obj =& get_instance();
        
        if ($configData)
        {
            $this->readConfigData($configData); //reading the config data
        }
        
    }
    
    function readConfigData($data)
    {
        $parts = $data['parts'];
        $this->_layout = $data['layout'];
        
        foreach ($parts as $key => $value)
        {
            if ($value == ':layout:')
            {    
                $this->_parts[$key] = new Layout($data[$key]);
                $this->$key =& $this->_parts[$key];
            }
            else
            {
                $this->_parts[$key] = $value;
            }            
        }
    }
    
    /**
    * Passing a data array to a specific part view
    *
    * @param string The name of the partial view (not the file name)
    * @param array The data to be passed to this partial view
    */
    function addData($part,$data = array())
    {
        if ( $this->hasPart($part) )
        {
            if ( $this->hasData($part) )
            {
                $this->_datas[$part] = array_merge($this->_datas[$part],$data);
            }
            else
            {
                $this->_datas[$part] = $data;
            }
        }
    }
    
    /**
    * Adds a partial view to the layout
    *
    * @param string The name of the partial view (this will be passed as a data array to the master layout)
    * @param string The filename of the partial view (with or without a subfolder)
    * @param array Optional data array to be passed to the partial view
    */
    
    function part($part,$view,$data = array())
    {
        $this->_parts[$part] = $view;
        $this->_datas[$part] = $data;
    }
    
    /**
    * Creates a new layout
    *
    * @param string The name of the new layout
    */
    
    function newlayout($part)
    {
        $this->_parts[$part] = new Layoutext();
        $this->$part =& $this->_parts[$part];
    }
    
    /**
    * Check is a partial view exists
    *
    * @param string The name of the partial view
    */
    
    function hasPart($part)
    {
        return isset($this->_parts[$part]);    
    }
    
    /**
    * Check if a partial view has data
    *
    * @param string The name of the partial view
    */
    
    function hasData($part)
    {
        return isset($this->_datas[$part]);
    }
    
    /**
    * Sets the layout
    *
    * @param string The filename of the layout
    */
    
    function layout($srcLayout)
    {
        $this->_layout = $srcLayout;
    }
    
    /**
    * Gets the layout filename
    */
    
    function getLayout()
    {
        return $this->_layout;
    }
    
    /**
    * Outputs the whole layout
    *
    * @param bool Whether to output it to the bowser or return it for reuse.
    */
    
    function view($return = false)
    {
        $tmp_parts = array();
        $tmp_data = array();
        foreach ($this->_parts as $part => $view)
        {
            if (isset($this->_datas[$part]))
            {
                $tmp_data = $this->_datas[$part];
            }
            
            if (is_object($view) )
            {
                $tmp_parts[$part] = $view->view(true);
            }
            else
            {
                $tmp_parts[$part] = $this->obj->load->view($view,$tmp_data,true);
            }
        }
        
        $output = $this->obj->load->view($this->_layout,$tmp_parts,$return);
        
        if ($return) {
            return $output;
        }
    }
}
?&gt;

The attached example contains test views, layouts and a test controller and also an autoloading config file. Just copy these files to you CodeIgniter project and load the test controller like this: http://ci_project/test/config_yes or http://ci_project/test/config_no

Actually this is the link to the example file: http://www.primalskill.com/

- ci_project is your CodeIgniter project.
- config_yes loads the layout library with the autoload config
- config_no loads the layout library and builds up the test_layout you have to delete the autoloading config file first!

I hope this library will be beneficial to all CodeIgniter users. If you have any question you can send me a PM or reply here. I'm happy to answer all of your questions.


  Oracle query problem
Posted by: El Forum - 10-08-2007, 01:07 PM - No Replies

[eluser]Unknown[/eluser]
Hello,

I've download version 1.5.4 and am having some problems executing Oracle queries. I have Apache 2.2 and Oracle 10g (including the instantclient_10_2 directory and proper pathing) all local on a Vista machine. Note that I am able to use oci_connect and run a query that way but I would really like to use the built in functionality of the framework.

Note my connection to the database works using load->database, it's when it hits the query I get an error. I'm sure I just have something configured wrong but being new to PHP and frameworks I'm stumped.

Here are are my DB settings:
$active_group = "default";

$db['default']['hostname'] = "//localhost/XE";
$db['default']['username'] = "dev";
$db['default']['password'] = "dev";
$db['default']['database'] = "";
$db['default']['dbdriver'] = "oci8";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";

Here is my simple PHP code:
$this->load->database();
$query = $this->db->query("select 1 from dual");

This is the error I get (line 69 is the $query = ...)

A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_Loader::$db
Filename: views/welcome_message.php
Line Number: 69

Thanks in advance for any help.

Mike


  CI and a design using frames... (Im)possible?
Posted by: El Forum - 10-08-2007, 11:04 AM - No Replies

[eluser]baZzz[/eluser]
Hi all,

I'm getting frustrated so I'm turning to you guys for help. I have to build a site for which the designer has very specific ideas concerning his design. To get an idea, this is what it looks like: http://metaminds.nl/obg/

As you can see, when you resize the browser window, only the content windows gets a scrollbar. The designer specifically wants this, so the header (containing the search form) and footer are always visible. The only way I can get it to work like this, is by using frames. However, I have no idea how to implement this with CI. Actually, I think it's not even possible. So I wanted to check with you guys if this is the case or that I'm overlooking something. If I'm getting in over my head here by trying to realize it with frames, I just tell the designer it's not possible and convert the page to a 1 page layout again.

Thanks for helping me out!


  My index.php retardation
Posted by: El Forum - 10-08-2007, 10:10 AM - No Replies

[eluser]fourmi[/eluser]
Hey, I've trawled through the forum trying to find options answers etc. I've got that headache that gets mentioned occasionally.

What i would like is for the following link to work
http://www.anthonyclifford.com/blog.html

I've tried a couple of tests on the following URLs
1. http://www.anthonyclifford.com/index.php/blog
2. http://www.anthonyclifford.com/index.php/blog.html
3. http://www.anthonyclifford.com/blog
4. http://www.anthonyclifford.com/blog.html

Based on the following constants
* Fresh install of 1.5.4 in the root of http://www.anthonyclifford.com
* $config['base_url'] = "http://www.anthonyclifford.com/";
* controller blog.php detailed as

Code:
class Blog extends Controller {

    function index()
    {
        echo 'Hello World!';
    }
}

and the following variables
* CASE [A]: $config['index_page'] = "index.php"
* CASE [B]: $config['index_page'] = ""
* CASE [C]: $config['url_suffix'] = ""
* CASE [D]: $config['url_suffix'] = ".html"
* CASE [E]: htaccess: blank
* CASE [F]: htaccess:
Code:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
* CASE [G]: htaccess:
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

FYI htaccess as
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.anthonyclifford.com$ [NC]
RewriteRule ^(.*)$ http://www.anthonyclifford.com/$1 [L,R=301]
works (just to validate vars in htaccess)

Combining the variations into different combos give up the following debugs results

Code:
Request 1    2         3                              4
Config
ACE    ok    CI:404    Apache:404                     Apache:404
ACF    ok    CI:404    "No input file specified."    "No input file specified."
ACG    ok    CI:404    "No input file specified."    "No input file specified."
ADE    ok    ok        Apache:404                     Apache:404
ADF    ok    ok        "No input file specified."    "No input file specified."
ADG    ok    ok        "No input file specified."    "No input file specified."
BCE    ok    CI:404    Apache:404                     Apache:404
BCF    ok    CI:404    "No input file specified."    "No input file specified."
BCG    ok    CI:404    "No input file specified."    "No input file specified."
BDE    ok    ok        Apache:404                     Apache:404
BDF    ok    ok        "No input file specified."    "No input file specified."
BDG    ok    ok        "No input file specified."    "No input file specified."

Has anyone got any ideas? Sorry to re-ask the age old stuff, but i'm stuck!

cheers
ant


  '%' = The URI you submitted has disallowed characters-question (again)
Posted by: El Forum - 10-08-2007, 09:59 AM - No Replies

[eluser]codex[/eluser]
Yeah,

I've searched the forum, but I can't seem to find a clear answer as to why '%' is throwing the 'The URI you submitted has disallowed characters.' error. It's in the permitted uri chars.

Anyone an idea?


  How to test if INSERT worked?
Posted by: El Forum - 10-08-2007, 09:26 AM - No Replies

[eluser]yello[/eluser]
Hi

Code:
$entry['state'] = $_POST['state'];
            $entry['state_uri'] = url_title($_POST['state']);
            $entry['country'] = $_POST['country'];
            $entry['country_uri'] = url_title($_POST['country']);
            $entry['details'] = $_POST['details'];
            $entry['date'] = date("Y-m-d");
            /*var_dump($entry);*/

            if ($this->db->insert('users', $entry))
            {
                echo 'success';
            }
            else
            {
                echo("failed");
            }

If there is a duplicate entry in the insert, I want to redirect the user to my error page. Right now all they see is the CI error:

Quote:An Error Was Encountered

Error Number: 1062

Duplicate entry 'asdasdfdass' for key 2

INSERT INTO users (services, ip, username, username_uri, password, email, city, city_uri, state, state_uri, country, country_uri, details, date) VALUES ('xbox|xbox360|ps1|repairs', '127.0.0.1', 'asdasdfdass', 'asdasdfdass', '7815696ecbf1c96e6894b779456d330e', '[email protected]', 'sadas', 'sadas', 'quebec', 'quebec', 'Canada', 'canada', 'asdasd asd as', '2007-10-08')

Can anyone help?

Thanks Smile


  Model Loading problem
Posted by: El Forum - 10-08-2007, 05:57 AM - No Replies

[eluser]Xobb[/eluser]
Hello,

I've got the following problem with the code:
File: system/application/controllers/article.php

Code:
class Article extends Controller
{

    function Article()
    {
        parent::Controller();
        $this->load->scaffolding('article');
        $this->load->model('article', 'art');
    }
}

File: system/application/models/article.php
Code:
class Articlemodel extends Model  {
    function  ArticleModel()
    {
        parent::Model();
    }
}

The error:
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Article::$UserTemp

Filename: libraries/Loader.php

Line Number: 921

Fatal error: Call to a member function _assign_libraries() on a non-object in C:\Programs\VertrigoServ\www\cignit\system\libraries\Loader.php on line 921

I've installed FreakAuth and nothing else.

Thank you for help in advance.

Ps.: Please add the information about loading models to: Loader Manual


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
hot-reload side effects s...
by InsiteFX
17 minutes ago
CodeIgniter.com - Report ...
by Harry Lyre
Today, 04:26 AM
Setting baseURL in Regist...
by michalsn
Today, 12:09 AM
Update from 4.6.0 to 4.6....
by FlavioSuar
Yesterday, 04:17 AM
Sessions old files are de...
by InsiteFX
05-12-2025, 10:30 PM
Ajax post failing with Ty...
by PaulC
05-12-2025, 12:23 AM
intermittent smtp failure...
by InsiteFX
05-11-2025, 11:30 PM
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
05-10-2025, 10:33 AM
CodeIgniter Shield 1.0.0 ...
by timesprayer
05-10-2025, 05:22 AM
Website Traffic Drop Afte...
by InsiteFX
05-10-2025, 04:23 AM

Forum Statistics
» Members: 146,024
» Latest member: 777pub_ink
» Forum threads: 78,389
» Forum posts: 379,451

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB