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



Search Forums

(Advanced Search)

Forum Statistics
» Members: 15,461
» Latest member: tours
» Forum threads: 70,553
» Forum posts: 362,832

Full Statistics

Latest Threads
Update database without r...
Forum: General Help
35 minutes ago
» Replies: 1   » Views: 32
[Solved] Unable to genera...
Forum: CodeIgniter 4 Support
47 minutes ago
» Replies: 2   » Views: 121
How to integrate Python w...
Forum: General Help
54 minutes ago
» Replies: 9   » Views: 242
How to create Controller ...
Forum: General Help
3 hours ago
» Replies: 11   » Views: 220
Zip library "Allowed memo...
Forum: Libraries & Helpers
3 hours ago
» Replies: 3   » Views: 86
how create an self instal...
Forum: Installation & Setup
8 hours ago
» Replies: 5   » Views: 450
Important News about Jim ...
Forum: News & Discussion
9 hours ago
» Replies: 56   » Views: 12,633
My replies got deleted
Forum: Lounge
10 hours ago
» Replies: 7   » Views: 334
Logout Session with sess_...
Forum: CodeIgniter 3.x
10 hours ago
» Replies: 1   » Views: 68
Get array lang variables
Forum: CodeIgniter 4 Support
Yesterday, 04:17 PM
» Replies: 3   » Views: 192

  Warning: headers already sent by ...(for AJAX library)
Posted by: El Forum - 07-11-2007, 06:23 AM - Forum: Archived Libraries & Helpers - Replies (1)


im trying to use the projax and tinyAjax library , i also configured them as the are asked in CI wiki but in both case im gating the following warning ( i know why its happened usually "register_globals" , i have tried to fix it by making it off/on but its not working.)

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at D:\wamp\www\PD\system\application\controllers\ajax.php:40)

Filename: errors/error_404.php

Line Number: 1

my controller and view file are as bellow:


class Ajax extends Controller {
    function Ajax()
    function multiply()
        $this->tinyajax->exportFunction("ajax_multiply", array("first_id", "second_id"), "#third_id", $this);
    function ajax_multiplyb($x, $y)
      $res = $x * $y;
      $res_text = "Multiplying $x and $y results in $res";
      $tab = new TinyAjaxBehavior();
      $tab->add(TabSetValue::getBehavior("third_id", $res));
      $tab->add(TabInnerHtml::getBehavior("result_div", $res_text));
      return $tab->getString();

    function multiplyb()
        $this->tinyajax->exportFunction("ajax_multiplyb", array("first_id", "second_id"), null, $this);

<? $this->tinyajax->drawJavaScript(false,true); ?>
    &lt;input type="text" id="first_id" value="2"&gt; *
    &lt;input type="text" id="second_id" value="3"&gt; =
    &lt;input type="text" id="third_id" value=""&gt;
    &lt;input type="button" value=" * " onclick="ajax_multiplyb()"&gt;
    <div id="result_div">&nbsp;</div>

i think both of the library is not working for one reason.

will anyone tell me how to fix it ?

  I know there is a better way...
Posted by: El Forum - 07-11-2007, 01:09 AM - Forum: Archived Development & Programming - Replies (5)

What I'm trying to do is parse an HTML table, turning it into a CSV document. (each <tr> gets it's own line, each <td> value is separated by a ",")

I'm trying to turn:

Into this:

The PHP I have written is for a specific format, but I want a more general parser, so that I can just use this form quickly in the future with any other table no matter what the dimensions are.

Here is what I have (please, save coding practices preachyness for later):


if(isset($_POST['data'])) {
    $data = $_POST['data'];
    $tables = preg_split("/<table.*?&gt;/i",$data);

    $rows = preg_split("/<tr.*?&gt;/i",$tables[1]);
    for($x=0;$x<count($rows);$x++) {
        $cells[$x] = preg_split("/<\/td.*?&gt;/i",$rows[$x]);
    $s = array("\n","\r");
    $r = array("","");
    echo "<pre>\n";
    for($i=1;$i<count($cells);$i++) {
        $line = array($cells[$i][0],$cells[$i][1],str_replace(", ","\, ",$cells[$i][3]));
        $subject = strip_tags(implode(",",$line));
        echo str_replace($s,$r,$subject) . "\n";
    echo "\n</pre>";
} else {
    echo "This form takes tabular (HTML Tables) data and converts it to CSV format.";
    echo "&lt;form method=\"post\"&gt;\n";
    echo "&lt;textarea name=\"data\" cols=100 rows=15&gt;&lt;/textarea&gt;\n";
    echo "<br />&lt;input type=\"submit\" value=\"Convert\" /&gt;\n";
    echo "&lt;/form&gt;\n";


This works for a specific situation (as you can see I manually specified the cells to use in $line). But, like I said, I want this to be more flexible in the respect that the table could be any dimension.

I know I will figure this out eventually, but I've been thinking myself into a corner for a few hours and I figure maybe someone can smack some sense into me.

Thanks in advance!

  Call to undefined method CI_DB_mysql_driver::row()
Posted by: El Forum - 07-11-2007, 12:26 AM - Forum: Archived Development & Programming - Replies (2)

------- EDIT -----------
I am such an a$$ - I forgot:

after the AR call.

Sorry to waste your time!

------- EDIT ---------

Hi all,

Perhaps I am being a dumbass, but I'm getting this error:

Quote:Call to undefined method CI_DB_mysql_driver::row()

and this is the model:
class Portfolio extends Model {
        var $shop_id; // Contains the ID for the Whats in the Shop car.
        function Portfolio() {
        function getShop(){
            if (empty($this->shop_id)){
                $q = $this->db->select('p_id')->from('type_lkp')->where('t_id',3)->orderby('p_id', 'desc')->limit(1);
                $row = $q->row();
                $this->shop_id = $row->name;
            return $this->shop_id;
        function getShopCopy() {
            $q = $this->db->select('desc')->from('portfolio')->where('id', $this->getShop());
            $r = $q->row();
            return $r->desc;

The error is on this line: $row = $q->row();

I can't see what the problem is - am I doing something very stupid?

Thanks in advance,


  CMS opensource
Posted by: El Forum - 07-10-2007, 09:24 PM - Forum: Archived Development & Programming - No Replies

any one have url to download cms using CI free download

  give me 5! (calling a controller function from a view)
Posted by: El Forum - 07-10-2007, 04:42 PM - Forum: Archived General Discussion - Replies (18)

Maybe this is too simple, but I don't know what I'am doing wrong.

this is the file controllers/test.php


class Test extends Controller {

function Test()

function index()

function give_me_5()
return 5;


and this is the file views/test_view.php

&lt;?=$this->test->give_me_5(); ?&gt;

but it doesn't work.

I'm calling the function correctly?

Sorry if I offend your inteligence with that simple question Wink

  Creating custom/calculated model properties
Posted by: El Forum - 07-10-2007, 01:50 PM - Forum: Archived General Discussion - Replies (2)


I'm looking for some advice on best practices for representing a calculated or custom property of a model in CI. I've checked the docs, forum archives, and BambooInvoice but only found straight database calls in the models and no additional or computed values.

For example, if I wanted to add a mathematical "difference" value to each row of my query result set (based on the difference between two columns), and then expose this value as a model property, how would I best accomplish this?

Put another way, if I'm going to call my "get_all" function and return the query results to my controller, what's the best way to pop some additional values in there?

Two options that won't work for me in this case are denormalizing the database by adding a calculated column (and thus creating database redundancy), or using DBMS-specific functions (creating platform dependencies or at minimum the need to ensure there aren't any!).

Thank you!

  I hope this is not a bug!
Posted by: El Forum - 07-10-2007, 01:41 PM - Forum: Archived General Discussion - Replies (3)

In my project, I'm doing my best to shorten URLS without editing .htaccess file.

so I used _remap function as main function in the controller to skip the function part in URLs

will run similar to

and this work just fine ... but what if I want to pass more variables?


in that case, you always get "Missing argument" warnning even if you put default values like:

function _remap(variable1='something',variable2='something else')

Is there any way to force _remap take more than 1 arguments?

  Search engines indexation
Posted by: El Forum - 07-10-2007, 01:30 PM - Forum: Archived Development & Programming - Replies (3)


I have a SEO problem here... When someone is accessing the site the page showing is /index.php/home, rather than only index.php. This redirection is loosing the SE crawlers, because there's nothing ont he index page.

Is there a simple way to make /index.php/home page to be the default page when someone is accessing the site?

If you need to see codes, let me know what you need. Thanks

  Problems with Active Record
Posted by: El Forum - 07-10-2007, 12:36 PM - Forum: Archived Development & Programming - Replies (2)


I need some help with this problem, hope that someone can help me

Ok, I need to do a query like this:

SELECT field WHERE field1='1' AND (field2='2' OR field3='3')

How can I do this with Active Records class?

  Duplicated methods
Posted by: El Forum - 07-10-2007, 11:35 AM - Forum: Archived General Discussion - Replies (4)


class Test extends Controller
    function mymethod()
        echo "My method with no parameters";

    function mymethod($id)
        echo "My method with one parameter: " . $id;
Is this possible to do with codeigniter? I don't know what you call it, overloading of methods?

If i request: /test/mymethod/
"My method with no parameters" will be returned.

And if i try: /test/mymethod/45
"My method with one parameter: 45" will be returned.

I have tried but with no success. If it's not possible, maybe this would be a good future implementation?

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.