Welcome Guest, Not a member yet? Register   Sign In
Javascript calling smarty
#1

[eluser]Unknown[/eluser]
Hi, i'm doing some modification on script using smarty 2 ,
i have 2 question
1-javascript loading partial tpl file
2-javascript calling a variable from tpl file




/ i have page detail.tpl that use ( header.tpl , player.tpl, footer.tpl )

normaly he was inclued on other tpl like this

Code:
{include file="player.tpl" page="detail"}

but i want to call "player.tpl" in a javascript when i click he replace picture by player the code working expet that the player dont want to apear


Code:
playVideo : function(id, videoPageUrl)
{
        var vplayer = document.getElementById('vplayer');
        vplayer[removed] = 'video/player.tpl';
..........

what did i must write in the "file.js" to let it call the player.tpl when i exute the function ?
did i must add some ligne ? or changinng the path ?
#2

[eluser]Unknown[/eluser]
2nd question: is calling variable on tpl to be used on javascript function

when i put the function on the .tpl ( internal script) it work but on javascript external i do'nt have idea the variable shall be the same as in the tpl or in the php file

for example
Code:
{literal} [removed]

  function autoPostToFeed(url) {
  'post',
  {
   video : "{/literal}{$video_link}{literal}"
  }
}
[removed] {/literal}

the external js using this (internal scxript) is working

but when i want to add it to the same js !!!
i do'nt know how to call the variable used on the details.tpl this varible{$video_link}
Code:
function autoPostToFeed(url) {
  'post',
  {
   video : "{$video_link}"
  }
}

---------------------------------------------------------
same thing for another varible
on tpl
Code:
{$facebook_image_src }

on php
Code:
$facebook_image_src = show_thumb($video['uniq_id']);
.......
$smarty->assign('facebook_image_src', $facebook_image_src);

on external js i testest many but still not working ?
Code:
var poster = ''




Theme © iAndrew 2016 - Forum software by © MyBB