Here's my Codeigniter function:
function edit_phone($phone)
{
if (preg_match('/^\(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}$/', $phone))
{
return preg_replace("/([0-9]{3})([0-9]{3})([0-9]{4})/", "$1-$2-$3", $phone);
}
else
{
$this->CI->validation->set_m...
Hey guys,
I have got a little problem using the CodeIgniter route function.
I use the URI_Language_Identifier extension and I want to reroute all
the requests for "lang/login" (e.g. en/login or de/login) to user/login I tried to use the routes function as follows, but it does not work:
$route['(\w{2})/login'] = "/user/index";
this ho...
I am about to start writing my first big CodeIgniter application, but before I get started I was wondering what the role of libraries should be. I'm a newbie to MVC, but from what I gather the model should be where the data structures are stored (business logic). So is the library a place to write application logic, in addition to contro...
I have a form that requires the user to enter some information. If they fail to complete the required fields they are re-presented with the form; the top of the page notifying them what fields are required and I've enabled sticky forms (set_value()) so their input is not lost.
I'm using flashdata to display messages to the user (i.e., ...
hi,
how to pass a php variable to dynamicaly generated div's onclick event?
here is my code
while($rowset = mysql_fetch_array($result))
{
$idTT1++;
$editTT='b'.$idTT1;
$hidTextTT='t'.$idTT1; $hidSubIdTT='s'.$idTT1;
echo "<tr><td>".$rowset[1]." ".$rowset[2]."</td><td> </td>
<td class='table_label'>
<...
I use Windows and I display a file extention.
When I upload an image file with PHP, a image name of image1_big.jpg becomes image1_big.jpg.jpg.
And image2.gif becomes image2.gif.gif.
I don't want to turn off file extension.
How can I avoid this problem?
function addProduct(){
$data = array(
'name' => db_clean($_POST['na...
I have the following model(codeigniter) code to upload image and thumbnail.
However the result of image path becomes, images/comfort_big.jpg and images/comfort_big.jpg.jpg.
The thumbnail image picks up the name of image and add .jpg.
I am uploading images/confort_thumb.jpg for thumb.
Can anyone tell me what's wrong please?
if ($_FIL...
ok, so i can't tell if this is a server issue or what. i've got an htaccess file like so:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/main/index/$1 [L]
RewriteRule ^ajax/(.*...
I have many goals to be printed on the screen.
but it shows error when i use it like this
echo $this->validation->rshort_goal.$i;
What is the right way to use this?
if($sgoal !='')
{
$scount = count($sgoal);
$i =1;
foreach($sgoal as $row)
{
<textarea name="rshort_goal<?php print $i;?>" id="short_goal" class="sho...
I have an application that allows users to upload images. The test case I use is a jpeg of 1.6MB with dimensions 3872 x 2592px. The upload script in the back-end will resize the uploaded image into 6 additional formats:
square (small 75 x 75)
Small Thumb (50 x 38)
Thumb (100 x 76)
Small (240 x 161)
Medium (500 x 378)
Large (1024 x 774)...
Hello,
I am building a website in which the user can select what list items they see in their navigation menu, my idea is to store the menu items that the user selects in a cookie as this will stop the need for the user to be registered member on the website, is it possible to store realtime data in a cookie and how would I do this? ...
I have deployed my PHP application built on Codeigniter. When I call the root URL, browser is successfully redirected to login view but not HTML is rendered.
What can be the issue?
...
Hello all,
Just started using CodeIgniter, loving it.
Having enabled the database to be one of the libraries to be loaded. I noticed that on pages that I don't even use the database (static pages). CI complains:
A Database Error Occurred Unable to
connect to your database server using
the provided settings.
The error is not a...
Hi,
I'm developing on Mac OSX with MAMP. My app is built on top of CodeIgniter 1.7.2 and works fine on my develoment machine.
Now I copied the to my test environment, which is Ubuntu Server 9.10.
A standard, fresh CI install works perfectly but when I put my app in the same dir, I get errors.
If I just go to my root, I get a 404. On ...
Are there any options to get the last insert id of a new record in CodeIgniter?
$last_id = $this->db->insert('tablename',
array('firstcolumn' => 'value',
'secondcolumn' => 'value')
);
Considering the table consits of fields id (autoincrem...
Hai guys,
As i am a newbie to codeigniter with php i dont know where to start please guide me with some useful links...
...
Hello, I'm building a website using Flex, Codeigniter, and I use swfobject to embed the swf.
This will not work if I access the website using Codeigniter's index.php file.
This is the ouput source:
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<base href="http://localhost/Pixelatte-debu...
When I use function create_category(), it will create a directory with this name such as images/newfolder.
Then I have a function edit_category() which checks post('name').
In a controller
function edit_category($id=0){
if ($this->input->post('name')){
...
...
I don't want to allow to change the category name. It will create anoth...
I have a site where users can upload images. I process these images directly and resize them into 5 additional formats using the CodeIgniter Image Manipulation class. I do this quite efficiently as follow:
I always resize from the previous format, instead of from the original
I resize using an image quality of 90% which about halves th...
Im looking for a step by step tutorial that covers Google's Federated Login process using php and cURL. All needs to get dumped into codeIgnitor so it really needs to be easy to follow.
...