Welcome Guest, Not a member yet? Register   Sign In
CodeExtinguisher 2.0 Release Candidate 14.2

[eluser]Majd Taby[/eluser]
i had this functionality built into CodeExtinguisher. It was called 'extra_uri_segments' and they would be carried around the system until they were replaced. However, I deprecated that when query_strings were introduced since query_strings are a more robust solution. But to answer your question. I would add the primary key to userdata. So something like this:

Code:
if(!$id = $this->codexsession->userdata('lines_of_sale')){
    if($id = $this->uri->segment(3)){
        $this->db->where('sale_id',$id);
    } else {
        show_error('no id found');
    }
} else {
   $this->db->where('sale_id',$id);
}

Of course, this code isn't that good (you can factor out the common code and combine the conditions..but it should give you and idea.

But to answer your question. Don't forget that all the links that codex uses are set in codexcontroller:ConfusedetConfig() so if you want to modify them so that they always maintain the extra uri segments, it's very easy to do so. Here's what you would have to do:

1) Add $this->extra_uri_segment = implode('/',$this->uri->uri_to_assoc(3)); in codexcontroller:ConfusedetConfig()
2) Append .'/'.$this->extra_uri_segments to all the links and form actions in codexcontroller:ConfusedetConfig

[eluser]Donald Hughes[/eluser]
How do I increase the length of a TextBox?

[eluser]Majd Taby[/eluser]
although you can define your attributes, textboxes are styled in css, so you'd have to define them.

[eluser]gusa[/eluser]
[quote author="abmcr" date="1212753097"]
IN few words, in the overview mode, i create a link to the second table (in your case lines_of_sale) with
Code:
$config = array(
                    'db_table' => 'example',
                    'form_setup' => $this->spyc->YAMLLOAD($this->codexadmin->getDefinitionFileName('example_form')),
                    'controller_name' => 'Example',
                    'primary_key' => 'my_id',
                    'display_fields'=>array('textbox_test','checkbox_test','related2'),
                    'order_by' => 'textbox_test',
                    'order_type' => 'DESC',
                    'table_access_restriction'=>array('my_id '=>$this->uri->segment(3)),
                    'rules'=>$rules
                    );
        $this->setConfig($config);
[/quote]

thanks abmcr and jtaby. i made something similar by creating a plugin called LinkTo. in your example linkto would be the plugin for 'related2'. the problem is that when i execute the code it seems that codex tries to select the column 'related2' from the database.

can i create a field that's not associated to any field in the database? how?

[eluser]Majd Taby[/eluser]
in your plugin, right this:

Code:
function getFieldName(){ return NULL; }
function prepForDb(){ return NULL; }

If those functions return NULL, they will be eliminated from their respective query.

[eluser]gusa[/eluser]
[quote author="jTaby" date="1212795267"]in your plugin, right this:

Code:
function getFieldName(){ return NULL; }
function prepForDb(){ return NULL; }

If those functions return NULL, they will be eliminated from their respective query.[/quote]

are you sure that's working?
i defined getFieldName as:

Code:
function getFieldName(){
    echo 'over here!';
    die;
}

and the code is never executed.

[eluser]abmcr[/eluser]
[quote author="gusa" date="1212786046"] i made something similar by creating a plugin called LinkTo. in your example linkto would be the plugin for 'related2'......[/quote]
I have a very interest for this feature, gusa.... tell me if you want to share with us your plugin.. ciao

[eluser]ocergyNohtna[/eluser]
I have no idea what I did to cause this. Everything appears fine, but all of the sudden one of my DbDropdowns doesn't display when editing now. It shows when adding but not editing. Any idea where I can look to see why this is happening??

[eluser]Majd Taby[/eluser]
could you show us what is happening? try to print_r() some info on getHTML, look into the HTML source, are there any hidden PHP errors in the html?

[eluser]ocergyNohtna[/eluser]
hmmmm....so i dug through DbDropDown for an hour before looking in Dropdown and noticed that at the end of getHTML i had this:
Code:
if($this->CI->uri->segment(2) == 'add') {
    return $html;
} else {
    return '';
}
was this suppose to be there? maybe i was just running on such little sleep recently i put it there by accident.




Theme © iAndrew 2016 - Forum software by © MyBB