Welcome Guest, Not a member yet? Register   Sign In
  How to have a trailing slash at the end of the URL??
Posted by: El Forum - 02-08-2008, 05:25 PM - Replies (5)

[eluser]jigen7[/eluser]
i want to have a trailing slash at the end of my url...

Code:
<?=anchor('main/show_all/','Show All');?>

but still at the end of the url for example where the link is it only shows

http://goldmine/jigen/jigsdb/index.php/main/show_all

the one i want to do is

http://goldmine/jigen/jigsdb/index.php/main/show_all/

so anyone have an idea?how to do this?thx


  Zip class fails to download a file if the file is around 400Kb or more
Posted by: El Forum - 02-08-2008, 04:54 PM - Replies (1)

[eluser]Unknown[/eluser]
/*
Could anybody give me some advice, I've encountered that CI Zip class fails to download a file if the file is around 400Kb or more, for smaller files it works perfectly, to isolate the problem I've put the code that fails on a simplistic script. To run this code, copy Zip.php and this script to your htdocs folder and run it from there.
*/


<?php

require 'Zip.php';

$zip = new CI_Zip();

$path = 'C:/Temp/Jpg/BigFile.jpg'; // Points to the file we want to zip.

$zip->read_file($path , TRUE );

//
// This always work.
//
$zip->archive( 'C:/Temp/my_backup.zip' );

//
// This fails if the file is around 400Kb or more.
//
$zip->download('my_backup.zip');

?>


  how about svn or phpDocumentator in CI proyects?
Posted by: El Forum - 02-08-2008, 04:27 PM - Replies (2)

[eluser]Olivares[/eluser]
Hello friends.

I found codeigniter some months ago, and i think is great and i start to wonder, if someone of you has used svn or phpDocumentator in a CI proyect.

Do you have some experiencies you want to share?.

cheers.


  looping through form fields
Posted by: El Forum - 02-08-2008, 04:07 PM - Replies (2)

[eluser]jplanet[/eluser]
I have a VERY bizarre probem. When I use code to loop through form fields using the $_POST array in a foreach block, I get strange errors in other code later on the page. I am chalking this up to a bug in PHP5.

From what I can find, Codeigniter's input class only provides acces sto individual post variables using $this->input->post('fieldname'). Is there a way I can access the array of post variables using a Codeigniter function?

For those who are curious, this is the code that breaks my application:

Code:
foreach($_POST as $key => $data) {
        if(strstr($key,"wrap_")){
        $cart_id = stristr($key,"_");
        $cart_id = str_replace("_","",$cart_id);
        $this->cart_model->addWrap($cart_id);
        }
        }

Once I insert this code, I get this error:

Code:
A PHP Error was encountered

Severity: Notice

Message: Array to string conversion

Filename: controllers/checkout.php

Line Number: 290

Line 290 refers to this very simple line of code, which does not generate an error when I delete the foreach statement above:

Code:
$data['cart'] = $this->cart_model->getCart($this->session->userdata('session_id'));

Even if I replace the body of the foreach block with a simple echo statement, it produces the same error. As long as I loop through POST variables using foreach, I get the error.


  where to do html encoding (ampersands)
Posted by: El Forum - 02-08-2008, 03:55 PM - Replies (1)

[eluser]Unknown[/eluser]
Hello all,


I am just getting started using Code Igniter, so please be patient with me Smile


Following the blog screencast, I started of using the scaffolding feature and a simple view. I am not sure, however how to handle HTML encoding of content coming from the database.. what's the recommended way to do it?

As far as I can see one could (a) do the encoding when entering into the database (but scaffolding wouldn't do this, right?), (b) manually do htmlspecialchars() in the controller before sending the data to the view and lastly © manually do htmlspecialchars() in the view.

Or am I missing something completely? (I do have to encode ampersands for HTML valdition)


More or less a similar topic: Using UTF-8 as for various encodings is the recommended way to in CI nowadays, right? (I have read about some pitfalls regarding some components, but I ain't sure how much CI 1.8 has improved on that matter).


have a nice day|thanks for your time
g


  Small cosmetic bug in Profiler for CI 1.6.1
Posted by: El Forum - 02-08-2008, 02:22 PM - Replies (3)

[eluser]coldKingdom[/eluser]
I just noticed a small cosmetic bug in the profiler text in version 1.6.1

Now

Quote:SELECT `blog_id`, `blog_date`, `blog_header`, `blog_text_sv`, `usr_id`, `usr_name` FROM (`tbl_devblog`) INNER JOIN `tbl_users` ON blog_usr = usr_id ORDER BY `blog_date` desc LIMIT 1

Should be

Quote:SELECT `blog_id`, `blog_date`, `blog_header`, `blog_text_sv`, `usr_id`, `usr_name` FROM (`tbl_devblog`) INNER JOIN `tbl_users` ON blog_usr = usr_id ORDER BY `blog_date` desc LIMIT 1

As you can see there is only the word OR in ORDER BY that are bolded.

Best Regards
Andreas


  updating CI
Posted by: El Forum - 02-08-2008, 02:17 PM - Replies (1)

[eluser]alebenson[/eluser]
hi there!
i was alway afraid updating something that is working...
i start a job working with the ci 1.5.4 and in the middle the 1.6 comes out
is it possible that if i update something goes wrong with my finish job?

tnks!


  Check if checkbox is checked
Posted by: El Forum - 02-08-2008, 02:00 PM - Replies (3)

[eluser]freshface[/eluser]
How do I do this with CI?
Check if checkbox is checked, it dont want the value but just to know if it was checked or not.


  execute mysql stored procedures with CodeIgniter
Posted by: El Forum - 02-08-2008, 01:23 PM - Replies (18)

[eluser]Unknown[/eluser]
Hi to all, please I need to know if I can execute a stored procedure from mysql 5.0 using codeigniter´s database functions.

Thank you.


  Foreign Characters url_title
Posted by: El Forum - 02-08-2008, 01:11 PM - Replies (9)

[eluser]Eric Barnes[/eluser]
Here is a small change I made to convert foreign characters to their English equivalent.

Create My_url_helper.php and place in application/helpers/ folder. Next add this code:

Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

// ------------------------------------------------------------------------

/**
* Create URL Title
*
* Takes a "title" string as input and creates a
* human-friendly URL string with either a dash
* or an underscore as the word separator.
*
* @access    public
* @param    string    the string
* @param    string    the separator: dash, or underscore
* @return    string
*/
if (! function_exists('url_title'))
{
    function url_title($str, $separator = 'dash')
    {
        if ($separator == 'dash')
        {
            $search        = '_';
            $replace    = '-';
        }
        else
        {
            $search        = '-';
            $replace    = '_';
        }
        
        $str = convert_accented_characters($str);
        
        $trans = array(
                        $search                                => $replace,
                        "\s+"                                => $replace,
                        "[^a-z0-9".$replace."]"                => '',
                        $replace."+"                        => $replace,
                        $replace."$"                        => '',
                        "^".$replace                        => ''
                       );

        $str = strip_tags(strtolower($str));
    
        foreach ($trans as $key => $val)
        {
            $str = preg_replace("#".$key."#", $val, $str);
        }
    
        return trim(stripslashes($str));
    }
}

// ------------------------------------------------------------------------

/**
* Convert Special Chars
*
* Found Via:
* http://us.php.net/manual/en/function.chr.php#72145
*
* @access    public
* @param    string    the string
* @return    string
*/
function convert_accented_characters($string)
{
    for ($i=0;$i<strlen($string);$i++)
    {
        $chr = $string{$i};
        $ord = ord($chr);
        
        if ($ord>32 and $ord<126 or $ord==195)
            continue;
        elseif ($ord==161 or $ord>191 and $ord<198)
            $string{$i} = 'a';
        elseif ($ord==169 or $ord>199 and $ord<204)
            $string{$i} = 'e';
        elseif ($ord>203 and $ord<208)
            $string{$i} = 'i';
        elseif ($ord>209 and $ord<215)
            $string{$i} = 'o';
        elseif ($ord>216 and $ord<221)
            $string{$i} = 'u';
        elseif ($ord>223 and $ord<230)
            $string{$i} = 'a';
        elseif ($ord>231 and $ord<236)
            $string{$i} = 'e';
        elseif ($ord>235 and $ord<240)
            $string{$i} = 'i';
        elseif ($ord>241 and $ord<247)
            $string{$i} = 'o';
        elseif ($ord>249 and $ord<253)
            $string{$i} = 'u';
        elseif ($ord>252 and $ord<256)
            $string{$i} = 'y';
        elseif ($ord==241)
            $string{$i} = 'n';
        elseif ($ord==209)
            $string{$i} = 'N';
        else
            $string{$i} = '';
    }
    return $string;
}

?&gt;

This will hopefully convert á=a, é=e, etc. If anyone sees any problems or improvements please pass them along.


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

Username
  

Password
  





Latest Threads
v4.5.1 Bug Fix Released
by lokman
1 hour ago
problem with textarea
by Nitin Arora
10 hours ago
Showing pdf on browser
by aarefi
11 hours ago
[4.5.1] Disabling the deb...
by keto
Today, 02:43 AM
directory structure
by badger
Today, 01:49 AM
Redirect with error vali...
by pippuccio76
Today, 01:41 AM
Pass custom variables to ...
by InsiteFX
Yesterday, 11:17 PM
How to run a single seede...
by kenjis
Yesterday, 05:41 PM
Codeigniter 4 extend core...
by kenjis
Yesterday, 05:26 PM
blocked by CORS policy
by kenjis
Yesterday, 05:17 PM

Forum Statistics
» Members: 84,335
» Latest member: fb88sco
» Forum threads: 77,553
» Forum posts: 375,876

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB