[SOLVED] Using file type field to display a pdf file

More
9 years 6 months ago - 9 years 6 months ago #54650 by rottenberg
Hello
My problem is the following :
I need to display a pdf file as a popup in my page. The Pdf popup allow to download the file.

As the file type allows the upload inside the site, I have chosen to use the download type and not the weblink type. (With weblink the user who creates the article needs to know the url of the file. With pdf type he doesn't need to know pdf url.

I have given the name pdf to the download file field.

I have created a field which copies the pdf field. In the new field I have put in 'open text for field' : {{pdf##0##}

When displaying the the field I only get a number (maybe the id of the pdf file).

My question : How can I get the name of the pdf file I want to display in the popup.

If I cannot get it : how can I upload a pdf file inside the site and how can I get the url of the file to display it in a popup ?

thank you for advices

best regards

Michel
Last edit: 9 years 6 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago - 9 years 6 months ago #54659 by ggppdk
Hello

if the fieldname of you file field is: 'myfile', then try:
Code:
print_r($item->fields['fieldname']->filedata); // e.g. size, absolute paths, etc print_r($item->fields['fieldname']->url]); print_r($item->fields['fieldname']->abspath]);

The above are mention here:
www.flexicontent.org/documentation/faq/6...to-work-in-v156.html


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 9 years 6 months ago by ggppdk.
The following user(s) said Thank You: rottenberg

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #54715 by rottenberg
thank you very much
I try it.

best regards

Michel

Please Log in or Create an account to join the conversation.

More
5 years 11 months ago #75375 by iamrobert
Hi,

I can't get this to work - I'm looking to extract the altname + filename - but they fail. Also filedata fails.
Code:
$html =FlexicontentFields::getFieldDisplay($item, 'file-download', null, 'display', 'item'); //print_r($item->fields['file-download']); // AFTER CALLING getFieldDisplay(), you can also use these arrays print_r($item->fields['file-download']->filedata); // fails print_r($item->fields['file-download']->altname); // fails print_r($item->fields['file-download']->filename); //fails print_r($item->fields['file-download']->url); // ok print_r($item->fields['file-download']->abspath); // ok



Any ideas.?

Please Log in or Create an account to join the conversation.

More
5 years 11 months ago #75379 by ggppdk
Since we implemented field-groups and layout support these are made available via layout

Here is current layout file:
plugins/flexicontent_fields/file/tmpl/value_InlineBoxes.php
Code:
use Joomla\String\StringHelper; $isAdmin = JFactory::getApplication()->isAdmin(); // Important create a -1 "value", before any other normal values, so that it is at 1st position of the array $field->{$prop}[-1] = ''; $field->url = array(); $field->abspath = array(); $field->file_data = array(); $field->hits_total = 0; $n = 0; $i = 0; foreach($values as $file_id) {

so you would use the following

$field->url = array();
$field->abspath = array();
$field->file_data = array();
$field->hits_total = 0;


in your case you need:
$field->file_data
which is indexed by the value position
$field->file_data[1] is an array of the data of value 1
$field->file_data[3] is an array of the data of value 3


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.486 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline