2013-02-08 76 views
0

我使用Joomla 1.5 AllVideoShare(版本1.2.4)扩展名。Joomla 1.5。如何在视频/图像上添加“喜欢/不喜欢”按钮?

问题PART 1

我要问你如何使像视频大拇指/图片按钮?例如,如果用户喜欢视频剪辑或图像,他可以点击按钮,并计算有多少用户喜欢它。如果可能,它可以像按钮或Facebook按钮一样简单。也或许可能使喜欢/不喜欢按钮(如果用户不喜欢这个视频/图像,他可以不喜欢它)

例子,我要放置: http://img689.imageshack.us/img689/268/likecp.png

这是我的代码,其中部分影片要发布:

<?php if ($this->params->get('show_'.$header, 1)) : ?> 
    <h2> <?php echo $this->escape($this->params->get($header)); ?> </h2> 
<?php endif; ?> 
<div id="avs_gallery2<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>"> 
    <?php 
    if(!count($videos)) echo JText::_('ITEM_NOT_FOUND'); 
    for ($i=0, $n=count($videos); $i < $n; $i++) { 
     $clear = ''; 
     if($column >= $this->cols) { 
      $clear = '<div style="clear:both;"></div>'; 
      $column = 0; 
      $row++;  
     } 
     $column++; 
     echo $clear; 
    ?> 

    <span class="name"><?php echo $categories[$i]->name; ?></span> 
    <div id="testas" class="avs_thumb" style="width:190px;" onclick='javascript:location.href="<?php echo JRoute::_($link.$videos[$i]->slug.$qs); ?>"'> 
    <img class="arrow" src="<?php echo JURI::root(); ?>components/com_allvideoshare/assets/play.gif" border="0" style="margin-left:80px; margin-top:47px;" /> 
    <img class="image" src="<?php echo $videos[$i]->thumb; ?>" width="190; " height="120;" title="<?php echo JText::_('CLICK_TO_VIEW') . ' : ' . $videos[$i]->title; ?>" border="0" /> 
    <span class="title"><FONT COLOR="#000000"><?php echo $videos[$i]->title; ?></font></span> 
    <span class="views"><FONT COLOR="#000000"><?php echo JText::_('Peržiūros'); ?> : <strong><?php echo $videos[$i]->views*2+1; ?></strong></font></span> 
     <div class="avs_category_label"><?php echo JText::_('Kategorija'); ?> : <strong><?php echo $videos[$i]->category; ?></strong></div> 


    </div> 

    <?php } ?> 

问题PART 2

后,我添加喜欢/不喜欢按钮,将有可能通过“最受欢迎”(这VID对它们进行排序eo最喜欢)还是有这么辛苦的工作?

例子:http://www.anekdotai.lt/

问题PART 3

在如喜欢/不喜欢按钮,我希望把Facebook分享按钮一样的地方。我有脚本可以工作,但是我无法将它成功添加到这个地方。

FB分享脚本:

<?php 
defined('_JEXEC') or die('Restricted access'); 
$linkTxt = $params->get('linkTxt', ''); 
$linkColor = $params->get('linkColor', ''); 
$linkHColor = $params->get('linkHColor', ''); 
$theUrl = $params->get('theUrl', '1'); 
$wholeUrl = "location.href.substring(0,location.href.lastIndexOf('/'))"; 
$currentUrl = "location.href"; 
?> 

<script>function fbs_click() {u=<?php if($params->get('theUrl', 1)) 
     { 
     echo $currentUrl; 
     } 
     else{ 
     echo $wholeUrl; 
     } ?>;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><style> html .fb_share_button { display: -moz-inline-block; display:inline-block; padding:1px 1px 1px 20px; height:17px; color:#<?php echo $linkColor ?>; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat left; } html .fb_share_button:hover { color:#<?php echo $linkHColor ?>; background:url(http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981) no-repeat left; text-decoration:none; } </style> <a rel="nofollow" href="http://www.facebook.com/share.php?u=<url>" class="fb_share_button" onclick="return fbs_click()" target="_blank" style="text-decoration:none;"><?php echo $linkTxt; ?></a> 

如果我把它放到视频发布代码,我得到错误: Fatal error: Call to a member function get() on a non-object in ..../juokoera.lt/public_html/components/com_allvideoshare/views/videos/tmpl/default.php on line 26

感谢您的答案。

+0

你有什么版本AllVideoShare的? – Lodder

+0

1.2.4 AllVideoShare的版本 –

+0

你有什么想法吗? –

回答

0

尝试添加以下代码将定义到$ params变量:

$params = JComponentHelper::getParams('com_yourcomponent');