Welcome Guest, Not a member yet? Register   Sign In
  Validating upload form field mixed with other fields
Posted by: El Forum - 10-15-2008, 03:56 PM - Replies (3)

[eluser]jleequeen[/eluser]
Hello all,

I have a form that has a few text fields and also needs to have a field to upload a file. I am having a hard time looking at the docs and figuring out how to do this and have validation on the whole form. I would like to stay within the form validation class and not have to hack something if possible. Does the validation class and uploading class not work together?

Any ideas?

Thanks.


  problem with shell_exec in a library.
Posted by: El Forum - 10-15-2008, 01:41 PM - Replies (2)

[eluser]oll[/eluser]
For the youtube-like website I'm developping for my work, I use the function below, with ffmpeg as Command, to convert a video file into flash, since it can take a long time to be converted (I redirect the output and then "ajax" it in a webpage, so that the user can go on doing something else meanwhile).
background process with php

Code:
function run_in_background($Command)
   {
           $PID = shell_exec("nohup $Command 2> /dev/null & echo $!");
   }

It works well with a simple PHP page.
It also works well with codeigniter if I put this function directly in the controller and call it with another function (for instance, index() )

Code:
$pid = $this->run_in_background($videofile);

It works means "I have the pid instantantly" and the web site goes on, while ffmpeg process in the background.

But I would like to use it with the library I created and it doesn't work.
It's defined as a method in my library (a simple copy/paste from this function in the library file)

I have another method, createflash(), in which there's a simple :

Code:
function createflash() {
//...
$this->pid = $this->run_in_background($this->filename);
//...
}

There's no error, but it waits for the function to finish (it can take several minutes) before finally displaying me the result . As if there wasn't the "nohup".

It looks like an instantiation behaviour problem, but I can't find where, since I'm far from being a specialist Wink

Thx.


  Drag and Drop Between Lists
Posted by: El Forum - 10-15-2008, 01:21 PM - Replies (5)

[eluser]bennyhill[/eluser]
I am trying to make a simple table reservation app. The user will see a list of guests (populated by a database query), and then another blank list representing the table. I want to make it so the user can drag and drop up to ten names into the second list, then click submit to enter it into the database.

The thing I am stuck on is not the PHP or CodeIgniter but the drag and drop part. Will I have to use a javascript library? What exactly happens when the name is dropped into the second list, is it adding the values to a javascript array? If so, how would I get that array from javascript to PHP and MySQL?

It doesn't have to be drag and drop. It can be a basic two list component with add remove buttons. Im just not that good in javascript.


  rename and permissions denied (with same owner/group)
Posted by: El Forum - 10-15-2008, 01:12 PM - No Replies

[eluser]antonumia[/eluser]
I have CI running a file migration system. Everything work apart from the file archiving side where I am trying to use rename to move files.

Files are uploaded by user henry (group henry), ci reads them and copies relevant files elsewhere on gthe server where they are owned by apache (group: apache).

Whenever I try rename i got a permissions denied error so I added a cron job to chown all files to apache:apache and chmod them to 0777.

I assumed that if the files were also owned by apache, php (CI) wouldn't have a problem but i still get permission denied.

I added a copy/unlink subtask to the script if rename fails and the files get copied fine. Unlink also causes the error.

This is ultra-basic stuff but I'm scratching my hair out now.

hopefully,

anton


  Controllers and Views
Posted by: El Forum - 10-15-2008, 11:05 AM - Replies (7)

[eluser]CodeIgniterNoob[/eluser]
It might sound like a dumb question, but do I have to create a new controller and a view for that controller for every page of a site that I might build? I want to follow one template, and one controller for different views. Does it make sense? Can anyone help?


  How to dynamically react on different parameter counts?
Posted by: El Forum - 10-15-2008, 10:29 AM - Replies (5)

[eluser]Comanche[/eluser]
Hi there,

I'm currently building an index page and got some trouble.

I want to realize the following things:

1. Show all items and paginate them
2. Show just items starting with a specific letter and paginate them
3. Sort items by id or name

So I need three parameters, one for the letter, one for the pagination and one for the sort order.

The problem is, that when showing all items, at least the parameter for the letter isn't needed.

Let's say I have the following function:

function test($letter='',$page=0,$sort=0)

When calling the whole thing with .../index.php/project/test/A/0/0 there is no problem.
But when calling it with .../index.php/project/test/0/0 to see all items it will take the first '0' as letter. Since I also need numbers for $letter I can't just check, if a number was given for $letter.

I think I could check the number of parameters given, but there is another problem:
Why should I send parameters to the function if just the default values are needed?

For example .../index.php/project/test/A/0/1 wouldn't make sense, since 0 is the default value for the two other parameters. So I the best would be just to call .../index.php/project/test/A/1.
But then I can't figure out, if the value 1 is the sort order or the page.

With "normal" PHP it wouldn't be a big problem I think, I could just call
test.php?letter=X&page=1&sort=1, and handle the different parameters via $_GET but with CodeIgniter I don't see a possibility to differ between the given parameters (when trying it "test/A/0/1"-style and not "test.php?letter=X&page=1&sort=1"-style).

I could even write different functions for that (index($page,$sort), indexl($letter,$page,$sort)) but even then the problem to differ between $page and $sort would remain. And I want to do this all in just one function, if it's possible.

If one of you has an idea how to solve this problem, I'd be very thankful.

Greeting,
Comanche


  Sharing data between view partials
Posted by: El Forum - 10-15-2008, 09:53 AM - Replies (11)

[eluser]Isuka[/eluser]
Hi,

When I build an app, I usually create a master view like this :

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
&lt;title&gt;&lt;?php echo title; ?&gt;&lt;/title&gt;  
&lt;?php echo $view_css; ?&gt;
&lt;/head&gt;
&lt;body&gt;
<div id="header">
<h1>&lt;?php echo $title; ?&gt;</h1>
</div>
<div id="content">
&lt;?php echo $content; ?&gt;
</div>
<div id="sidebar">
&lt;?php echo $sidebar; ?&gt;
</div>
<div id="footer">
&copy; mygreatwebsite.com
</div>
&lt;/body&gt;
&lt;/html&gt;

In my controller I make something like this :
Code:
class Welcome extends Controller
{
  function Welcome()
  {
    parent::Controller();    
  }    
  function index()
  {
    $data = array(
      'title'=>'My Great Title',
      'content'=>$this->load->view('content_partial_view', '', TRUE),
      'sidebar'=>$this->load->view('sidebar_partial_view', '', TRUE)
    );
    $this->load->view('master', $data);
  }
}
In my actual case, I have access to $title only in my master view but not in my content and sidebar partials. What if I want to have access to $title in my content view ? I need to make another array with the same title data specificaly for the content view. And the same goes for the sidebar view.

So I'm wondering if it's possible to have a global $data accessible for all my views (master, content and sidebar).

(I used to make partial with the great View Library by coolfactor before, but there's not update since July 2007, so I try to use the default CI View Library now Tongue)

Thanks for any helpful information Smile


  Session does not expire? why?
Posted by: El Forum - 10-15-2008, 08:22 AM - Replies (8)

[eluser]mindprojects[/eluser]
Hi to all!,
my web applicaiton is running on CI 1.6.3.
This is my session config:

Code:
$config['sess_cookie_name']        = 'ci_session';
$config['sess_expiration']        = 0;
$config['sess_encrypt_cookie']    = TRUE;
$config['sess_use_database']    = TRUE;
$config['sess_table_name']        = 'bk.ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = TRUE;
$config['sess_time_to_update']         = 5;

Following the idea that,if i'm closing and opening the browser in a range of time more than 5 seconds(sess_time_to_update),session should expire,shouldn't?
It doesn't happen,everytime i'm getting session data always on. Why?

Thanks in advance.


  jQuery Datepicker UI - Min/Max date range problems
Posted by: El Forum - 10-15-2008, 04:34 AM - Replies (1)

[eluser]Unknown[/eluser]
When adding a min/max restriction to the calendar and if the range of the time is within the current month the calendar doesn't seem to handle 30/31 days correctly. If for instance I have the following code:

&lt;input name="endDate" id="endDate" size="23" value="" class="" date:maxDate="new Date(2008, 10 - 1, 31)"/&gt;

The actual output of this would be the max date range only allows selection of the 30th rather than the 31st. If I try this on any other month other than the calendar month we are in now it will work. Strangely enough, this also occurs for the 30th.

I thought that by adding one day to the day passed in "new Date()" would work but it simply display the 1st as well.


  Unknown column
Posted by: El Forum - 10-15-2008, 03:27 AM - Replies (5)

[eluser]umefarooq[/eluser]
Hi
im posting data from form to model after getting all post it give me this error.Unknown column '_module'
here is my code

Code:
$this->db->insert('flipp_settings',$this);


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

Username
  

Password
  





Latest Threads
Version number stays un-u...
by trunky
4 hours ago
codeigniter4/queue Not lo...
by mywebmanavgat
8 hours ago
Array to HTML "Table"
by HarmW94
9 hours ago
shortcodes for ci4
by xsPurX
11 hours ago
TypeError when trying to ...
by b126
Today, 12:04 AM
Webhooks and WebSockets
by InsiteFX
Yesterday, 10:39 AM
Retaining search variable...
by pchriley
Yesterday, 05:46 AM
Reading a session variabl...
by xanabobana
Yesterday, 05:05 AM
Update to v4.5.1, same us...
by kenjis
04-17-2024, 07:47 PM
Codeigniter 4 extend core...
by Semsion
04-17-2024, 05:08 AM

Forum Statistics
» Members: 84,596
» Latest member: fitpreethi
» Forum threads: 77,560
» Forum posts: 375,900

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB