Welcome Guest, Not a member yet? Register   Sign In
  Ajax.Updater and Flash content
Posted by: El Forum - 10-25-2007, 02:33 PM - No Replies

[eluser]ELRafael[/eluser]
Hello everybody!

I have some problems with Prototype Ajax.Updater function. Let's explain my case!

In my view, i have this:

Code:
<div id="principal">
           &lt;?=$capa_html;?&gt;
</div>

&lt;a href="[removed]void(0);" onclick="mostra_video('&lt;?=$video-&gt;id_video;?&gt;');"><img src="/videos/public/preview/&lt;?=$video->preview;?&gt;" border="0" /></a>


    function mostra_video(_id)
    {
        new Ajax.Updater('principal', '/videos/principal/mostrar_video/'+_id, {onComplete:function(){ new Effect.BlindDown('principal');}} );
    }

Ok, its working, fine thanks!

But the var $capa_html has this content

Code:
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','320','height','260','title','Videos','src','/videos/public/flv_player/flvplayer','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','flashvars','file=/videos/public/videos/&lt;?=$capa->arquivo;?&gt;','movie','/videos/public/flv_player/flvplayer' ); //end AC code

            
            <noscript>
            
            &lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="320" height="260" title="Videos"&gt;
            <param name="movie" value="/videos/public/flv_player/flvplayer.swf" />
            <param name="quality" value="high" />
            <param name="flashvars" value="file=/videos/public/videos/&lt;?=$capa->arquivo;?&gt;" />
            &lt;embed src="/videos/public/flv_player/flvplayer.swf" width="320" height="260" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" flashvars="file=/videos/public/videos/&lt;?=$capa-&gt;arquivo;?&gt;">&lt;/embed&gt;
            &lt;/object&gt;
            </noscript>
<br />
<strong>&lt;?=$capa->nome;?&gt;</strong><br />
&lt;?=$capa->descricao;?&gt;

The string ($capa->nome and $capa->descricao) show fine. But the script part doesn't!!!

I saw in the scriptaculous wiki, a param called evalScripts, but if i set true, the updater clear the page and show me only the AC_.....

Ah, this script is for a flash content!!!

Thanks


  [Suggestion] Split the dev questions forums in two: Basic / Advanced
Posted by: El Forum - 10-25-2007, 02:26 PM - Replies (15)

[eluser]Alex007[/eluser]
Just like the title says, should we split the "Code and Application Development" in two, one for basic questions, and one for advanced questions ?

I ask, because reading that forum is getting tiresome sometimes, it gets hammered with newbie questions repeated over and over by people who don't even try to search first. Some of them can't even ask a decent question (aka "MY blogZ not worky please HALP!!" with no details at all), some have almost no idea of what PHP is, or speak a broken engrish that even I can't understand.

</end newbie rant>

Don't get me wrong, I don't hate newbies, I even enjoy helping them *if* I feel they are trying to help themselves and will learn something from our help.

It would be cool if we could split the dev forum into two, one for basic questions (php, DB, basic codeigniter), and one for advanced questions.

I really enjoy reading the forums, and advanced questions threads are very interesting to read, we all learn a lot from them, but right now they are so diluted by basic-questions threads that it gets tiring searching for them.

Also, the basic questions forum could have a nice big sticky thread with things to do first (like reading the manual, searching the forums, etc...) and how to post a question (include error messages, code excerpts) ... to make it easier for us to help them.

Is it a good idea, or am I simply a grumpy old man ?


  [Resolved] Multipart Forms not passing data
Posted by: El Forum - 10-25-2007, 11:43 AM - Replies (4)

[eluser]Phil Sturgeon[/eluser]
Im using the file upload class for the first time in a long time and getting the craziest error!

Quote:&lt;?=form_open_multipart('contests/mosaic/submit');?&gt;

<p style="padding:20px">Bla bla stuff and junk about the competition, perhaps add a few pics, go wild!</p>

<label for="photo1">Photo #1: &lt;?=form_upload('photo1');?&gt;</label><br/>
<label for="photo2">Photo #2: &lt;?=form_upload('photo2');?&gt;</label><br/>
<label for="photo3">Photo #3: &lt;?=form_upload('photo3');?&gt;</label><br/>

<br/>
&lt;?=form_submit('submit', 'Submit');?&gt;
&lt;?=form_close();?&gt;

This is sent to a page where I have just put in a BASIC print_r($_POST); for debugging as it wasnt giving me the data I expected. The post arr is totally empty, not even submit shows. If I remove _multipart then it works fine, but of course thats not going to help me upload any files!

Anyone have any ideas?


  Which database will the system choose to insert the record ??
Posted by: El Forum - 10-25-2007, 10:02 AM - Replies (2)

[eluser]cinewbie81[/eluser]
The following is my database config file setting:

Code:
$active_group = "db1";
$db['db1']['hostname'] = "localhost";
$db['db1']['username'] = "root";
$db['db1']['password'] = "password;
$db['db1']['database'] = "db1";
$db['db1']['dbdriver'] = "mysql";
$db['db1']['dbprefix'] = "";
$db['db1']['active_r'] = TRUE;
$db['db1']['pconnect'] = TRUE;
$db['db1']['db_debug'] = TRUE;
$db['db1']['cache_on'] = FALSE;
$db['db1']['cachedir'] = "";


$active_group = "db2";
$db['db2']['hostname'] = "localhost";
$db['db2']['username'] = "root";
$db['db2']['password'] = "password;
$db['db2']['database'] = "db2";
$db['db2']['dbdriver'] = "mysql";
$db['db2']['dbprefix'] = "";
$db['db2']['active_r'] = TRUE;
$db['db2']['pconnect'] = TRUE;
$db['db2']['db_debug'] = TRUE;
$db['db2']['cache_on'] = FALSE;
$db['db2']['cachedir'] = "";

And here's my code:

Code:
$DB1 = $this->load->database('db1', TRUE);
$DB2 = $this->load->database('db2', TRUE);

$this->db->insert('mytable', $data);


Let's assume that both db1 and db2 have the exactly the same database structure.
My question is when i call $this->db->insert('mytable', $data) statement, the system will save the data in db1 or db2? How can i manually control which db i want the data to be inserted ? Anyone ?


  Bug for routing sub-foldered controller [includes patch]
Posted by: El Forum - 10-25-2007, 09:55 AM - Replies (1)

[eluser]Unknown[/eluser]
Hi everybody,

I came upon this bug while developing a branch of my application for facebook and needed to put my facebook controllers in a subfolder.

The problem is with Router segments array, in my case it looks like this:

1)"raw" segments (before parsing routes), "facebook" is my sub-folder

Code:
array(4) { [0]=> string(8) "facebook" [1]=> string(11) "<CLASS>" [2]=> string(5) "<METHOD>" [3]=> string(7) "<PARAM>" }

2) routed segments ($Router->rsegments)
Code:
array(3) { [0]=>  string(11) "<CLASS>" [1]=>  string(5) "<METHOD>" [2]=>  string(7) "<PARAM>" }

and surprisingly the first one is served in the end, so it looks like routing didn't happen..


In Router.php there's a method _reindex_segments() (line 252) where you check :
Code:
array_diff($this->rsegments, $this->segments)

And here's the bug.. even though on php.net (http://pl.php.net/manual/en/function.array-diff.php) they say that array_diff "Compares array1 against array2 and returns the difference." it doesn't work like this.. instead it returns an array containing all the values of array1 that are not present in any of the other arguments.


So in my case your check returns $diff = false even if arrays are different.


My patch looks like this :
Code:
$diff = (count(array_diff($this->rsegments, $this->segments)) == 0 && count(array_diff($this->segments, $this->rsegments)) == 0) ? FALSE : TRUE;


And it works perfectly like this Smile

Best,
Andrzej


  Getting pagination to work with POSTED variables
Posted by: El Forum - 10-25-2007, 08:55 AM - Replies (3)

[eluser]worchyld[/eluser]
I have a paginated list of customers, and on the same page I also have a form where you can add a customer (not implmented yet).

The form sends back to the same page, and a redirect is actioned so that
it doesn't give that crappy cached POSTed variables message.

In order for it to remember the offset I force the session variable to remember the offset, except that when I click page 1 it never lets me get back to page 1 at all.

How do I fix this?

This is what I want the page to handle:

1) Paging with GET variables
2) Paging with POST variables
3) Handle incoming POSTed form data which sends an offset
4) Post a "Successfully saved message"
5) Stop the page from displaying the cached POSTed variables message when you press F5
6) Remember what page (offset) you are on, yet still allow you to get back to page 1.

Here is the code.

Code:
&lt;?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
Show_all_customers.php controller
*/

class Show_all_customers extends Controller {

    // Constructor
    function Show_all_customers() {
        parent::Controller();
    } // end function

    // ==========================================

    // Main handler
    function index() {

        // Load libraries
        $this->load->library('pagination');
        $this->load->library('table');
        $this->load->library('validation');

        // Get the page offset
        $offset = $this->get_page_offset();

        // Handle form validation
        $rules['name'] = "trim|required|xss_clean";

        $this->validation->set_rules($rules);

        /*
        If there are the validation has not run list all pages to offset, else redirect to same page with a success message.
        */
        if ($this->validation->run() == FALSE) {

            // This prevents me from going back to page 1 -- why?
            $this->session->set_flashdata('offset', $offset);

            // List all
            $this->list_all($offset);

        } else {

            // Do something here (add, edit, delete?)
            // Redirect to same page with success msg
            $this->session->set_flashdata('msg', 'Save succeeded');
            $this->session->set_flashdata('offset', $offset);

            // stops silly "cached" post message
            redirect('show_all_customers');
            // $this->list_all($offset);

        } // end if
    } // end function

    // ==========================================

    // List all customers in a paged format
    function list_all($offset=0) {

        // Load customer model
        $this->load->model('Customer_list_model');

        // Pagination config
        $config['base_url']     = site_url('show_all_customers/index/');
        $config['total_rows']   = $this->db->count_all('ci_customers');
        $config['per_page']     = 10;
        $num                    = $config['per_page'];
        $config['cur_page']        = $offset;
        $data['offset']            = $offset;

        $this->pagination->initialize($config);        // Run paging

        // Get paging results
        $data['results']        = $this->Customer_list_model->get_customers('ci_customers', $num,    $data['offset']);

        // =======================================================

        $data['message'] = $this->session->flashdata('msg');

        // Set page variables
        $this->view->set("data", $data);
        $this->table->set_heading('ID', 'Name');

        // =======================================================

        // Load the actual page
        $this->view->load('show_all_customers');

    } // end function

    // ==========================================

    // Get the paging offset
    function get_page_offset() {
        $offset=0;

        if (is_numeric($this->uri->segment(3))) {
            // Handle GET variable
            $offset    = $this->uri->segment(3);
        } else {
            // Handle POST variable
            if (is_numeric($this->input->post("offset"))) {
                $offset = $this->input->post("offset");
            } else {
                // Handle SESSION variable
                if (is_numeric($this->session->flashdata('offset'))) {
                    $offset = $this->session->flashdata('offset');
                } else {
                    // Use default
                    $offset = 0;
                } // end if
            }
        } // end if

        return ($offset);
    } // end function


} // end class
?&gt;
Code:
&lt;?php
/*
Customer_list_model.php
*/
class Customer_list_model extends Model {

    // Constructor model
    function Customer_List_Model() {
        parent::Model();
    } // end function

    function get_customers($table='ci_customers', $num=0, $offset=0) {
        $query = $this->db->get($table, $num, $offset);        
        return $query;
    } // end function
} // end mOdel
?&gt;

Code:
&lt;!--
VIEW FILE | Show_all_customers.php
--&gt;

&lt;?=$this->table->generate($data['results']); ?&gt;
&lt;?=$this->pagination->create_links(); ?&gt;

<hr />

&lt;?=$this->validation->error_string; ?&gt;
<br />Msg:&lt;?//$this->session->flashdata('msg');?&gt;
&lt;?=$data['message'];?&gt;
&lt;!-- Form --&gt;
&lt;?=form_open('show_all_customers/index'); ?&gt;

<fieldset>
    <legend>Add Customer</legend>

    <p>
        <label for="name">Name:</label><br />
        &lt;input type="text" name="name" id="name" value="" /&gt;
    </p>

    <p>
        &lt;input type="submit" value="Submit" /&gt;
        &lt;input type="text" id="action" name="action" value="add" /&gt;
        &lt;input type="text" id="offset" name="offset" value="&lt;?=$data['offset'];?&gt;" /&gt;
    </p>
</fieldset>

&lt;?=form_close();?&gt;
&lt;!-- /Form --&gt;


  ob_start() error: caused by Gzip compression?
Posted by: El Forum - 10-25-2007, 06:28 AM - Replies (1)

[eluser]codex[/eluser]
A friend is getting this error

Code:
'Fatal error: ob_start() [<a href=’ref.outcontrol’>ref.outcontrol</a>]: Cannot use output buffering in output buffering display handlers in ~PATH_TO_CODEIGNITER_ROOT~\libraries\Exceptions.php on line 160'

on this page: http://www.graffr.com/explore/

At home (Firefox 2.0.0.8) I'm getting the same, but at the office no error. I've tested it on FF 2.0.0.8, IE7 and IE6, but no error.

Could it be caused by Gzip compression enabled in config.php?


  CI in Windows 2003 Server
Posted by: El Forum - 10-25-2007, 06:08 AM - Replies (9)

[eluser]Unknown[/eluser]
Hi Guys,
I am about to develop a site.
I want to use CI.
But the site is to be hosted in Windows 2003 Server.
My first live site in CI and in Windows 2003 Server with PHP & MySQL.

I want to know is there any known issue with CI in Win 2003 Server environment.

Share it if you have any.


  Problems with CI, please HELP
Posted by: El Forum - 10-25-2007, 04:46 AM - Replies (13)

[eluser]cibill[/eluser]
well

this are my files and change i`ve been made:

---
autoload.php

for recognition of my database i`ve done this change

|
*/
$autoload['core'] = array('database');

------

My blog controller blog.php looks like this:

&lt;?php

class Blog extends Controller {


function Blog()
{
parent::Controller();

$this->load->helper('url');
$this->load->helper('form');
}

function index()
{
$data['title'] = "My Blog Title";
$data['heading'] = "My Blog Heading";
$data['query'] = $this->db->get('entries');

$this->load->view('blog_view', $data);
}
}

?&gt;


-----


And my blog_view.php file looks like this:


&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;?=$title?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
<h1>&lt;?=$heading?&gt;</h1>



&lt;?php foreach($query->result() as $row): ?&gt;

<h3>&lt;?=$row->title?&gt;</h3>
<p>&lt;?=$row->body?&gt;</p>

<p>&lt;?=ancor('blog/comments', 'Comments');?&gt;</p>

<hr />

&lt;?php endforeach; ?&gt;


&lt;/body&gt;

&lt;/html&gt;

------


well and the browser is showing me this Error Mesage:


A PHP Error was encountered

Severity: Notice

Message: Undefined property: Blog::$db

Filename: controllers/blog.php

Line Number: 18


------


QUESTION: where is the problem (i know line 18 blog.php), i did exactly the same thing like in video tutorial, maybe i`ve done wrong the cofig files, or what?!

can anyone help me

I have problems also with the links when i`m using the scaffolding, but this is another story...


best regards


  uri -> segment numeric key inconsistency
Posted by: El Forum - 10-25-2007, 03:58 AM - Replies (5)

[eluser]kylehase[/eluser]
I'm trying to do the following with a large table from a DB query but it's proving difficult using uri segments:

1) paginate - (segment 3 by default)
2) search string - (segment 4?)
3) sort key - (segment 5?)
4) sort order - (segment 6?)
5) other - (filter results etc...)

The problem is that if any one of these is unused (omitted) then the segment number for all later segments shift down. For instance if I want to sort but didn't run a search, the sort key would be segment 4, not 5.

GET query strings address this easily since the array is associative but I'd like to avoid GET query strings just to be safe.
One solution is to always use segment key/value pairs which could be converted to an associative array.

www.example.com/class/method/page/4/search/phone/sort/price/order/ascend/filter/instock

Not sure what happens if there's no method segment (index or constructor generated page). Will /page/ still be segment(3)?
Any other suggestions? I'm sure someone has done this before.


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

Username
  

Password
  





Latest Threads
Changing Session cookie -...
by InsiteFX
19 minutes ago
Update from 4.6.0 to 4.6....
by Vespa
Today, 01:17 AM
hot-reload side effects s...
by InsiteFX
Yesterday, 10:11 PM
using app/Config/App.php ...
by sam547
05-16-2025, 03:04 PM
Setting baseURL in Regist...
by grimpirate
05-15-2025, 02:20 PM
CRUD Code Generator
by DeanE10
05-15-2025, 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
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

Forum Statistics
» Members: 146,733
» Latest member: fb88gamingcom
» Forum threads: 78,392
» Forum posts: 379,470

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB