[SOLVED] Something funny when pulling out elements from a database join...

chozma

Member
Hi all,

I have something unexpected going on and need some help figuring out why... o_O

I have a list called 'animal' which is joined to another list called 'mob-animal'. 'Mob-animal' has a database join element called 'mob' which stores the mob id (an integer) from another table called 'mob' as the value and the name (a string) as the label. This all works as it should.

However, in my animals details template I want to get the id number of the mob associated with the animal which I thought be should be easy enough. I'm accessing the elements like this:

Code:
$myMob = $this->groups['Animal- [app_mob_animal]'];
$mobElements = $myMob->elements;

But if I do a var_dump of $mobElements I can see that for the entry named 'mob' it doesn't let me get the id number (the value actually stored in the database), only the label. Excerpt of the var_dump relating to the mob element below.

Is this right? Shouldn't I be able to access the id number as this is the actual value being stored in the database and that's what I can see in phpmyadmin? How can I access the value stored in the database?

Thanks as always, I feel quite puzzled by this one!! :(

Code:
["mob"]=>
  object(stdClass)#932 (23) {
    ["startRow"]=>
    bool(true)
    ["endRow"]=>
    int(1)
    ["error"]=>
    string(0) ""
    ["plugin"]=>
    string(12) "databasejoin"
    ["hidden"]=>
    bool(false)
    ["id"]=>
    string(25) "app_mob_animal___mob_ro_0"
    ["className"]=>
    string(31) "fb_el_app_mob_animal___mob_ro_0"
    ["containerClass"]=>
    string(126) "fabrikElementContainer plg-databasejoin fb_el_app_mob_animal___mob_ro_0 fabrikRepeatGroup___app_mob_animal___mob mode-dropdown"
    ["element"]=>
    string(103) "Llama Dance Troop"
    ["label_raw"]=>
    string(3) "Mob"
    ["label"]=>
    string(85) "
Mob"
    ["errorTag"]=>
    string(40) "
"
    ["element_ro"]=>
    string(61) "Llama Dance Troop"
    ["value"]=>
    array(1) {
      [0]=>
      string(17) "Llama Dance Troop"
    }
    ["element_raw"]=>
    array(1) {
      [0]=>
      string(17) "Llama Dance Troop"
    }
    ["labels"]=>
    string(1) "0"
    ["dlabels"]=>
    string(1) "0"
    ["tipAbove"]=>
    string(0) ""
    ["tipBelow"]=>
    string(0) ""
    ["tipSide"]=>
    string(0) ""
    ["offset"]=>
    int(0)
    ["span"]=>
    string(7) " span12"
    ["column"]=>
    string(31) " style="clear:both;width:100%;""
  }
 
Thanks very much for looking at this Hugh! :)

I'm only getting white screens for both lists and details when using this code both front end and backend.

It could totally be to do with the way I am transferring the file across as I haven't got on to gitting all my work yet so I am just copying and pasting the file. :oops: I also just tried to copy and paste the parts you changed into my file as its just a few lines really and github makes it clear what's different. But no joy.

Any ideas?
 
Oh yes but I should say I think you are spot on with the repeat groups thing. If I turn off the repeating groups I can see the value, not just the label in var_dump.

Let me know if you think its me transferring the changes across wrong!
 
Yes, it's you copying changes. If that change was causing white screens on forms and lists, a lot of folk would be yelling about it.

I know it's a pain in the butt, but you should never "cherry pick" changes in github, unless you absolutely know what you are doing. Often changes we make in one file depend on changes made in other files, and not necessarily in the same commit. Always upload EVERYTHING. So just grab the whole ZIP from ...

https://github.com/Fabrik/fabrik/archive/joomla3.zip

... unzip it, and upload the whole enchilada over the top of your existing files.

That isn't the case here, but if it's white screening on you, you've messed something up. So upload a complete git, with your ftp client set to "always overwrite". It'll take a while, but worth it.

-- hugh
 
Thanks Hugh. I figured if it was a case of you or me doing something wrong, then it would have to be me! :oops:

Anyways, I've ftped the whole enchilada (as you so nicely put it) across and everything works fine. So thanks very much for doing the fix so quickly - really appreciate it! x
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top