Tuesday, 29 May 2018
  24 Replies
  11.1K Visits
0
Votes
Undo
  Subscribe
Hi Geraint,
We have already talk about this few months ago but this time it's quite urgent for us.
We need the possibility to add a text for the link created by the eldownload custom field.

For example : the file is very_important_file.pdf and we want the text for the link be very important file (PDF, 3Mo, 15 pages).

Do you think this could be achieve shortly (in few weeks ?)

Thanks for your work on this ;-)
Accepted Answer
After hours : the links are good now ^^
Accepted Answer
After hours : the links are good now ^^
Hi,
I have :

  • I have change the code and clear all the cache of the website.
  • Select files in a articles
  • Change one time : OK, 2 times : OK, three time : not OK the files are not the good one when I try to download.
Found the problem - the output of link is being cached in the web browser.

We should be able to eliminate this by a modification to the file

plugins/fields/eldownload/gwejson_downloadfile.php

by adding


header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

just before the

$byteswritten = readfile($file);

at the end of the file

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

Sorry Nicolas - I'm looking at it now.

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

Is there anybody here ? :(
We are in great trouble here ! My client want this functionnal now and we don't have any clue on where is the issue from. Of course we have try to clean every cache.
I transmit you the information. For your testing : change mulmitple times the files. We see the issue sometimes after one change sometimes after 2 or 3 changes. THe render is by custom code (cf post #15)
can you give me the login details so I can take a look?

p.s. sorry for the slow response

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

I come back After doing some tests : the issue looks liké a cache issue because thé information on thé database are good but thé link still give us old file. But I dont think it s a cache issue because when WE change thé other fields liké text they don t have any issues.
Where Can I look ? I précise again the fields issue install alone not with thé full easylayout pack
Thanks
Ok we use it with this code :

<?php if ((!empty($this->item->jcfields[11]->value)) && (!empty($this->item->jcfields[12]->value))) : ?>
<div class="lien"><a href="/<?php echo $this->item->jcfields[11]->value; ?>" title="download file"><?php echo $this->item->jcfields[12]->value; ?></a> </div>
<?php endif ; ?>

where id 11 is eldownload and id 12 a simple text field

But now we have a serious issue : when we change the file in the fields the results en frontend never change. The simple text change in front if we change it in backoffice. If it can help you, if we show the plain link instead of href, we get a link with the name of the changed/new selected file BUT the files downloded is still the old one. As if the token or whatever stick to the first file we select.
Try this version of the plugin - it has a new option when you edit the field in com_fields.

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

Hi ! Yes it's can do. We have do this with "hacking" the fields render (use without easylayout) and in the article override we combine your eldownload field and a field text for creating a nice link. The best is to havea text input and add this in the final rendering instead of the

$value = (string) $field->value;
I can add a config option to the eldownload field type so that it will output the href and not the <a> tag - but it would ALWAYS do that per field you define. Would that be ok?

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

Hi,
we you'd like "href" that points to the validated download.

Thanks
So you'd like the option to output the full <a> tag link to the download, the file name or the href that points to the validated download?

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

What I meant was.
In third choice, to be able to recover the whole url of the file.

See example url site (private) : button "fiche à télécharger"


example of the code that works:

$token = JSession::getFormToken();
$json = urlencode(json_encode(array('fieldid'=>$this->fieldreference->id,'article'=>$item->id)));
$downloadpath = JRoute::_("index.php?option=com_content&task=gwejson&file=downloadfile&path=plugin&folder=fields&plugin=eldownload&token=$token", false)."&json=$json";
$value=$downloadpath;
code changes works.

An improvement that would be useful:
you should have a third choice in the field "Display formatted value?" which will give the link of the value.

I'm not sure I understand what you mean. By link to you mean the full <a> tag??

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

code changes works.

An improvement that would be useful:
you should have a third choice in the field "Display formatted value?" which will give the link of the value.
I just realised that saving download field values when editing articles doesn't work in Joomla 3.8.10 without a different code change


So ? We can't use it unitlyou have correct this save bug ?, that's it ?
I'm sorry - there was a typo in the modified code :(

Edit the file administrator/components/com_easylayouts/output/common/custom_field.php and change lin 66 from

if (isset($field["rawcustomfieldoutput"]) && $field["rawcustomfieldoutput"] == 1 && isset($this->fieldreference->rawvalue))

to

if (isset($field["customfieldoutputraw"]) && $field["customfieldoutputraw"] == 1 && isset($this->fieldreference->rawvalue))


I'll need to do a new release of EasyLayouts in the next day or two - I just realised that saving download field values when editing articles doesn't work in Joomla 3.8.10 without a different code change

Review EasyLayouts. If you use EasyLayouts please post a rating and a review at the Joomla! Extensions Directory.
https://extensions.joomla.org/extension/easylayouts/

  • Page :
  • 1
  • 2
There are no replies made for this post yet.