• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

I try to do this text to speech in my site.


i want this text to speech when i click on play(custom1) button in nanogallery2.

this code of nanogallery with pug (home.pug)

script(type='text/javascript'src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js') link(href='https://unpkg.com/nanogallery2/dist/css/nanogallery2.min.css' rel='stylesheet' type='text/css') script(type='text/javascript' src='https://unpkg.com/nanogallery2/dist/jquery.nanogallery2.min.js')  #my_nanogallery2(data-nanogallery2= {     "items": categ,     "itemsBaseURL": "/users/",     "locationHash": false,     "thumbnailWidth": "250",     "thumbnailHeight": "250",     "thumbnailBorderVertical": 4,     "thumbnailBorderHorizontal": 4,     "colorScheme":     {         "thumbnail":         {             "background": 'rgba(97, 152, 253, 1)',             "thumbnailIcon" : { "color": '#FFF'}         }     },     "thumbnailLabel":     {         "position": "onBottom",         "titleFontSize": '1.5em'     },     "thumbnailAlignment": "center",     "thumbnailDisplayTransitionDuration": 0,     "thumbnailDisplayInterval": 3,     "thumbnailHoverEffect2": null,     "thumbnailToolbarImage":      { topLeft: 'custom1'},     "thumbnailToolbarAlbum":      { topLeft: 'custom1'},     "icons":                      { thumbnailCustomTool1 : ''},     "fnThumbnailToolCustAction":  SoundCustom,     "thumbnailOpenImage": false }) 

This options add to my nanogallery a button, when i click the button the "soundcustom" function should work.

"thumbnailToolbarImage":      { topLeft: 'custom1'}, "thumbnailToolbarAlbum":      { topLeft: 'custom1'}, "icons":                      { thumbnailCustomTool1 : ''}, "fnThumbnailToolCustAction":  SoundCustom, 

this is the function "soundcustom" in home.js

 function SoundCustom(item){     console.log(item.title);     var text;     text = encodeURIComponent(item.title);     console.log(text);     var url = "http://translate.google.com/translate_tts?tl=en&q=" + text + "&client=tw-ob";     $('audio').attr('src', url).get(0).play(); } 

I'm trying to put console logs to see if I get the value. But it turns out I get nothing.

Of course there is no response to pressing the button either.

In addition, when I try to add the script they give in the video it destroys the nanogallery.

I don't know if it's related.

Thank you

Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]