起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2661|回复: 9

[处理中3] 模式4如何使用cordova插件

[复制链接]

2

主题

8

帖子

24

积分

新手上路

Rank: 1

积分
24
QQ
发表于 2018-5-1 11:29:54 | 显示全部楼层 |阅读模式
本帖最后由 lanhui 于 2018-5-1 20:47 编辑

如题,我也看了相关的帖子,但是没能理解”在自己网站需要调用的页面中用script引用cordova.js“这句话,是不是要再我自己网站的主页代码中加入”<script type="text/javascript" src="/cordova.js"></script>“这行代码吗?所有我选中的插件都能调用了?我的网站是用wordpress搭建的
发表于 2018-5-2 13:54:22 | 显示全部楼层
是的
勾选上插件,代码只需要引入一下cordova.js 就可以了
http://doc.wex5.com/mode4-cordova/
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

2

主题

8

帖子

24

积分

新手上路

Rank: 1

积分
24
QQ
 楼主| 发表于 2018-5-3 06:51:41 | 显示全部楼层
好的,我的网站是Wordpress搭建的,目前还不知道代码在哪里添加,我再试试,看看能不能找到,如有清楚的帮忙回复下
回复 支持 反对

使用道具 举报

发表于 2018-5-3 13:43:11 | 显示全部楼层
lanhui 发表于 2018-5-3 06:51
好的,我的网站是Wordpress搭建的,目前还不知道代码在哪里添加,我再试试,看看能不能找到,如有清楚的帮 ...

就是主页中就可以,就是在使用插件的页面引用就行!
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

2

主题

8

帖子

24

积分

新手上路

Rank: 1

积分
24
QQ
 楼主| 发表于 2018-5-5 12:20:48 | 显示全部楼层
<?php
/**
* Dashboard Administration Screen
*
* @package WordPress
* @subpackage Administration
*/

/** Load WordPress Bootstrap */
require_once( dirname( __FILE__ ) . '/admin.php' );

/** Load WordPress dashboard API */
require_once(ABSPATH . 'wp-admin/includes/dashboard.php');

wp_dashboard_setup();

wp_enqueue_script( 'dashboard' );

if ( current_user_can( 'install_plugins' ) ) {
        wp_enqueue_script( 'plugin-install' );
        wp_enqueue_script( 'updates' );
}
if ( current_user_can( 'upload_files' ) )
        wp_enqueue_script( 'media-upload' );
add_thickbox();

if ( wp_is_mobile() )
        wp_enqueue_script( 'jquery-touch-punch' );

$title = __('Dashboard');
$parent_file = 'index.php';

$help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab above the screen title.' ) . '</p>';

$screen = get_current_screen();

$screen->add_help_tab( array(
        'id'      => 'overview',
        'title'   => __( 'Overview' ),
        'content' => $help,
) );

// Help tabs

$help  = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>';
$help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>';

$screen->add_help_tab( array(
        'id'      => 'help-navigation',
        'title'   => __( 'Navigation' ),
        'content' => $help,
) );

$help  = '<p>' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '</p>';
$help .= '<p>' . __( '<strong>Screen Options</strong> &mdash; Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
$help .= '<p>' . __( '<strong>Drag and Drop</strong> &mdash; To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.' ) . '</p>';
$help .= '<p>' . __( '<strong>Box Controls</strong> &mdash; Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.' ) . '</p>';

$screen->add_help_tab( array(
        'id'      => 'help-layout',
        'title'   => __( 'Layout' ),
        'content' => $help,
) );

$help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
if ( current_user_can( 'edit_posts' ) )
        $help .= '<p>' . __( '<strong>At A Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
        $help .= '<p>' . __( '<strong>Activity</strong> &mdash; Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>';
if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
        $help .= '<p>' . __( "<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>';
if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
        $help .= '<p>' . sprintf(
                /* translators: %s: WordPress Planet URL */
                __( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.' ),
                __( 'https://planet.wordpress.org/' )
        ) . '</p>';
else
        $help .= '<p>' . sprintf(
                /* translators: %s: WordPress Planet URL */
                __( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ),
                __( 'https://planet.wordpress.org/' )
        ) . '</p>';
if ( current_user_can( 'edit_theme_options' ) )
        $help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';

$screen->add_help_tab( array(
        'id'      => 'help-content',
        'title'   => __( 'Content' ),
        'content' => $help,
) );

unset( $help );

$screen->set_help_sidebar(
        '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
        '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen">Documentation on Dashboard</a>' ) . '</p>' .
        '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
);

include( ABSPATH . 'wp-admin/admin-header.php' );
?>

<div class="wrap">
        <h1><?php echo esc_html( $title ); ?></h1>

<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
        $classes = 'welcome-panel';

        $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
        // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
        $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
        if ( $hide )
                $classes .= ' hidden'; ?>

        <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
                <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
                <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the welcome panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
                <?php
                /**
                 * Add content to the welcome panel on the admin dashboard.
                 *
                 * To remove the default welcome panel, use remove_action():
                 *
                 *     remove_action( 'welcome_panel', 'wp_welcome_panel' );
                 *
                 * @since 3.5.0
                 */
                do_action( 'welcome_panel' );
                ?>
        </div>
<?php endif; ?>

        <div id="dashboard-widgets-wrap">
        <?php wp_dashboard(); ?>
        </div><!-- dashboard-widgets-wrap -->

</div><!-- wrap -->

<?php
wp_print_community_events_templates();

require( ABSPATH . 'wp-admin/admin-footer.php' );
这是我的主页代码,我想问下是不是在第19行处修改?
回复 支持 反对

使用道具 举报

2

主题

8

帖子

24

积分

新手上路

Rank: 1

积分
24
QQ
 楼主| 发表于 2018-5-5 12:25:24 | 显示全部楼层
就是在if ( current_user_can( 'install_plugins' ) ) {
        wp_enqueue_script( 'plugin-install' );
        wp_enqueue_script( 'updates' );
这第一行修改成调用插件代码?我改了第一行,改成
<script type="text/javascript" src="/cordova.js"></script>
        wp_enqueue_script( 'plugin-install' );
        wp_enqueue_script( 'updates' );
但是没有反应,不知道怎么解决
回复 支持 反对

使用道具 举报

发表于 2018-5-7 14:02:41 | 显示全部楼层
lanhui 发表于 2018-5-5 12:25
就是在if ( current_user_can( 'install_plugins' ) ) {
        wp_enqueue_script( 'plugin-install' );
...

<script type="text/javascript" src="/cordova.js"></script>
这个是HTML 标签
只能写在 HTML 文件中,你看下最终运行时页面 是否存在这个标签??

建议写在html  head 头部!
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

2

主题

8

帖子

24

积分

新手上路

Rank: 1

积分
24
QQ
 楼主| 发表于 2018-5-8 10:11:53 | 显示全部楼层
本帖最后由 lanhui 于 2018-5-8 10:22 编辑

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
        <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
    <meta charset="utf-8" />
    <title>领先的云计算服务提供商-中国万网(www.net.cn)</title>   
    <style type="text/css">
        body {width:100%; margin:0 auto;font-family:'Microsoft YaHei';color:#5d5d5d;font-size:12px; }
        .host-top {width: 800px; height: 60px; margin: 0 auto; vertical-align: middle;padding:10px 0; }        
        .host-top-title{float: left; font-size: 14px;margin-left:12px;padding-top:22px;}
        .host-top-right {  float: right; margin-right: 5px; line-height: 25px; margin-top: 35px;}
        .host-top-right a {color:#5d5d5d;text-decoration:none;font-size:12px;}
        .host-middle {background-color:#f0fbff;border-bottom:1px solid #c0c0c0;border-top:2px solid #c0c0c0; height:auto;  }
        .host-content{width: 800px; margin: 0 auto;padding:40px 0 30px 0;}

        .host-operation-title{font-size:16px;text-align:center;padding:10px 0; }
        .host-line { border-bottom: 1px solid #c0c0c0; margin-bottom: 10px; height: 15px;  }
        .host-step{background:url() no-repeat; height:70px;padding:20px 0;}
        .host-step-one { position:relative;float:left;left:60px;width:205px;   }
        .host-step-two { position:relative;float:right;width:375px;right:35px;  }
        .host-middle a {color:#0f79bb;text-decoration:underline;font-size:12px;}
        .host-open-title{font-size:16px;padding:5px 10px 10px 10px;}
        .host-open-content{padding-left: 10px; text-align: left;font-size:12px;}

        .host-bottom{width: 800px;line-height: 60px; margin: 0 auto; text-align:center;}
    </style>
</head>
<body>
    <div>        
        <div class="host-top">
            <div style="float: left;">
                <img src="http://gtms04.alicdn.com/tps/i4/TB1j6r2FVXXXXcwXXXX79lWFFXX-144-60.gif" border="0" />
            </div>
            <div class="host-top-title">
                领先的云计算服务提供商
            </div>
            <div class="host-top-right"><a href="http://wanwang.aliyun.com/" target="_blank">万网首页</a> | <a href="http://help.aliyun.com" target="_blank">帮助中心</a></div>
        </div>
        <div class="host-middle">
            <div class="host-content">
                <div style="height:140px;">
                    <div style="float: left;">
                        <img src="http://gtms02.alicdn.com/tps/i2/TB1f5r6FVXXXXc7XpXXkTnU2pXX-190-116.gif" border="0" />
                    </div>
                    <div style="float: left; padding:28px 35px;">
                        <div style="font-size:25px;">您已正式开通主机服务</div>                           
                        <div style="font-size:18px;line-height:32px;">这是万网主机提供的测试访问页,您可以随时进行删除或替换</div>
                    </div>
                </div>
                <div class="host-operation-title">
                    <table width="100%" cellspacing="0" cellpadding="0" style="line-height: 32px;text-align:center;">
                        <tr>
                            <td style="width: 240px;">
                                <div class="host-line"></div>
                            </td>
                            <td>如需访问到您的网站,请按照以下步骤操作</td>
                            <td style="width: 240px;">
                                <div class="host-line"></div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="host-step">
                    <div class="host-step-one">
                        您的首页文件及网站程序需上传至FTP下的HTDOCS目录下</div>
                    <div class="host-step-two">
                        您自行设定的首页文件名,需要添加至<a href="http://cp.aliyun.com/" target="_blank">控制面板</a>默认首页设置的列表中<a href="http://help.aliyun.com/knowledge_detail/6555122.html" target="_blank">操作帮助</a> </div>
                </div>
                <div class="host-open-title">
                    站点开通流程
                </div>
                <div style="margin-bottom:20px;">
                    <table width="100%" cellspacing="0" cellpadding="0">
                        <tr>
                            <td class="host-open-content">1、<a href="http://help.aliyun.com/knowledge_detail/6563876.html" target="_blank">获取FTP/数据库信息</a></td>
                            <td>
                                <img src="http://gtms03.alicdn.com/tps/i3/TB12J61FVXXXXXfXpXX_YiWFVXX-30-26.gif" border="0" />
                            </td>
                            <td class="host-open-content">2、<a href="http://help.aliyun.com/knowledge_detail/5974952.html" target="_blank">网站备案(或申请接入)</a></td>
                            <td>
                                <img src="http://gtms03.alicdn.com/tps/i3/TB12J61FVXXXXXfXpXX_YiWFVXX-30-26.gif" border="0" />
                            </td>
                            <td class="host-open-content">3、<a href="http://help.aliyun.com/knowledge_detail/6555034.html" target="_blank">上传网站程序</a></td>
                            <td>
                                <img src="http://gtms03.alicdn.com/tps/i3/TB12J61FVXXXXXfXpXX_YiWFVXX-30-26.gif" border="0" />
                            </td>
                            <td class="host-open-content">4、<a href="http://help.aliyun.com/knowledge_detail/6554963.html" target="_blank">网站调试</a></td>
                            <td>
                                <img src="http://gtms03.alicdn.com/tps/i3/TB12J61FVXXXXXfXpXX_YiWFVXX-30-26.gif" border="0" />
                            </td>
                            <td class="host-open-content">5、<a href="http://help.aliyun.com/knowledge_detail/6563877.html" target="_blank">域名绑定</a></td>
                        </tr>
                    </table>
                </div>
            </div>
            
        </div>
        <div class="host-bottom">
            Copyright © 1998 - 2014 中国万网 版权所有
        </div>
    </div>
</body>
</html>



这是我的主页html文件,我在</head>上面加了这一行调用代码,不知道对不对
<script type="text/javascript" src="/cordova.js"></script>
</head>
<body>
    <div>        
        <div class="host-top">
            <div style="float: left;">
                <img src="http://gtms04.alicdn.com/tps/i4/TB1j6r2FVXXXXcwXXXX79lWFFXX-144-60.gif" border="0" />
            </div>
            <div class="host-top-title">
第一行加了,但是还是没有反应,
回复 支持 反对

使用道具 举报

2

主题

8

帖子

24

积分

新手上路

Rank: 1

积分
24
QQ
 楼主| 发表于 2018-5-8 10:19:18 | 显示全部楼层
抱歉,麻烦您了,我的服务器中一共两个html文件,一个是zhuye.html,里面代码就是上面刚上传的,另一个是readme.html 我想应该是zhuye.html 这个文件,不知道对不对
回复 支持 反对

使用道具 举报

发表于 2018-5-8 10:34:03 | 显示全部楼层
lanhui 发表于 2018-5-8 10:19
抱歉,麻烦您了,我的服务器中一共两个html文件,一个是zhuye.html,里面代码就是上面刚上传的,另一个是re ...

你两个都加上试试吧!  是在哪个页面调用的,就应该在那个页面引用插件
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-5-4 19:41 , Processed in 0.059436 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表