Welcome Guest, Not a member yet? Register   Sign In
  Odd object-oriented ramifications...
Posted by: El Forum - 08-31-2007, 01:36 PM - No Replies

[eluser]tmcw[/eluser]
Been noticing a weird pattern in CI.

I have a controller, and some content that will be the same over a few different pages (methods). So I have that in a different method, which runs a query, throws the result into $vars['events'] = $r. Then I load that into a template, like so: $o = $this->load->view('/event/list', $vars,true); and return $o.

The weird part is that, after I run this method in another controller ($data['event_list'] = $this->event_list()Wink The variable $data['events'] holds the same data as $vars['events'] did, and running a query that returns false doesn't replace that data with false.

Now, maybe this is intended behavior, but it seems to be rather unpredictable when you think of encapsulation and unintended consequences... there isn't a way to load a template with data, and then load another without the second being affected by the first?

Any ideas here?


  How can I set variables for an entire constructor?
Posted by: El Forum - 08-31-2007, 01:20 PM - No Replies

[eluser]Nicholas Helke[/eluser]
Hi!

I have a post constructor which handles all posts to the database. There are three arrays that I want to be able to access in all the different functions of the constructor.

Set these in the class class constructor doesn't let me access them from the functions using just their name. If there is a way, I don't know it.

Thanks,

Nicholas


  checkbox array
Posted by: El Forum - 08-31-2007, 12:51 PM - No Replies

[eluser]DIG[/eluser]
Forgive me for my very bad English.

I have read many of the forum on the arrays and checkbox, but bash can not solve a simple task.

In my view:

Code:
<input name="test[1]" type="checkbox" value="1">
<input name="test[2]" type="checkbox" value="1">
<?=$this->validation->test_error; ?>

In my controller:
Code:
$rules['test'] = "callback_";
$this->validation->set_rules($rules);

$fields['test']    = '"test checkbox"';
$this->validation->set_fields($fields);

function test_check()
{
  if(isset($_POST['test'])){
    $this->validation->set_message('test_error', 'Checked!');
    return TRUE;
  }else{
    $this->validation->set_message('test_error', 'Not Checked!');
    return FALSE;
    }
}
if ($this->validation->run() == FALSE){
...redisplay form...
This is the trouble place.
no message displayed.

}else{
...insert in db, redirect...
}

where I am wrong? or I am hopelessly stupid? Smile
Thanks.


  Yet another index.php problem
Posted by: El Forum - 08-31-2007, 12:42 PM - No Replies

[eluser]ufasoli[/eluser]
Hello everyone,
I'm really new to codeIniter and I'm having a lot of trouble removing the "index.php" file I've been looking around in the forum and tried all the configurations that I could find in the forum(including the one in the user guide) for the .htaccess file but it still does not work :

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin
    ErrorDocument 404 /index.php
</IfModule>


I've already configured as well the lines in the config.php file

Code:
$config['base_url']    = "http://localhost/field_center/";

$config['index_page'] = "";
here is my directory structure

-styles
-images
-system
--application
(all the other code igniter files & folders)
-index.php


I hope someone can help me with this

thx

ufasoli


  Strange Session library behavior in IE
Posted by: El Forum - 08-31-2007, 11:53 AM - No Replies

[eluser]PoWah[/eluser]
Maybe somebody can explain where is the problem? I think that this is a session library bug or smth...
The situation:
- in one of the controller methods I set search result in a session array ($this->session->set_userdata("search_results", $results_array); ) and redirect to another method which is responsible only for representing result data. Everything goes fine if I use Firefox. Everything goes fine if I use IE too, but not on all computers! On some PCs session data disappears after redirecting, it doesnt matter if you use IE6 or IE7! It works on all computers if browser is FF, but not every computer with IE shows the results! I simply do not understand :/ If I change CI session library with Native Session library, everything is fine with all browsers on all PCs... but if I use original CI library or even the new CI library things go strange...

Any thoughts? :long:

p.s.: you can see this in action on my site http://www.mobilu.lt/ by clicking on a button below the form with a value "Ieškoti". If you see the results with IE - its ok, you are lucky, but I bet not all of you will see them :-)


  Why doesn't SetEnv TZ work?
Posted by: El Forum - 08-31-2007, 10:33 AM - No Replies

[eluser]Nicholas Helke[/eluser]
Hi!

I have a CI application hosted on a DreamHost server. I've set the TZ Env in the .htaccess file to Europe/Berlin, as suggested on the DH wiki, but CI still gets the system's local time which is PT.

Any thoughts?

Cheers,

Nicholas


  Building a IMAP/POP3, webmail interface in CI
Posted by: El Forum - 08-31-2007, 09:29 AM - No Replies

[eluser]tobben[/eluser]
Hello CI-people,

my first contribution to the community is a suggestion/idea for a mail server communication with IMAP/POP3, as seen in this wiki:

IMAP/POP3

My plan is to make a library/class that would make it easy to build ex. a simple webmail client. Using the IMAP functions in PHP for reading the mail server, and probably using the CI email class for the sending part.

Feel free to join/give suggestions!

(Right now there are no actual reading of mail headers/body, but only connection and some misc stuff)


tobben


  Stripping illegal URL characters from strings
Posted by: El Forum - 08-31-2007, 09:18 AM - No Replies

[eluser]Shodan[/eluser]
Hi all,

I'm working on a site that will be using product names in site's page URLs.

I'm redesigning the site so the data already exists. Unfortunately, there's lots of '/'s and '&'s in existing product names so I need to scan through the database and remove any illegal characters from the product (and category) names.

Is there a simple way to scan a string for illegal characters and remove them (or at worst, replace with white space)? I'd also like to replace all the ampersands with the word: "and".

I know this is a job for Regex but to be honest, it baffles me and I can't seem to find a decent, straightforward tutorial.

Thanks in advance for any help!

Regards,
Terry


  var $varible in model
Posted by: El Forum - 08-31-2007, 07:31 AM - No Replies

[eluser]Kemik[/eluser]
Hello,

I know in other coding languages you have to declare variables and I noticed in some model examples the variables are decleared at the top of the model. Can anyone tell me why they have done this and if you need to var all the variables you use in the model?

Thanks.


  Doubt using session
Posted by: El Forum - 08-31-2007, 07:01 AM - No Replies

[eluser]xernobil[/eluser]
Hi friends, forgives my bad English…

I am with a doubt using sessions, already I searched in forum and I did not find the solution.

The doubt is the following one:

I possess an Array of the following collection:

Code:
$arr = Array('idclient' => $idClient, 'name' => $nameClient);

necessary to insert this Array in one session:
Code:
$this->session->set_userdata('client', $arr);

The doubt is following now:
How I go to have access the value 'name' for example? Using

Code:
$this->session->userdata('name');
it returns emptiness.

Tips?

hug. :cheese:


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

Username
  

Password
  





Latest Threads
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
10 minutes ago
Ajax post failing with Ty...
by paulbalandan
25 minutes ago
CodeIgniter Shield 1.0.0 ...
by timesprayer
5 hours ago
Website Traffic Drop Afte...
by InsiteFX
6 hours ago
Magic login link not work...
by InsiteFX
6 hours ago
Is codeigniter 5 upco...
by InsiteFX
6 hours ago
CI4 Auto-Discovery not wo...
by InsiteFX
11 hours ago
Why PHP is still worth le...
by InsiteFX
11 hours ago
Any user guid or video o...
by msnisha
Yesterday, 02:30 PM
Why Every Programmer Need...
by Yetkiliteknikservis
Yesterday, 01:49 PM

Forum Statistics
» Members: 145,114
» Latest member: game_68z
» Forum threads: 78,385
» Forum posts: 379,432

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB