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



Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,111
» Latest member: amrutha
» Forum threads: 67,032
» Forum posts: 419,744

Full Statistics

Latest Threads
PHP MS SQL large results.
Forum: General Help
1 minute ago
» Replies: 1   » Views: 21
customize report
Forum: CodeIgniter 3.x
1 hour ago
» Replies: 1   » Views: 23
Shopping Cart Deprecated
Forum: Libraries & Helpers
3 hours ago
» Replies: 1   » Views: 37
Only display the month on...
Forum: General Help
4 hours ago
» Replies: 3   » Views: 71
Fatal error:Default value...
Forum: CodeIgniter 4 Support
6 hours ago
» Replies: 5   » Views: 153
How to watch iTunes movie...
Forum: Lounge
Yesterday, 06:30 PM
» Replies: 5   » Views: 334
Which browser do you guys...
Forum: Lounge
Yesterday, 06:13 PM
» Replies: 21   » Views: 4,264
Any one know where i can ...
Forum: Lounge
Yesterday, 06:03 PM
» Replies: 9   » Views: 759
[sysadmin] requirements t...
Forum: General Help
Yesterday, 12:06 PM
» Replies: 3   » Views: 152
Autoload multi databases
Forum: General Help
Yesterday, 10:55 AM
» Replies: 10   » Views: 5,938

  Layout Library Question
Posted by: El Forum - 07-28-2007, 12:32 AM - Forum: Archived Libraries & Helpers - Replies (1)

I found this Lib in the wiki HERE.

But anyway,
I wanna know how exactly to set up the controller file mentioned in that Wiki Page.
Ive read about controllers in the user-guide, but will admit to being a bit of a slow learner.

incase you dont wanna click the link...here's a quote from the wiki:

Quote:In Your Controller:

Place this in the Controllers Constructor:
$this->load->library('layout', 'layout_main');

Place this in the Controllers Methods:
$this->layout->view('/shop/view_cart', $data);

  Ext.js + CodeIgniter (example application)
Posted by: El Forum - 07-27-2007, 09:22 PM - Forum: Archived General Discussion - Replies (25)

I want to share this little experiment. There's a custom implementation of ext framework with CI to provide a single interface to deal with db operations. The demo shows a user management grid with add, update, delete, list and search features.

Code is available for download, i love to see your comments and suggestions.

Happy coding

  How to deal with mySQL JOINS with identical column names in two or more tables?
Posted by: El Forum - 07-27-2007, 06:35 PM - Forum: Archived Development & Programming - Replies (4)


I have a mySQL question. I am trying to perform a LEFT JOIN on two tables. The two tables have a couple of identically named columns (CreatedDate and ModifiedDate). When I perform a LEFT JOIN and print_r the results, any of the non-unique columns are shown only once (shows the value from the table to the left of the JOIN clause - the Members.CreatedDate and Members.ModifiedDate in this case).

Is there a way to have the query return the CreatedDate and ModifiedDate from both tables without giving them unique names in the table? I know that I could use 'AS' but that would get very tedious as I have about 20 different tables in my db with several having idential column names.

