按照指南,我有
1)创建服务提供商
class ViewComposerServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
view()->composer('template', function ($view) {
$view->with('series_list', Series::all());
});
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
}
Run Code Online (Sandbox Code Playgroud)
2)注册提供商
App\Providers\ViewComposerServiceProvider::class,
Run Code Online (Sandbox Code Playgroud)
3)并在模板上回显变量
{!! var_dump($series_list) !!}
Run Code Online (Sandbox Code Playgroud)
问题是 :
Route::get('/', 'HomeController@index');
Route::get('product/view/{id}', 'ProductController@view');
Route::get('product/detail/{id}', 'ProductController@detail');
Route::get('/page/contact', 'PageController@contact');
Run Code Online (Sandbox Code Playgroud)
PageController和HomeController可以显示$ series_list,但ProductController将返回错误:
Undefined variable: series_list in the template
Run Code Online (Sandbox Code Playgroud)
这是ProductController:
class ProductController extends Controller
{
/**
* …Run Code Online (Sandbox Code Playgroud) 我想从选项卡中的链接创建一个新选项卡.
例如,在标签a中,有一个链接"打开标签b",它应该添加标签b,
当链接不在选项卡中时,我尝试了创建选项卡的方式(这是有效的)
但是,在这种情况下,当我按它时,它没有响应.谢谢
<a href='#' onclick="addTab('Manage List','list/view.php')" class='btn'>Manage List</a>
Run Code Online (Sandbox Code Playgroud)
addtab功能
function addTab(title, url){
if ($('#tt').tabs('exists', title)){
$('#tt').tabs('select', title);
} else {
var content = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:100%;height:100%;"></iframe>';
$('#tt').tabs('add',{
title:title,
content:content,
closable:true
});
}
}
Run Code Online (Sandbox Code Playgroud)
完整页面
<?
include("../connection/conn.php");
session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
@import "../plugin/easyui/themes/default/easyui.css";
@import "../plugin/easyui/themes/icon.css";
@import "../plugin/bootstrap/css/bootstrap.css";
@import "../plugin/bootstrap/css/bootstrap-responsive.css";
@import "../style/form.css";
</style>
<script src="../plugin/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="../plugin/easyui/jquery.easyui.min.js"></script>
<script src="../plugin/jquery.validate.min.js"></script>
<script>
$(document).ready(function(){
$("#addlist").validate();
});
function addTab(title, url){ …Run Code Online (Sandbox Code Playgroud) 默认按住屏幕(例如按住1秒)将显示保存图像/复制的选项。但是,我想关闭我的网络应用程序的该功能,可以吗?我尝试将 touchmove 事件替换为 selectall ,但它不起作用。谢谢你的帮助。
addEventListener('touchmove', function(e) { e.preventDefault(); }, true);
Run Code Online (Sandbox Code Playgroud) $("#prevPage").live("click",function(e) {
.................
});
Run Code Online (Sandbox Code Playgroud)
例如,当用户已经点击prevPage时,其中的语句正在运行,如果用户立即点击它,它将再次触发.但是,我希望click事件触发器只有在它内部的所有语句都完成执行后才会触发,如何实现呢?谢谢.
目前我有几个视图,屏幕分为两个部分
例:
text1 image1
text2
text3
text4
Run Code Online (Sandbox Code Playgroud)
问题是,如果image1很高,它将与左侧的textview重叠,所以我用左边强制textview宽度不超过imageview的左边.
android:layout_toLeftOf="@id/imageView1"
Run Code Online (Sandbox Code Playgroud)
但是,每个textview都与imageview的左边对齐,因为在创建视图之前我不知道它的高度.我希望在imageview基线下面的所有textview删除布局规则android:layout_toLeftOf
所以我搜索解决方案并找到两种方法?
1.onWindowFocusChanged
2.getViewTreeObserver().addOnGlobalLayoutListener
Run Code Online (Sandbox Code Playgroud)
两者都可以获得视图的y轴.
问题是:
1. what is the difference between them ?
2. I tried approach 2 , but it is not working, how to fix it?
Run Code Online (Sandbox Code Playgroud)
码:
image.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
ImgY = image.getY();
}
});
lng.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
if (lng.getY() > ImgY) {
lng.removeRule(RelativeLayout.LEFT_OF);
}
}
});
Run Code Online (Sandbox Code Playgroud)
错误是我想设置一个全局值来存储imageview的y,但它警告The final local variable ImgY cannot be assigned, since …
我在用
<object>
Run Code Online (Sandbox Code Playgroud)
在我的网站上嵌入pdf文件.例如
<object data="abc.pdf" type="application/pdf">
<embed src="abc.pdf" type="application/pdf" />
</object>
Run Code Online (Sandbox Code Playgroud)
它适用于所有桌面浏览器,但在我的Android设备上,它没有显示任何内容.除了使用谷歌pdf查看器(因为它显着降低了pdf质量),有没有办法支持所有的ios/android设备浏览器?或者,处理这种情况的最佳方法是什么?由于有很多浏览器,我如何将它们重定向到浏览器的pdf插件下载页面,或者我应该告诉他们获取一个?(用户友好性较差).谢谢
我已经搜索了解决方案,但似乎这些都没有用.我的情况不适用于更换xml吗?如何解决问题?滚动视图工作但edittext无法正常工作.谢谢
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/share_bg" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:overScrollMode="never" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/photo_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/share_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/photo_area"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="@string/share_title"
android:textColor="@android:color/white" />
<EditText
android:id="@+id/share_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/share_title"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/custom_textarea"
android:gravity="top|left"
android:lines="5"
android:scrollbars="vertical"
android:text="@string/default_msg" >
<requestFocus />
</EditText>
<ImageView
android:id="@+id/share_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/share_content"
android:layout_centerHorizontal="true"
android:src="@drawable/photo_taken_btn_submit" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
id:share_content是editText,谢谢
有两个表:管理员,新闻
结构是这样的:
admin
-----
id
name
news
-----
id
createBy
updateBy
Run Code Online (Sandbox Code Playgroud)
目前createBy和updateBy存储了admin id,我想得到createBy和updateBy的管理员名称,如何实现呢?谢谢
这是我在codeigniter中使用的
$this->db->select('*');
$this->db->from('news,admin');
$this->db->where('id', $id);
$this->db->where('admin.id', 'news.updateBy');
Run Code Online (Sandbox Code Playgroud)
无论如何sql查询是受欢迎的,我会将其转换为codeigniter语法.谢谢你的帮助
Video
-------
id
source_low
source_med
source_high
Source
--------
id
duration
thumbnail
Run Code Online (Sandbox Code Playgroud)
视频项目可以包含至少1个或最多3个源(源低,源med,源高).
这个想法与youtube相同,这意味着视频记录可以包含多种质量.因此,当我返回持续时间/缩略图时,我想检查哪个源存在并返回其中一个.
例如,如果视频有source_low或source_med,这意味着source_low和source_med有持续时间和缩略图,那么我只需要返回其中一个.
Codeigniter语法:
$this->db->select('v.*, sl.duration, sm.duration as duration_m, sh.duration as duration_h, sl.thumbnail, sm.thumbnail as thumbnail_m, sh.thumbnail as thumbnail_h');
$this->db->from('video as v');
$this->db->join('source as sl', 'v.source_low = sl.video_id', 'left');
$this->db->join('source as sm', 'v.source_med = sm.video_id', 'left');
$this->db->join('source as sh', 'v.source_high = sh.video_id', 'left');
$this->db->group_by('v.id');
Run Code Online (Sandbox Code Playgroud)
SQL(缩略图与获取的方式相同):
SELECT v.*, sl.duration, sm.duration as duration_sm, sh.duration as duration_sh
FROM video as v
LEFT JOIN source as sl ON (v.source_low = sl.video_id) …Run Code Online (Sandbox Code Playgroud) 我正在使用jquery处理文件管理器
这是代码:
var elfinder = $('#elfinder').elfinder({
url: '<?= $connector; ?>',
soundPath: '<?= site_url('assets/plugins/elFinder/sounds/rm.wav'); ?>',
height: 700,
lang: 'zh_TW',
uiOptions: {
// toolbar configuration
toolbar: [
['back', 'forward'],
['reload'],
['mkdir', 'upload'],
['copy', 'cut', 'paste', 'rm'],
['rename'],
['view', 'sort']
]
},
contextmenu: {
navbar: ['open', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'info'],
cwd: ['reload', 'back', '|', 'upload', 'mkdir', 'paste', '|', 'info'],
files: [
'open', 'quicklook', 'sharefolder', '|', 'download', '|', 'copy', 'cut', 'paste', 'rm', '|', 'rename', '|', 'info'
]
},
ui: …Run Code Online (Sandbox Code Playgroud)