Piwigo.org

You are not logged in. (Register / Login)

Announcement

Post a reply

Write your message and submit

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

flop25
2013-02-13 19:00:24

wait
you want to add code which would use the already predfined tpl var on picture.tpl? Well jsut make a prefilter and add your code See what's going on http://piwigo.org/dev/browser/extension … nc.php#L48

EvilKant
2013-02-13 16:24:23

flop25 wrote:

So again what are you trying to do!?

Do you mean what my plugin will do? It will create vk.com "like" button with title, description and thumbnail of current picture. Like facebook "like" button.

flop25 wrote:

Here the {$current.THUMB_SRC} is defined ONLY for picture.tpl

Understand. I was hoped this time I will do without request from the database :(

flop25
2013-02-13 16:15:59

You don't get the way of working of Smarty : you write tpl code then you need to assign (declare how your tpl code will be replaced) and finally parse the tpl file (Smarty reads the tpl and replaces the var)
Here the {$current.THUMB_SRC} is defined ONLY for picture.tpl
So again what are you trying to do!?

EvilKant
2013-02-13 16:09:41

Code:

{combine_script id="vk_share" load='footer' path="http://vk.com/js/api/share.js" charset="windows-1251"}
{footer_script} 
  $('<div class="vkpBut"></div>').appendTo($('.imageInfoTable'));
  $('.vkpBut').html(VK.Share.button({ldelim}
    url: document.location.href,
    title: '{$vk_title}',
    description: '{$vk_desc}',
    image: '{$current.THUMB_SRC}',
    noparse: true
    }));
{/footer_script}

If I write it somewhere in piwigo\themes\Temp1\template\picture.tpl all is working and {$current.THUMB_SRC} contain link to thumbnail of current picture. But if I write it in template of plugin, {$current.THUMB_SRC} is empty.

flop25
2013-02-13 15:45:30

?

EvilKant wrote:

But in template of plugin {$current.THUMB_SRC} is empty.

so you need to assign youself...
I really don't understand because you don't understand the system, so let's start by explaining us what's your code etc

EvilKant
2013-02-13 15:42:53

flop25 wrote:

Hi
you should read the How To http://piwigo.org/doc/doku.php?id=dev:changes_in_2.4
and also take a look at core/plugin files
as I don't know more that's only what I can say

That don't help. I know what thumbnail included in {$current.THUMB_SRC}, I can use it in my theme. But in template of plugin {$current.THUMB_SRC} is empty.

flop25
2013-02-13 14:08:19

Hi
you should read the How To http://piwigo.org/doc/doku.php?id=dev:changes_in_2.4
and also take a look at core/plugin files
as I don't know more that's only what I can say

EvilKant
2013-02-13 14:04:11

Now I try create plugin for automatically create a button. But I can't get thumbnail link again. {$current.THUMB_SRC} not available from plugin. Can you advise something how to get current trumbnail link not from template? I think I need something from SMARTY, but I don't know where I must search it.

EvilKant
2012-06-07 12:04:45

I did it! I will write instructions on russian forum.

EvilKant
2012-06-04 23:04:17

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.

mistic100
2012-06-04 20:23:48

{combine_script id="vk_share" path="http://vkontakte.ru/js/api/share.js"}

EvilKant
2012-06-04 20:21:11

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?

EvilKant
2012-06-04 19:30:15

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.

flop25
2012-06-04 19:20:31

hum the PHP tag is removed in Smarty3 so it will be too in Piwigo2.5 : it's better to assign from php

mistic100
2012-06-04 19:18:54

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

Code:

{php}
  global $template;
  $template->assign('ABSOLUTE_ROOT_URL', get_absolute_root_url());
{/php}

Board footer

Powered by FluxBB

About this website · Donate · Contact Piwigo project © 2002-2013