I try create social buttom for russian social net on picture.tpl page.
Can I somehow get the address of current image thumbnail?
Offline
for piwigo 2.3 or piwigo 2.4
Offline
ddtddt wrote:
for piwigo 2.3 or piwigo 2.4
And 2.3 and 2.4 :) .
Now I working with 2.3.4
Offline
For 2.3
$picture['current']['thumbnail']
Offline
Offline
Can I do it with SMARTY?
Last edited by EvilKant (2012-06-03 19:38:27)
Offline
Arrgg... I hate SMARTY.
I found current image thumbnail adress - {$current.thumbnail}. But now I need bind java sript function and SMARTY variables...
{footer_script}{literal}
function vkButton(rootURL, imageSRC)
{
VK.Share.button({
url: document.location.href,
title: 'Picture Munchkin',
description: 'Супергероини в трико и без',
image: rootURL+imageSRC
});
}{/literal}
{/footer_script}
<a href="" onclick="vkButton({$ROOT_URL}, {$current.thumbnail})">vkButton</a>
Now I try that, but it didn't work and I don't know why.
In instruction for VK.Share.button written:
<script type="text/javascript">
<!--
document.write(VK.Share.button({
url: 'http://mysite.com',
title: 'Хороший сайт',
description: 'Это мой собственный сайт, я его очень долго делал',
image: 'http://mysite.com/mypic.jpg',
noparse: true
}));
-->
</script>
But SMARTY will not let me use it, because I can't transfer the data from SMARTY in java script.
PS it's just me whining
Offline
it should works, how looks the generated html ?
Offline
mistic100 wrote:
it should works, how looks the generated html ?
in picture.tpl:
<script type="text/javascript">
{lang: 'ru'}
</script>
<a onclick="vkButton(, ./galleries/renato-camilo/thumbnail/TN-04_10_11_RC_BlackCat.jpg)" href="">vkButton</a>
in footer.tpl:
<script src="local/combined/vsdqw9.js" type="text/javascript">
/*BEGIN themes/default/js/ui/minified/jquery.ui.01.min.js */
;
/*BEGIN themes/default/js/ui/minified/jquery.ui.02.min.js */
;
jquery.ui.01.min.js is fading effect, and it is working.
Offline
I think the VK button wants an absolute URL,
I will have to add some PHP to assign the root url
$template->assign('ABSOLUTE_ROOT_URL', get_absolute_root_url());
actually you can try this directly in the template, but not sure it will work
{php} global $template; $template->assign('ABSOLUTE_ROOT_URL', get_absolute_root_url()); {/php}
Last edited by mistic100 (2012-06-04 19:19:16)
Offline
hum the PHP tag is removed in Smarty3 so it will be too in Piwigo2.5 : it's better to assign from php
Offline
I think somthing wrong in smarty construction {footer_script require='jquery.ui.01'} {/footer_script}
Because if I do without it, all is working, but without link on picture.
Offline
How corect transfer in SMARTY that line:
<script type="text/javascript" src="http://vkontakte.ru/js/api/share.js?9" charset="windows-1251"></script>
Maybe error is here?
Offline
{combine_script id="vk_share" path="http://vkontakte.ru/js/api/share.js"}
Offline
Hrrr... You need smiles here :)
{combine_script id="vk_share" load='async' path="http://vkontakte.ru/js/api/share.js"}
{footer_script}{literal}
function vkButton(rootURL, imageSRC)
{
document.write(VK.Share.button({
url: document.location.href,
title: 'Picture Munchkin',
description: 'Супергероини в трико и без',
image: rootURL+imageSRC
}));
}
{/literal}
{/footer_script}
<body id="{$BODY_ID}" onLoad="vkButton('{$ROOT_URL}', '{$current.thumbnail}')">
it works! But the button appears in a new window :( . Now trying to replace "document.write" on jQuery... No result yet.
Offline