• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

SOLVED: Using content plugin to display filtered values

Status
Not open for further replies.

puzzled

Member
Hi - I am back again with my facilities icons with tooltip issue - the other thread went off on a tangent and so I am re-posting with a simpler question about the content plugin:

How do you write...

display element1 from list87 where the rowid is the same as element2 that is already being displayed using a databasejoin field

I know how to display an element
{fabrik view=element list=87 rowid=1 element=tablename___element1 }
but not how to filter it to get it to do what I want.

I am wanting to use this where you mouse over the data from element2 and get the text from corresponding element1 in the tooltip

The other option is that the tooltip is meant to allow a php expression but I can't write php code so that's me stumped straight off.

Any help would be most appreciated.


------------------------------
Previous thread: http://fabrikar.com/forums/index.ph...w-relevant-values-from-another-element.38244/
 
I would do it with php (no idea if/how the content plugin is doing inside a tooltip).
It's not so hard, see http://www.fabrikar.com/forums/index.php?wiki/common-php-tasks/
so something like
Code:
$element2 ='{table___element2_raw}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
 
$query
    ->select('element1')
    ->from('table-belongingToList87')
    ->where('id = ' . $db->quote($element2));
 
$db->setQuery($query);
$fieldA = $db->loadResult();
return 'some text '.$fieldA;
 
Thanks Troester - Your a star :)

I need to be able to show the data from element1 in the tool tip. The code you kindly wrote out for me just displays whatever I put in the 'some text' bit. I tried a few things to see if I could get it to show the data from element1 but it did not like anything I tried.

NB: both element1 and element2 are in the same table

Can you assist a little further please?
Thanks in advance
 
Hi Troester

I have uploaded a screen shot so you can see what I have put in the Tool Tip : )

I am desperate to get this sorted now and am just going round in circles - I know you said it's "not so hard" but I just can't see what I am doing wrong - the code I am trying to use does not give any result.

If you can take a quick look I would very much appreciate it.

Thanks
 

Attachments

  • Untitled-1.jpg
    Untitled-1.jpg
    387.1 KB · Views: 302
Hi Hugh - Yes I have tried that but it does not want to work for me - see screen shots attached.
I am trying to do this on a database join field.
Anything else you can suggest?
 

Attachments

  • Untitled-1.jpg
    Untitled-1.jpg
    48.3 KB · Views: 286
  • Untitled-2.jpg
    Untitled-2.jpg
    46.2 KB · Views: 297
  • Untitled-3.jpg
    Untitled-3.jpg
    86.4 KB · Views: 276
Is "facilitiesnew___Name" an element in your form or is it from an other list? (It's always better to use the real table/element names in your posts).
Which fabrik version are you running?
On my Fabrik3.0 (+ latest GitHub) site placeholders in list view are working, but a placeholder can only be an element of your current form.

In you php code it has at least to be
$db->quote($hotelfacilities) (without .id)

Edit:
Looking at your code I don't see what you want to achieve. Element "hotelfacilities" is a dbjoin pointing to the same table "facilitiesnew"??? (your code is selecing ...Name... WHERE facilitiesnew.id = facilitiesnew.hotelfacilities_raw)
 
Hi, Thanks for your reply - facilitiesnew___Name is the "full element name" see 2.jpg screen shot from my previous post. So facilitiesnew is the table name and Name is the element name.

Let me clarify what I am trying to achieve etc...

In my "Hotels" list I have a databasejoin element called "facilitiesjoin" - this points to a separate list called "facilitiesnew" - within here is a field called "hotelfacilities" which is the icon that I want to display along with a field called "Name" which is text that I want in the tool tip when I hover over the icon.

I have tried various ways round of what to put in the tool tip on my "facilitiesjoin" field but I think that being a databasejoin is causing it not to work like you said
a placeholder can only be an element of your current form
which is why I was then looking at using php to do it.

NB: When I try anything on the tool tips in the "facilitiesnew" list it does not carry through to my "Hotels" list so gets ignored.

Thanks - I hope that clarifies things. I appreciate your help.
 
So you can't use a placeholder {facilitiesnews___hotelfacilities_raw} (if I got it right facilitiesnews___hotelfacilities is not an element in your "Hotels" list) but it should be something like
$hotelfacilities = '{hotels___facilitiesjoin_raw}';
 
Hi - I tried that but unfortunately I still only get "My test" in the tool tip for each "hotelfacilities" icon where I want it to show facilitiesnew___Name so it seems not to be able to return a value.

Here is my code:
Code:
$hotelfacilites ='{Hoteltable___facilitiesjoin_raw}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
 
$query
    ->select('Name')
    ->from('facilitiesnew')
    ->where('id = ' . $db->quote($hotelfacilites));
 
$db->setQuery($query);
$Name = $db->loadResult();
return 'My test' . $Name;

Thanks
 
Looking at your site I don't think your element name is Hoteltable___facilitiesjoin, it's looking like
baby72_com_property_details2_repeat_facilitiesjoin___facilitiesjoin
Is this a multi select dbjoin element? I really don't know how to handle this.
And what is with your other thread?
http://fabrikar.com/forums/index.ph...w-relevant-values-from-another-element.38244/
It seems this is discussing the same problem and you've got several solutions from Hugh and Rob.
 
Hi - Yes it is the same problem - ie trying to get a tool tip to show on my facilities icons. :)

The solutions from Hugh and Rob did not work and I was getting no further help going down that route... so as mentioned in the very first line of this thread I tried to simplify the question and just concentrate on the tool tip area rather than the other route we were trying (the concat field, which although it worked it chopped the list off short).

The facilitiesjoin element is rendering in the form as a checkbox multi select - see my screenshot in my previous post Saturday at 8:26 PM

I am guessing that I am asking to much to get a tool tip on a mutli select/databasejoin field?? maybe it just can't be done??

If you think that is the case then can you look at my other option as to why the Or Concat Label field is chopping data off at around 950 characters?

Any further queries just let me know - I will respond asap.

Thanks
 
Hi - I have had someone else look at this and they came up with the following suggestion:

Pass the id to the image in the repeater (Concat Label), and create a javascript object of the facilities table out side this repeater - on mouse over reference the javascript object to get the name of the facilitiy with that id.

I don't have any Javascript knowledge. Do you think that it is possible to do this as a work around? I am desperate to get something that works!!

Thanks
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top