from databasejoin field, thum image not showing up .. please help

boyoweb

New Member
hello

I have a list of clubs, and a list of teams.
a club can have many teams.
so in my list of teams, I have a databasejoin field to the clubs list.

In the club list, I have an upload field for the logo of the club, and only pictures can be uploaded ! ...

so when I view the list of teams

I wish to have each logo showing up for each team in the list of teams, next to the name of their clubs !!!

how do I achieve this ... is there some additional codes I need to put somewhere ???? .. please help !

basically, from the databasejoin field, I wish to list 2 information next to one another, the club logo & the club name ! - taken from the clubs list

thank you for any tips regarding this ....
 
The logo of each team ...is also the logo of their respective club !

2 lists / tables : - clubs
- teams

on the clubs list or form, when adding a club : a picture has to be uploaded or chosen ! ( it seems more difficult than initially thought !! .. I have to choose between uploading a pic and choosing a pic ! .. I really wish to provide both alternative ... to affect the same element ... ! )

But my biggest problem so far .. it is not that !

It is when I want to show the teams list, Obviously .. I need for each team ( or record ) to have a databasejoin field to a club using the clubs list id field !

Now .. with that clubs list record id, I wish to be able to show the club name with its thumb picture nicely wrap up, one on top of the other, in the same column ! .. the thumbs pictures are 40 by 40 px each ! .. and each club names has to be 12 letters maximum !

Can someone help me do that with fabrik .. please

thank you
 
I understand the frustration with choosing an existing file vs uploading a new one, that's something we've been wanting to do for quite some time - combine the 'image' and 'fileupload' elements into a single entity. But that's not as easy as it sounds.

I'm trying a couple of solutions to your main issue, of displaying the logo from the club on the team listing.

-- hugh
 
Thank you cheesegrits for the reply ....
This issue involves both fabrik version ( for joomla 2.5+ et 3.1+ )

I'll be using the smallest pic ... so the thumbnail ... offcourse

here is a screenshot of where I am hoping to find something to put in in order to have a pic shown
from a databasejoin field !
shot1.gif
 
Or possibly ... in the javascript section ( screenshot not privided ! ) .... is there or could there be somekind of lines of codes that I "Add+" in there ? so the logo image of the table joined record, be shown too ! ... I am sure that there is an easy way for this ! ... I was hoping to get a quick fix ...for it !
 
Unfortunately there isn't a quick fix.

I'm working on adding some functionality to the 'description' (under Advanced) which will allow you to do what you need.

-- hugh
 
cheesegrits ! - ... That would be an awesome feature to have out of the box in fabrik ! .. I am thinking that I am not the only one who will benefit from this
with having the possibility to really include an additional view record, like an image or else, from a databasejoin element by id, inside the same cell of a list or table view !
 
Yup, it's something we've wanted to do for a while, but it's "distinctly non trivial" to add. I spent some time looking at the code last night, and

I think in the short term, you're going to need to do this with a calc element, set to "Calc on save only" "Yes", which does something like:

PHP:
$result = '{teams___team_name}';
$club_id = (int) '{teams___club_id_raw}';
if (!empty($club_id)) {
    $db = FabrikWorker::getDbo();
    $query = $db->getQuery(true);
    $query->select('logo')->from('clubs')->where('id = $club_id');
    $logo_path = $db->loadResult($query);
    if (!empty($logo_path)) {
       $logo_path_info = pathinfo($logo_path);
       $logo_thumb_path = $logo_path_info['dirname'] . '/thumbs/' . $logo_path_info['basename'];
       $result .= '&nbsp;<img src="' . COM_FABRIK_LIVESITE . '/' . $logo_thumb_path . '" />';
    }
}
return $result;

Obviously you'll need to tweak the placeholder and field names to match your names, should be obvious what needs changing.

This should produce a string with your club name followed by an IMG with the club logo. Note that as it involves a table lookup, I've suggested setting it to "Calc on Save Only", so you aren't doing an extra query for every row in the list display. But this means you'll have to edit and save each team form one time, to get the calc element to run and save the data.

Then you should be able to use the calc element instead of your team name in the list.

-- hugh
 
PS ... that code assumes you are storing your thumbs in a folder called 'thumbs' inside the main folder you store the images in. If you use a suffix/prefix, and/or don't use a subfolder, you'll need to change the line that builds the $logo_thumb_path accordingly.

-- hugh
 
OK ! - chessegrits ... I understand every line and everything it does ... it basically grabs the image file and the path by doing a search in the related table and ... voila ! .. all right !

what suprises me though ... is the use of "calc" in the list of plug-in !!! ... so let me get this straight ! ..

1) to use the calc option instead of the databasejoin option in the list of plug-in* ! ( will use J 3 for this ! ) for my element .. ( in this case .. one of the teams, hometeam or awayteam )
NB. ( - I think I still will need to get a database join field anyways ... because I still need to get that id of the related team I need with its associated logo !! ?? .. )

2) ... I choose the "more tab" .. and include the code lines there !!! .. ? .. and I make sure to set blow
"Only calc on save" to " Yes" !! ??

let me try .. and I will get back to you ... you really suprised me here with that one ! ...
 
Hey ... Hugh ... it does not work ! .. I got nothing showing up ! ...
in the code example above .. on the line :
Code:
$query->select('logo')->from('clubs')->where('id = $club_id');

'logo' is actually the label of the element in the table labeled 'clubs'

and 'basename' & 'dirname' are also element label names ....

It does not work ... sorry ...

is there something missing ??? ...
 
try this - the $club_id shouldnt have been inside the single quotes
Code:
$query->select('logo')->from('clubs')->where('id = ' . $club_id);
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top