CREATE TABLE `Members` (
  `FirstName` VARCHAR( 100 ) NOT NULL ,
  `LastName` VARCHAR( 100 ) NOT NULL ,
  `CreatedDate` timestamp(14) NOT NULL,
  `ModifiedDate` timestamp(14) NOT NULL

  CREATE TABLE `Addresses` (
  `MemberID_fk` INT NOT NULL default '0',
  `AddressType` VARCHAR( 20 ) NOT NULL ,
  `Address` VARCHAR( 100 ) NOT NULL ,
  `City` VARCHAR( 100 ) NOT NULL ,
  `State` VARCHAR( 100 ) NOT NULL ,
  `CreatedDate` timestamp(14) NOT NULL,
  `ModifiedDate` timestamp(14) NOT NULL

$sql = "SELECT *
        From Members
        LEFT JOIN Addresses ON Addresses.MemberID_fk = Members.MemberID

$query = $this->db->query($sql)

foreach($query->result() as $row):
      echo "<br>";

  Sample CodeIgniter Application (shows sessions, Ajax, and models) with source code
Posted by: El Forum - 07-27-2007, 04:38 PM - Forum: Archived General Discussion - Replies (2)

I was working on this non-production CodeIgniter application and I’ve think I’m pretty much done with it. I used it as a learning experience and now would like to pass it on to you, whether for reference, curiosity, or pure entertainment. Admittedly, I could have done better with the conventions and programming style but I believe I did a good job implementing models and using Prototype with script.aculo.us for Ajax functionality.

Check out the application at http://codeigniter.paulshen.name/index.php
Click the Login link and use the credentials: demo/password
Try messing around with the interface: adding, editing and deleting stuff

Link to source code and notes
Take a look!

Post comments or questions, I'll be happy to answer Smile

  Simple form, crazy error
Posted by: El Forum - 07-27-2007, 03:23 PM - Forum: Archived Development & Programming - Replies (6)

[eluser]RaZoR LeGaCy[/eluser]
Hi I have in my controller:

function submit()
$rules['title']    = "trim|required|xss_clean|prep_for_form|htmlspecialchars";
$rules['date']    = "trim|required|xss_clean|prep_for_form|htmlspecialchars";
$rules['desc']    = "trim|xss_clean|prep_for_form|htmlspecialchars";
$fields['title'] = 'title';
$fields['date'] = 'date';
$fields['desc'] = 'desc';


        if ($this->validation->run() == FALSE)

#Body View
echo '<center><p>There was an <strong>Error</strong> with your comment.</p>';
echo '<p>Please re-submit your entry!</p>';


if (!empty($_POST['dvd'])) {
$dvd = '1';
} else {
$dvd = '0';

if (!empty($_POST['theater'])) {
$theater = '1';
} else {
$theater = '0';

if (!empty($_POST['game'])) {
$game = '1';
} else {
$game = '0';

$data = array(
               'id' => 'NULL' ,
               'title' => $this->input->post('title', TRUE) ,
               'desc' => $this->input->post("desc", TRUE) ,
               'date' => $this->input->post('date', TRUE) ,
               'dvd' =>  ''.$dvd.'' ,
               'theater' => ''.$theater.'' ,
               'game' => ''.$game.'');

$this->db->insert('hh_events', $data);




In my View:
<div class="storyBar">

&lt;?=$this->validation->error_string; ?&gt;


<table align="center" style="margin:2em auto;">
<tr valign="baseline">
<td colspan="2" align="center">
DVD: &lt;? echo form_checkbox('dvd', '1', FALSE); ?&gt; |
Theater: &lt;? echo form_checkbox('theater', '1', FALSE); ?&gt; |
Game: &lt;? echo form_checkbox('game', '1', FALSE); ?&gt;
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap">Title:</td>
$data = array('name' => 'title', 'id' => 'title', 'value' => '', 'maxlength' => '128', 'size' => '50', 'style' => 'width:50%',);
echo form_input($data);
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap">Date:</td>
$data = array('name' => 'date', 'id' => 'date', 'value' => '2007-00-00', 'maxlength' => '10', 'size' => '15', 'style' => 'width:50%',);
echo form_input($data);
?&gt; YYYY-MM-DD</td>
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap">Desc:</td>
<td>&lt;? $data = array('name' => 'desc', 'id' => 'comment', 'cols' => '40', 'rows' => '3',);
echo form_textarea($data);?&gt;</td>
<tr valign="baseline">
<td colspan="2" align="center">

&lt;?=form_submit('submit', 'Submit');?&gt;</td></tr>


In my DB structure:
-- phpMyAdmin SQL Dump
-- version
-- http://www.phpmyadmin.net
-- Host: localhost
-- Generation Time: Jul 27, 2007 at 02:21 PM
-- Server version: 5.0.27
-- PHP Version: 4.4.4


-- Database: `gainfina_ciHH`

-- --------------------------------------------------------

-- Table structure for table `hh_events`

CREATE TABLE `hh_events` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(128) collate utf8_unicode_ci NOT NULL default '',
  `desc` text collate utf8_unicode_ci,
  `date` date NOT NULL default '0000-00-00',
  `dvd` enum('1','0') collate utf8_unicode_ci NOT NULL default '0',
  `theater` enum('1','0') collate utf8_unicode_ci NOT NULL default '0',
  `game` enum('1','0') collate utf8_unicode_ci NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='release_dates' AUTO_INCREMENT=36 ;

-- Dumping data for table `hh_events`

INSERT INTO `hh_events` VALUES (1, 'Skinwalkers', NULL, '2007-07-27', '0', '1', '0');
INSERT INTO `hh_events` VALUES (2, 'Shadow Puppets', NULL, '2007-07-24', '1', '0', '0');
INSERT INTO `hh_events` VALUES (19, 'Perfect Creature', NULL, '2007-07-17', '1', '', '');
INSERT INTO `hh_events` VALUES (20, 'Captivity', NULL, '2007-07-13', '', '1', '');
everything looks good but I get this error when I submit
An Error Was Encountered

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc, date, dvd, theater, game) VALUES ('NULL', 'the2', 'te 2\'s', '2007-08-14',' at line 1

INSERT INTO hh_events (id, title, desc, date, dvd, theater, game) VALUES ('NULL', 'the2', 'te 2\'s', '2007-08-14', '0', '1', '0')

  Where is the database configuration file?
Posted by: El Forum - 07-27-2007, 02:53 PM - Forum: Archived Development & Programming - Replies (2)

I am trying to figure out how to connect to the database. The user's guide makes several references to the the database configuration file. Does anybody know where that file is located, and what that file is called?

  suggestion for others working on user auth systems
Posted by: El Forum - 07-27-2007, 02:11 PM - Forum: Archived Development & Programming - Replies (1)

So, continuing on development of my own user system for my project(s), and idea hit me. I've added an extra field to my database, registration_email

I doubt this is new, but it's not something I've seen in other projects out there, or at least, I didn't notice it.

The reason for this field is you now have a static reference point of who really signed up for that account. You can't defeat social engineering when it comes to account security. People share passwords and such, and occasionally people hijack those accounts. The first thing they are going to do is change the account email address. Once that's accomplished, there is no way for the user to retrieve the password. But if you add this field, then you have a reference. If the user comes complaining their account was stolen, you have a security question immediately available to you, what email address to join the site using? You also could build your password retrieval functionality to take advantage of this, giving them the option to send a password reset link to the original email address, rather than the currently assigned one.

  Do we really need a view library?
Posted by: El Forum - 07-27-2007, 01:24 PM - Forum: Archived General Discussion - Replies (29)

[eluser]Rick Jolly[/eluser]
The way a developer loads a view and its data is a matter of personal preference and choice is good. I just wanted to make a few of points in favor of CI’s current implementation and maybe provoke a bit of thought and discussion.

1) Coupling a View to its Data

Coupling a view to its data when loading is good style. As we know, with CI you can load a view and its data all at once:

$this->load->view(‘view’, $data);
$view_part = $this->load->view(‘view_part’, $data, true);
When setting view variables using $this->load->vars() or other syntax, there is no traceable link between the view and its variables. View variables could be loaded throughout the code, making it difficult to read and maintain.

2) Locally Scoped Variables for Partial Views

Another advantage to the $this->load->view(‘view_part’, $data, true); method: it allows locally scoped variables. When setting view variables in a global way (like when using $this->load->vars(); and other custom methods) every partial view must share the same variables.

3) A View is a View

CI treats a view as a view. You load views within views (partials/fragments/blocks) in the same generic way as a regular view. Some developers prefer to differentiate between views and nested views by using different loading syntax. I find it confusing to make those differentiations, and there is additional syntax to remember.

  How CI passes loaded objects to newly instantiated ones?
Posted by: El Forum - 07-27-2007, 01:05 PM - Forum: Archived General Discussion - Replies (2)

[eluser][email protected][/eluser]
I realize that CI passes every loaded object(e.g. language,config, models, libraries) to a newly instantiated one(e.g. $this->model_name will has its $this->model_name->language object).
Will this practice break the encapsulation of the object design?
Is there any way to control/manage this process?

  Don't understand inconsistency in passing vars to a view
Posted by: El Forum - 07-27-2007, 11:16 AM - Forum: Archived General Discussion - Replies (4)

[eluser]Rob Stefanussen[/eluser]
I've run into something in my CI application that has me stumped.

I should be able to do this

// controller
$data['text'] = 'Hello World!';
$this->load->view('test_view', $data);

// view
echo $text; // echoes 'Hello World!';

However, apparently I do something (no idea what yet) unwittingly, and suddenly everything is being shoved into a 'vars' variable! So now I have to change my code to this to work properly:

// controller
$data['text'] = 'Hello World!';
$this->load->view('test_view', $data);

// view
echo $vars['text']; // echoes 'Hello World!';

Thanks in advance for your help!

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