Welcome Guest, Not a member yet? Register   Sign In
  Repopulating Checkboxes/Lists With Dynamic Content
Posted by: El Forum - 10-17-2007, 08:10 AM - No Replies

[eluser]RobbieL[/eluser]
I've got a couple of checkboxes in a form. The values of them are dynamically generated with data from a database. What I'm looking to do is for when the form is being repopulated because of a validation error, for these checkboxes to return to the state the were submitted in.

I've managed to get this working using CI's set_checkbox with checkboxes that have static values. But having real bother with ones with dynamic values. Here's what I have so far:

Code:
<select name="day">
<option value="&lt;?=sprintf('#u', $i);?&gt;" &lt;?= $this->validation->set_select('day', '&lt;?=sprintf('&#x02;u', $i);?&gt;'); ?&gt;>&lt;?=sprintf('&#x02;u', $i);?&gt;</option>
</select>

I know the problem is lying in the second parameter of the set_select function. I've tried the usual formatting options, but just can't get it to work. Anyone got any experience on the matter and able to shed a little on the problem?

Cheers.


  Some URL Help
Posted by: El Forum - 10-17-2007, 08:04 AM - No Replies

[eluser]Phil Sturgeon[/eluser]
Hey gang,

Trying to get some real simply URL processing for a project im on. I have never got on shockingly well with regex or mod_rewriting subdomain urls, so how can I force the folllowing links to some CI controllers? I understand there will be a mix of routes and mod_rewrite but im struggling on them both.

http://groups.sitename.com/group_name

and

http://sitename.com/user_name

I need to somehow turn the names into userID and groupID but im thinking I can just add an extra method to a controller like:

Code:
function group_from_name($group_name)
{
$groupID = $this->group_model->getIDfromName($group_name);
$this->profile($groupID)
}

function profile($groupID)
{
bla bla normal group profile code...
}

Been pondering this one for a while!


  Resizing of transparent/animated gifs [solved]
Posted by: El Forum - 10-17-2007, 07:02 AM - No Replies

[eluser]#1313[/eluser]
Hi there, people.

Did anybody here encounter any problems with CI imagelib when working (i.e. resizing) with animated gifs or gifs with transparency? In my case the resulting image gets slightly messed up -- all of transparent areas are black.

I know that this is not CI's fault, but a general problem with native PHP functions such as imagecopyresampled(), which discard transparency and every frame but first one of the animated gif. My question is, actually, did anyone here already solved this on CI's grounds? Some magick patches to the core applied, maybe?


  ZIP Download, not getting all the files in the zip
Posted by: El Forum - 10-17-2007, 06:53 AM - No Replies

[eluser]Xenon Design[/eluser]
This is a bit of an odd one.

Heres the code, i'll explain below:

Code:
$rooturl = $this->config->item("base_url");
foreach($items as $idx => $item){
    $data = $this->gallery->get_photo_data(0, $item);
    if($type == "web"){
        $filename = $data['filename']."_web.jpg";
    }else{
        $filename = $data['filename'].".jpg";
    }
    $files['photo_'.$data['photoid'].'.jpg'] = addslashes(file_get_contents($rooturl."static/photos/".$filename));
}

$this->zip->add_data($files);

$this->zip->download('photos_'.time().'.zip');

That's a cut down part of the code but thats all the main parts. The thing is only 10 of 12 of these images are downloading and showing in the ZIP. I added in addslashes() to it to make sure it wasnt fooling with the array, it does the same regardless of wether its there or not. The ZIP downloads fine and unzips ok but there are just less images than there should be. The files that they grab are ok and I have var_dump'd the $file array and everything is there...including the missing images.

Dont worry about if you cant see where $items or $type is from...its in the actual code.

Any suggestions or things in my code that are wrong?


Thanks Big Grin


  Relative internal URLs
Posted by: El Forum - 10-17-2007, 06:46 AM - No Replies

[eluser]Unknown[/eluser]
Hi everyone,

I have just started checking out CodeIgniter. Since I have been using CakePHP for the past 2 years I have not been able to discover how to create relative URLs (something I am used to). FYI: I have tried searching in the wiki and these forums without much luck.

What I want to do
I want to create an URL for the action/function/method called "dosomething" (as an example) in the current controller from a view-file that may be used in more than one controller.

What I have tried doing so far
I get the same results regardless of a preceding slash. The URL helper seems to only handle "complete" urls that can be prepended by config-values for the installation.
'dosomething'
'/dosomething'

I think that I may be able to get something going by using segment(0) the uri class to get the controller name but from what I have read that will fail as soon as I start putting thing in a folder or change some routing.

What I am looking for is the preferred or official or supported way of determining the current controller and action names from within a view.

Thanks in advance for any hints and tips on this subject.


  Caching Pages - great. Now I want to delete 1 cached item.
Posted by: El Forum - 10-17-2007, 05:17 AM - No Replies

[eluser]meridimus[/eluser]
Hi,

I'm currently developing some stuff which needs the use of caching. It's great that codeignitor can cache the page automatically. My only problem is how can I fetch the name of the cached page? So, for example if I was caching an RSS feed, when someone posts a new topic I want to delete the cache for the RSS feed so that next time it's called it's forced to re-generate with the new content. Then the cache will not expire until the cache file is missing.

I think this is far more useful than just caching for a period of time, typically once the page has rendered it becomes static until a change is made in the content. When that happens it would be nice if I could locate the particalur page that's cached and only delete that one leaving other caches un-touched.

What do you think? Possible within the CodeIgnitor code? I'm going to take proper look at the code used to cache the pages now to see if there's a way to quickly add the feature.

Let me know what you think.


  form submit
Posted by: El Forum - 10-17-2007, 05:14 AM - No Replies

[eluser]wojtekk[/eluser]

Code:
&lt;form action="submit.php" method="POST"&gt;

in submit.php i want to put some data to database
and then send post data from form to other site (pay system)

how can i do this?

Thx for any help


  [SOLVED] IMAP Notices spamming
Posted by: El Forum - 10-17-2007, 04:42 AM - No Replies

[eluser]Morty[/eluser]
Hi there !

I am currently debugging an IMAP connection process. In order not to have any "notice" or any errors during execution I am tackling any issue one might encounter.

Code:
function test_imap($address, $password, $type)
    {
        if(!$mail = @imap_open("{mx.entreprise.com:993/imap/ssl}INBOX", $address, $password, OP_SILENT, 1));
        {
            die("Could not connect");
        }
        return ($mail);
    }
For the purpose of testing, $adress does not exist, therefore I do obtain error messages. What I do not understand is why I do get notices even with an @:
Code:
Could not connect
A PHP Error was encountered
Severity: Notice
Message: Unknown: Login failed. (errflg=1)
Filename: Unknown
Line Number: 0

A PHP Error was encountered
Severity: Notice
Message: Unknown: Too many login failures (errflg=2)
Filename: Unknown
Line Number: 0
My general approach is "noticeless" programming, with no need to change the error reporting level when deploying an application but there I'm stuck. Does anyone have an idea ?

Thanks in advance,
Morty

Edit:

In fact, there are a lot of information that are given by imap_open as notices which end up being errors on your page. They are given back even after a die() statement. Why?

PHP maintains a collection of all IMAP errors and if it is not emptied, it shows at the end of your script. In order to get these errors and empty this collection, one should use the imap_errors() function.

Problem solved.


  Upload .php file help
Posted by: El Forum - 10-17-2007, 03:36 AM - No Replies

[eluser]Justin Patel[/eluser]
Hello Friends,


Code:
$config['upload_path'] = './language/';
        $config['allowed_types'] = 'gif|jpg|png|php';
        $config['max_size']    = '15500';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';                    
        $this->load->library('upload', $config);
        $upload =  $this->upload->do_upload();


When I try to upload .php file. It gives error like


Code:
Array ( [error] =>

The filetype you are attempting to upload is not allowed
)


But it works for the .gif images

Please Help me out




Best Regards Smile


  Documentation - URL helper
Posted by: El Forum - 10-17-2007, 03:24 AM - No Replies

[eluser]nmweb[/eluser]
The documentation of the redirect() function in the URL helper doesn't state the 'location' redirect is done by default when you leave out the second argument.


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

Username
  

Password
  





Latest Threads
Setting baseURL in Regist...
by grimpirate
10 hours ago
hot-reload side effects s...
by grimpirate
Yesterday, 12:35 PM
CRUD Code Generator
by DeanE10
Yesterday, 05:31 AM
CodeIgniter.com - Report ...
by Harry Lyre
05-14-2025, 04:26 AM
Missing closing bracket w...
by abf
05-13-2025, 07:27 PM
Update from 4.6.0 to 4.6....
by FlavioSuar
05-13-2025, 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

Forum Statistics
» Members: 146,264
» Latest member: 88okcomcom
» Forum threads: 78,390
» Forum posts: 379,457

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB