我有问题使用本机音频cordova插件与离子.我使用npm安装了native
sudo npm install --save @ionic-native/native-audio
Run Code Online (Sandbox Code Playgroud)
并添加了一个名为smartAudio的新提供程序(下面附带代码).它在离子网络视图和iOS模拟器/真实设备上都像魅力一样......但由于某些原因,Android模拟器/真实设备上根本没有声音.
我有一个离子幻灯片元素,使用*ngFor生成图像幻灯片,像这样 -
<ion-slides (ionSlideDidChange)="muteAnimalSound()" pager dir="rtl" [loop]="true" >
<ion-slide *ngFor="let slide of animals_slides; let i = index" style="background-color: white">
<img src="{{slide.img_url}}" (click)="playAnimalSound($event)">
</ion-slide>
</ion-slides>
Run Code Online (Sandbox Code Playgroud)
playAnimalSound()函数看起来像这样 -
playAnimalSound(ev) {
let animalSound = this.getAnimalBySource(ev.target.src);
let currentIndex = this.slides.getActiveIndex();
this.smartAudio.preload(currentIndex, animalSound[0].sound_url);
this.smartAudio.play(currentIndex);
}
Run Code Online (Sandbox Code Playgroud)
我的smartAudio提供程序是这样定义的 -
export class SmartAudio {
audioType: string = 'html5';
sounds: any = [];
constructor(public nativeAudio: NativeAudio, platform: Platform) {
if(platform.is('cordova')){
this.audioType = 'native';
}
//testing atlassian sourcetree
}
preload(key, asset) {
if(this.audioType …Run Code Online (Sandbox Code Playgroud) 我在WordPress中有一个依赖于外部数据库的自定义页面模板,它正在使用wpdb类来实现此目的.
这是我的代码:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php
class StudentsDatabase
{
private $db;
public function __construct() {
try {
$this->db = new wpdb(DB_USER, DB_PASSWORD, 'students_db', DB_HOST);
$this->db->show_errors();
} catch (Exception $e) {
echo $e->getMessage();
}
}
public function getStudentById($student_id)
{
return $this->db->get_results("SELECT * FROM `students` WHERE id=$student_id");
}
public function getSchoolByAreaCode($area_code)
{
return $this->db->get_results("SELECT * FROM `schools` WHERE area_code=$area_code;--");
}
}
$Students_DB = new StudentsDatabase();
$student_one …Run Code Online (Sandbox Code Playgroud) 这里有没有人在背包的碎片中创建了一个嵌套的下拉菜单?我有这个crud控制器来处理'Campaign'模型 -
$this->crud->addField([
'name' => 'industry_id',
'entity' => 'industry',
'type' => 'select2',
'attribute' => 'name',
'label' => "Industry",
]);
$this->crud->addField([
'name' => 'country_id',
'entity' => 'country',
'type' => 'select2',
'attribute' => 'country_name',
'label' => "Country",
]);
$this->crud->addField([
'name' => 'website_id',
'entity' => 'website',
'type' => 'select2',
'attribute' => 'name',
'label' => "Website",
]);
$this->crud->addField([
'name' => 'campaign_type_id',
'entity' => 'campaign_type',
'type' => 'select2',
'attribute' => 'name',
'label' => "Campaign Type",
]);
$this->crud->addField([
'name' => 'site_page_id',
'entity' => 'site_page',
'type' => …Run Code Online (Sandbox Code Playgroud) 我有一个全新的wordpress安装,我在我的functions.php中写了一些快速重写规则,看起来像这样 -
// "rewrite" /assets/xyz to /assets/?asset=xyz
function assets_rewrite_rule($rules) {
global $wp_rewrite;
$asset_rule = array( // (not tested)
'assets/(.+)/?' => 'index.php?pagename=Assets&asset=$matches[1]'
);
return array_merge($asset_rule, $rules);
}
add_filter('page_rewrite_rules', 'assets_rewrite_rules');
Run Code Online (Sandbox Code Playgroud)
我用最原始的方式将我的侧边栏翻译成WPML和字符串翻译.
这是我的侧边栏的英文部分(未翻译) -
<div class="sideall">
<div class="sidebar-mai1">
<div class="sidebar-name">
<img style="width: 25px; margin-right: 10px; margin-bottom: -7px;" title="first asset" src="/wp-content/images/sidbar-assets/firstasset.png" alt="first asset" />First Asset</div>
<div class="sidebar-btn">
<a class="btn-sidebar" href="/assets/first-asset/">Review</a>
<a class="btn-sidebar1" href="/buy/first-asset">Trade Now!</a></div>
<div style="clear: both;"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
在尝试翻译其他语言时(比如说意大利语),wpml拒绝将我的更改保存到评论链接.就像我的重定向规则以某种方式影响它一样.
这是我添加到侧边栏的翻译 -
<div class="sideall">
<div class="sidebar-mai1">
<div class="sidebar-name">
<img style="width: 25px; margin-right: 10px; margin-bottom: -7px;" …Run Code Online (Sandbox Code Playgroud)