Yii Framework Forum: Jquery Register Problem In Widget - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Jquery Register Problem In Widget Rate Topic: -----

#1 User is offline   minitia 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 19-December 12

Posted 19 December 2012 - 10:28 AM

Hi all,
I'd like to apply a jquery plugin in a list of news.
I created my widget to include this box in some page of mysite.

The problem is that in the page rendered, in the source code seems that the js file and script is loaded correctly but the plugin doesn't work...

<script src="/juvebook/js/jquery.totemticker.min.js" type="text/javascript">

and the script too:
<script type="text/javascript">

This is the view file of my widget:

Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/jquery.totemticker.min.js', CClientScript::POS_HEAD); 
$js = "
Yii::app()->clientScript->registerScript('totemSlideNews', $js, CClientScript::POS_HEAD);
<ul id="vertical-ticker">
foreach($news as $currentNews)
{ ?>
    <li class="feednews">
        <div style="float:left; width:30%;">
            <p><?php echo $currentNews['datePubb']; ?></p>
            <p><?php echo $currentNews['header']; ?></p>
            <?php echo $currentNews['title']; ?>
<?php } ?>

So, the question is, can i include the js used only by a widget directly in his view file?
If yes why firebug, when i try to run by console the script say "$("#vertical-ticker").totemticker is not a function", like if the library didn't loaded?

Thank you



Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users