multiple views per controller

#31
[eluser]Derek Jones[/eluser]
Your user may not have sufficient privileges for that command, which is quite unusual. If you run this from phpMyAdmin, what is reported back?

Code:
SET NAMES 'utf8' COLLATE 'utf8_general_ci'

Incidentally, latin1 is often the default on the server, and is the default that PHP uses, but the trend has overwhelmingly leaned toward using utf8 for all data storage and communication, and is what CI (along with many other PHP frameworks and applications) now recommends as the default.

#32
[eluser]SneakyDave[/eluser]
I don't get a permission error (unless this is disguised as one), I get this error running that query...
Quote:#1193 - Unknown system variable 'NAMES'

Edited to add: I get the same problem on another MySQL server that is also 4.0.27.

#33
[eluser]Derek Jones[/eluser]
Ah yes, sorry, it won't work with MySQL < 4.1. Hm, decision time, as I had not planned on supporting versions earlier than that.

#34
[eluser]SneakyDave[/eluser]
Well, that's fine, but I didn't see that MySQL requirement in the User Guide yet.
http://ellislab.com/codeigniter/user-gui...ments.html

I can use MySQL 5.0 on the test system, but production will be stuck on 4.0.27 for a while yet I assume. I'll just continue using the current stable version of CI until they make that change.

Thanks for your time.

#35
[eluser]Derek Jones[/eluser]
Right, we'll discuss this internally and update the requirements to reflect that decision once 1.6 is released.

#36
[eluser][email protected] Users Group in Japan[/eluser]
For example CakePHP,
http://manual.cakephp.org/chapter/installing
Server Requirements
.....
2.PHP 4.3.2 or greater. Yes, CakePHP works great in either PHP 4 or 5.
3.A database engine (right now, there is support for MySQL 4+, PostgreSQL and a wrapper for ADODB).

app/config/database.php
Code:
var $default = array(
    'driver' => 'mysql',
    'connect' => 'mysql_connect',
    'host' => 'localhost',
    'login' => 'user',
    'password' => 'password',
    'database' => 'dbname',
    'prefix' => '',
    'encoding' => 'utf8'
);

cake/libs/model/dbo/dbo_mysql.php
Code:
function connect() {
    .....
    if (isset($config['encoding']) && !empty($config['encoding'])) {
        $this->setEncoding($config['encoding']);
    }

    return $this->connected;
}

function setEncoding($enc) {
    return $this->_execute('SET NAMES ' . $enc) != false;
}

Possibly, CakePHP will work on MySQL 4.0x.

#37
[eluser]Derek Jones[/eluser]
Yes, it's quite easy to test the MySQL version, or let the user manually decide as Cake does, and not attempt to set the client character connection. The decision before us is if that's desirable to us or not.

#38
[eluser]mikeni1225[/eluser]
This is my first time i've tried using code igniter. Coming from using Java struts/tiles, what i'm seeing doesn't really seem like true MVC.

In struts, your controller does whatever logic first, and finally decides on what the view is. Then using tiles you template your pages.

With the examples i'm seeing, we are doing our templating inside the controller, which should not contain view or model logic.



[quote author="Derek Allard" date="1200715009"]Allow me to introduce one of the most requested features of our view output. Multiple views.

Code:
&lt;?php

class Page extends Controller {

function index()
{
$data['page_title'] = 'Your title';
$this->load->view('header');
$this->load->view('menu');
$this->load->view('content', $data);
$this->load->view('footer');
}

}
?&gt;

Available now in an SVN near you... please test it out.[/quote]

#39
[eluser]Derek Jones[/eluser]
[quote author="mikeni1225" date="1201412684"]This is my first time i've tried using code igniter. Coming from using Java struts/tiles, what i'm seeing doesn't really seem like true MVC.

In struts, your controller does whatever logic first, and finally decides on what the view is. Then using tiles you template your pages.

With the examples i'm seeing, we are doing our templating inside the controller, which should not contain view or model logic.[/quote]

There's nothing from preventing you from loading the view "parts" within your view files instead of your controllers; people just seem to typically try to keep PHP out of their view files with the exception of short-tag variables. It's all a matter of preference really, and CI will work with either approach.

#40
[eluser]mikeni1225[/eluser]
Thanks for the quick reply. Does anyone have an example of how people template their pages with CI at an enterprise level?

Also can you "extend" or "inherit" templates?

Suppose I make a default template that has
banner
leftside_menu
rightside_blah
content_A
content_B
footer

then i want to extend that maybe for some random thing and add content_C
banner
leftside_menu
rightside_blah
content_A
content_B
content_C (new)
footer

and i want to extend the default maybe for another random thing and add content_D
banner
leftside_menu
rightside_blah
content_A
content_B
content_D (new)
footer

how do you do this in the cleanest method?

because if im doing all this by defining my structure in the controller, it could be a mess if i have too many sections.

Mike


[quote author="Derek Jones" date="1201413014"][quote author="mikeni1225" date="1201412684"]This is my first time i've tried using code igniter. Coming from using Java struts/tiles, what i'm seeing doesn't really seem like true MVC.

In struts, your controller does whatever logic first, and finally decides on what the view is. Then using tiles you template your pages.

With the examples i'm seeing, we are doing our templating inside the controller, which should not contain view or model logic.[/quote]

There's nothing from preventing you from loading the view "parts" within your view files instead of your controllers; people just seem to typically try to keep PHP out of their view files with the exception of short-tag variables. It's all a matter of preference really, and CI will work with either approach.[/quote]


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.