Hi all
I'm currently using LevGal 1.2.0 provided by Arantor
https://www.simplemachines.org/community/index.php?msg=4130283
and I want to be able to get the bbc code for all the images in one album. I did this previously with Aeva has you can see bellow
Aeva_Example.png
and now with LevGal I already did most of it, but I'm still not happy with the result
LevGal_Example.png
I basically used the code from the individual image and add it to the album code with an array to get all the pictures
LevGal_Example2.png
So the 2 problems that I'm currently having are:
1. although I put the break code between images I get a single line with all the items
I get this
[media]15420[/media][media]15419[/media][media]15418[/media][media]15417[/media]
instead of this
[media]15420[/media]
[media]15419[/media]
[media]15418[/media]
[media]15417[/media]
This is the line of code where you have "\r\n", also tested with "\n" and even "<br>"
<input type="text" class="input_text" id="lgal_share_simple_bbc" value="'; foreach ($i as $value) echo '[media]' . $value['id_item'] . '[/media]' . "\r\n"; echo'" readonly="readonly" />
This is the original code for a single image
<input type="text" class="input_text" id="lgal_share_page" value="', $context['item_details']['item_url'], '" readonly="readonly" />
2. I cant get the posted time of the pictures like if I see the code for a single image
On a single image I get this (from posted on I get it in Portuguese, my native language and also the forum default language)
[media id=15420 type=preview]20221213_081724 by SMAP posted 10 de Abr de 2025, 12:33[/media]
With several Images I get this (form posted in English with the timezone)
[media id=15420Array type=preview]20221213_081724 by SMAP posted 10th April 2025, 11:33 (WEST)[/media][media id=15419Array type=preview]20221213_081722 by SMAP posted 10th April 2025, 11:33 (WEST)[/media]
This is the code that I put in place
<input type="text" class="input_text" id="lgal_share_complex_bbc_preview" value="'; foreach ($i as $value) echo sprintf($txt['lgal_share_complex_bbc_preview_entry'], $value['id_item'], $value['item_name'], $value['poster_name'], date('jS F Y, H:i (T)',$value['time_added'])), "\n"; echo'" readonly="readonly" />
This is the original code for a single image
<input type="text" class="input_text" id="lgal_share_complex_bbc_preview" value="', sprintf($txt['lgal_share_complex_bbc_preview_entry'], $context['item_details']['id_item'], $context['item_details']['item_name'], $poster_name, $context['item_details']['time_added_format']), '" readonly="readonly" />
I'm attaching the original files (LevGal-Album.template.php and LevGal-Item.template.php) that are on directory /var/www/html/forum/Themes/default/levgal_tpl on the file
Original_LevGal-Item.template_and_LevGal-Item.template.zip
And the modified file (LevGal-Album.template.php) on the file
Modified-LevGal-Album.template.zip
Basically on the file that I modified LevGal-Album.template.php I added the modified functions
function template_sidebar_share()
function template_main_item_view()
and them put it at the end of the sidebar (after the sorting)
// Sharing items
template_main_item_view();
Little change, which makes me realize that "\n" (new line) not working at all
so from this
<input type="text" class="input_text" id="lgal_share_simple_bbc" value="'; foreach ($i as $value) echo '[media]' . $value['id_item'] . '[/media]' . "\r\n"; echo'" readonly="readonly" />
to this
<input type="text" class="input_text" id="lgal_share_simple_bbc" value="'; foreach ($i as $value) echo '[media]', $value['id_item'], '[/media]'; echo'" readonly="readonly" />
and from this
<input type="text" class="input_text" id="lgal_share_complex_bbc_preview" value="'; foreach ($i as $value) echo sprintf($txt['lgal_share_complex_bbc_preview_entry'], $value['id_item'], $value['item_name'], $value['poster_name'], date('jS F Y, H:i (T)',$value['time_added'])), "\n"; echo'" readonly="readonly" />
to this
<input type="text" class="input_text" id="lgal_share_complex_bbc_preview" value="'; foreach ($i as $value) echo sprintf($txt['lgal_share_complex_bbc_preview_entry'], $value['id_item'], $value['item_name'], $value['poster_name'], date('jS F Y, H:i (T)',$value['time_added'])); echo'" readonly="readonly" />
Maybe it's a problem with the type=text on the input, that doesn't allow more than one line
would a textarea work?
Quote from: live627 on April 14, 2025, 05:32:14 AMwould a textarea work?
Yes, textarea works. Thanks.
https://w3c.github.io/html-reference/input.text.html#input.text.attrs.value
value = string without line breaks
Specifies a value for this input element.
Any string that contains no line feed (U+000A, "LF") or carriage return (U+000D, "CR") charactersSo from this
<dd id="lgal_share_simple_bbc_container" class="lgal_share">
<input type="text" class="input_text" id="lgal_share_simple_bbc" value="'; foreach ($i as $value) echo '[media]', $value['id_item'], '[/media]'; echo'" readonly="readonly" />
<span class="lgalicon copy" title="', $txt['lgal_copy_to_clipboard'], '"></span>
</dd>
to this
<dd id="lgal_share_simple_bbc_container" class="lgal_share">
<div class="input_text" style="margin: 0 -4px 2px -4px; padding: 7px 0 5px 8px" align="left" >
<textarea type="text" class="input_text" rows="2" cols="15" id="lgal_share_simple_bbc" readonly="readonly" />';
foreach ($i as $value) echo '[media]', $value['id_item'], '[/media]', "\n"; echo'
</textarea>
</div>
<span class="lgalicon copy" title="', $txt['lgal_copy_to_clipboard'], '"></span>
</dd>
It will work, but I can't control the size of the boxes :-\
LevGal_Example3.png