Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

■■■刚刚开始使用,请问数据调用 是 怎么个调用法啊???

[复制链接]
cjscr 发表于 2009-10-5 16:55:00 | 显示全部楼层 |阅读模式
本帖最后由 cjscr 于 2009-10-5 17:02 编辑

看了看后台,发现有两种调用方法, 一个是 “模块内嵌代码” ,一个是 “Javascript调用代码”

看了一下 “模块内嵌代码” 写的是随便放在模板内的任何地方就行, 我就试着搞了个照片调用,生成了个  <!--{template data/blocktpl/1}-->  代码

然后我就把这个代码 放到了 ..\template\default\header.htm 中,见红色部分。 然后预览吧,看看啥效果,结果直接把代码“ <!--{template data/blocktpl/1}-->  ”显示在了首页上,根本没有调用图片啊。

另外使用Javascript调用代码一样无效,自己建个HTML文件,写入Javascript调用代码,看看站外调用啥效果,结果空白一片,啥都没有,

请问各位前辈,是我理解有误还是啥意思,这东西到底怎么调用? 先谢了
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<!--{if empty($_SGLOBAL['inajax'])}-->
<!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>
<meta http-equiv="content-type" content="text/html; charset=$_SC[charset]" />
<meta http-equiv="x-ua-compatible" content="ie=7" />
<title><!--{if $_TPL['titles']}--><!--{loop $_TPL['titles'] $value}--><!--{if $value}-->$value - <!--{/if}--><!--{/loop}--><!--{/if}--><!--{if $_SN[$space[uid]]}-->{$_SN[$space[uid]]} - <!--{/if}-->$_SCONFIG[sitename] - Powered by UCenter Home</title>
<script language="javascript" type="text/javascript" src="source/script_cookie.js"></script>
<script language="javascript" type="text/javascript" src="source/script_common.js"></script>
<script language="javascript" type="text/javascript" src="source/script_menu.js"></script>
<script language="javascript" type="text/javascript" src="source/script_ajax.js"></script>
<script language="javascript" type="text/javascript" src="source/script_face.js"></script>
<script language="javascript" type="text/javascript" src="source/script_manage.js"></script>
<style type="text/css">
@import url(template/default/style.css);
<!--{if $_TPL['css']}-->
@import url(template/default/{$_TPL[css]}.css);
<!--{/if}-->
<!--{if !empty($_SGLOBAL['space_theme'])}-->
@import url(theme/$_SGLOBAL[space_theme]/style.css);
<!--{elseif $_SCONFIG[template] != 'default'}-->
@import url(template/$_SCONFIG[template]/style.css);
<!--{/if}-->
<!--{if !empty($_SGLOBAL['space_css'])}-->
$_SGLOBAL[space_css]
<!--{/if}-->
</style>
<link rel="shortcut icon" href="image/favicon.ico" />
<link rel="edituri" type="application/rsd+xml" title="rsd" href="xmlrpc.php?rsd=$space[uid]" />
</head>
<body>
<!--{template data/blocktpl/1}-->
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
        <div id="header">
        <!--{if $_SGLOBAL['ad']['header']}--><div id="ad_header"><!--{ad/header}--></div><!--{/if}-->
        <div class="headerwarp">
                <h1 class="logo"><a href="index.php"><img src="template/$_SCONFIG[template]/image/logo01.jpg" alt="$_SCONFIG[sitename]" /></a></h1>
                <ul class="menu">
                <!--{if $_SGLOBAL[supe_uid]}-->
                        <li><a href="space.php?do=home">首页</a></li>
                        <li><a href="space.php">个人主页</a></li>
                        <li><a href="space.php?do=friend">好友</a></li>
                        <li><a href="network.php">随便看看</a></li>
                <!--{else}-->
                        <li><a href="index.php">首页</a></li>
                <!--{/if}-->
                       
                <!--{if $_SGLOBAL['appmenu']}-->
                        <!--{if $_SGLOBAL['appmenus']}-->
                        <li class="dropmenu" id="ucappmenu" onclick="showMenu(this.id)">
                                <a href="javascript:;">站内导航</a>
                        </li>
                        <!--{else}-->
                        <li><a target="_blank" href="{$_SGLOBAL[appmenu][url]}" title="{$_SGLOBAL[appmenu][name]}">{$_SGLOBAL[appmenu][name]}</a></li>
                        <!--{/if}-->
                <!--{/if}-->
               
                <!--{if $_SGLOBAL[supe_uid]}-->
                        <li><a href="space.php?do=pm<!--{if !empty($_SGLOBAL['member']['newpm'])}-->&filter=newpm<!--{/if}-->">消息<!--{if !empty($_SGLOBAL['member']['newpm'])}-->(新)<!--{/if}--></a></li>
                        <!--{if $_SGLOBAL['member']['allnotenum']}--><li class="notify" id="membernotemenu" onmouseover="showMenu(this.id)"><a href="space.php?do=notice">{$_SGLOBAL[member][allnotenum]}个提醒</a></li><!--{/if}-->
                <!--{else}-->
                        <li><a href="help.php">帮助</a></li>
                <!--{/if}-->
                </ul>
               
                <div class="nav_account">
                <!--{if $_SGLOBAL[supe_uid]}-->
                        <a href="space.php?uid=$_SGLOBAL[supe_uid]" class="login_thumb"><!--{avatar($_SGLOBAL[supe_uid])}--></a>
                        <a href="space.php?uid=$_SGLOBAL[supe_uid]" class="loginName">{$_SN[$_SGLOBAL[supe_uid]]}</a>
                        <!--{if $_SGLOBAL[member][credit]}-->
                        <a href="cp.php?ac=credit" style="font-size:11px;padding:0 0 0 5px;"><img src="image/credit.gif">{$_SGLOBAL[member][credit]}</a>
                        <!--{/if}-->
                        <br />
                        <!--{if empty($_SCONFIG['closeinvite'])}-->
                        <a href="cp.php?ac=invite">邀请</a>
                        <!--{/if}-->
                        <a href="cp.php?ac=task">任务</a>
                        <a href="cp.php?ac=magic">道具</a>
                        <a href="cp.php">设置</a>
                        <a href="cp.php?ac=common&op=logout&uhash=$_SGLOBAL[uhash]">退出</a>
                <!--{else}-->
                        <a href="do.php?ac=$_SCONFIG[register_action]" class="login_thumb"><!--{avatar($_SGLOBAL[supe_uid])}--></a>
                        欢迎您<br>
                        <a href="do.php?ac=$_SCONFIG[login_action]">登录</a> |
                        <a href="do.php?ac=$_SCONFIG[register_action]">注册</a>
                <!--{/if}-->
                </div>
                </div>
        </div>

        <div id="wrap">

        <!--{if empty($_TPL['nosidebar'])}-->
        <div id="main">
                <div id="app_sidebar">
                <!--{if $_SGLOBAL[supe_uid]}-->
                        <ul class="app_list" id="default_userapp">
                                <li><img src="image/app/doing.gif"><a href="space.php?do=doing">记录</a></li>
                                <li><img src="image/app/album.gif"><a href="space.php?do=album">相册</a><em><a href="cp.php?ac=upload" class="gray">上传</a></em></li>
                                <li><img src="image/app/blog.gif"><a href="space.php?do=blog">日志</a><em><a href="cp.php?ac=blog" class="gray">发表</a></em></li>
                                <li><img src="image/app/poll.gif"/><a href="space.php?do=poll">投票</a><em><a href="cp.php?ac=poll" class="gray">发起</a></em></li>
                                <li><img src="image/app/mtag.gif"><a href="space.php?do=mtag">群组</a><em><a href="cp.php?ac=thread" class="gray">话题</a></em></li>
                                <li><img src="image/app/event.gif"/><a href="space.php?do=event">活动</a><em><a href="cp.php?ac=event" class="gray">发起</a></em></li>
                                <li><img src="image/app/share.gif"><a href="space.php?do=share">分享</a></li>
                                <li><img src="image/app/topic.gif"><a href="space.php?do=topic">热闹</a></li>
                        </ul>
                       
                        <ul class="app_list topline" id="my_defaultapp">
                        <!--{if $_SCONFIG['my_status']}-->
                                <!--{loop $_SGLOBAL['userapp'] $value}-->
                                <li><img src="http://appicon.manyou.com/icons/$value[appid]"><a href="userapp.php?id=$value[appid]">$value[appname]</a></li>
                                <!--{/loop}-->
                        <!--{/if}-->
                        </ul>
                       
                        <!--{if $_SCONFIG['my_status']}-->
                        <ul class="app_list topline" id="my_userapp">
                                <!--{loop $_SGLOBAL['my_menu'] $value}-->
                                <li id="userapp_li_$value[appid]"><img src="http://appicon.manyou.com/icons/$value[appid]"><a href="userapp.php?id=$value[appid]" title="$value[appname]">$value[appname]</a></li>
                                <!--{/loop}-->
                        </ul>
                        <!--{/if}-->
                       
                        <!--{if $_SGLOBAL['my_menu_more']}-->
                        <p class="app_more"><a href="javascript:;" id="a_app_more" onclick="userapp_open();" class="off">展开</a></p>
                        <!--{/if}-->
                       
                        <!--{if $_SCONFIG['my_status']}-->
                        <div class="app_m">
                                <ul>
                                        <li><img src="image/app_add.gif"><a href="cp.php?ac=userapp&my_suffix=%2Fapp%2Flist" class="addApp">添加应用</a></li>
                                        <li><img src="image/app_set.gif"><a href="cp.php?ac=userapp&op=menu" class="myApp">管理应用</a></li>
                                </ul>
                        </div>
                        <!--{/if}-->
               
                <!--{else}-->
                        <div class="bar_text">
                                <form id="loginform" name="loginform" action="do.php?ac=$_SCONFIG[login_action]&ref" method="post">
                                <input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
                                        <p class="title">登录站点</p>
                                        <p>用户名</p>
                                        <p><input type="text" name="username" id="username" class="t_input" size="15" value="" /></p>
                                        <p>密码</p>
                                        <p><input type="password" name="password" id="password" class="t_input" size="15" value="" /></p>
                                        <p><input type="checkbox" id="cookietime" name="cookietime" value="315360000" checked /><label for="cookietime">记住我</label></p>
                                        <p>
                                                <input type="submit" id="loginsubmit" name="loginsubmit" value="登录" class="submit" />
                                                <input type="button" name="regbutton" value="注册" class="button" onclick="urlto('do.php?ac=$_SCONFIG[register_action]');">
                                        </p>
                                </form>
                        </div>
                <!--{/if}-->
                </div>

                <div id="mainarea">
               
                <!--{if $_SGLOBAL['ad']['contenttop']}--><div id="ad_contenttop"><!--{ad/contenttop}--></div><!--{/if}-->
        <!--{/if}-->

<!--{/if}-->
回复

使用道具 举报

littlehz 发表于 2009-10-5 17:38:01 | 显示全部楼层
没有写数据调用的展示代码吧,即loop中的
看看教程https://discuz.dismall.com/thread-921127-1-1.html
回复

使用道具 举报

 楼主| cjscr 发表于 2009-10-5 23:59:14 | 显示全部楼层
2# littlehz

按你给我发的那个教程写的,预览也没错,

test.jpg

然后把  <!--{template data/blocktpl/1}-->  插到模版文件 header.htm 中,红色部分

-------------------------------------------------------------------------------
<!--{if empty($_SGLOBAL['inajax'])}-->
<!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>
<meta http-equiv="content-type" content="text/html; charset=$_SC[charset]" />
<meta http-equiv="x-ua-compatible" content="ie=7" />
<title><!--{if $_TPL['titles']}--><!--{loop $_TPL['titles'] $value}--><!--{if $value}-->$value - <!--{/if}--><!--{/loop}--><!--{/if}--><!--{if $_SN[$space[uid]]}-->{$_SN[$space[uid]]} - <!--{/if}-->$_SCONFIG[sitename] - Powered by UCenter Home</title>
<script language="javascript" type="text/javascript" src="source/script_cookie.js"></script>
<script language="javascript" type="text/javascript" src="source/script_common.js"></script>
<script language="javascript" type="text/javascript" src="source/script_menu.js"></script>
<script language="javascript" type="text/javascript" src="source/script_ajax.js"></script>
<script language="javascript" type="text/javascript" src="source/script_face.js"></script>
<script language="javascript" type="text/javascript" src="source/script_manage.js"></script>
<style type="text/css">
@import url(template/default/style.css);
<!--{if $_TPL['css']}-->
@import url(template/default/{$_TPL[css]}.css);
<!--{/if}-->
<!--{if !empty($_SGLOBAL['space_theme'])}-->
@import url(theme/$_SGLOBAL[space_theme]/style.css);
<!--{elseif $_SCONFIG[template] != 'default'}-->
@import url(template/$_SCONFIG[template]/style.css);
<!--{/if}-->
<!--{if !empty($_SGLOBAL['space_css'])}-->
$_SGLOBAL[space_css]
<!--{/if}-->
</style>
<link rel="shortcut icon" href="image/favicon.ico" />
<link rel="edituri" type="application/rsd+xml" title="rsd" href="xmlrpc.php?rsd=$space[uid]" />
</head>
<body>
<!--{template data/blocktpl/1}-->
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
        <div id="header">
        <!--{if $_SGLOBAL['ad']['header']}--><div id="ad_header"><!--{ad/header}--></div><!--{/if}-->
        <div class="headerwarp">
                <h1 class="logo"><a href="index.php"><img src="template/$_SCONFIG[template]/image/logo01.jpg" alt="$_SCONFIG[sitename]" /></a></h1>
                <ul class="menu">
                <!--{if $_SGLOBAL[supe_uid]}-->
                        <li><a href="space.php?do=home">首页</a></li>
                        <li><a href="space.php">个人主页</a></li>
                        <li><a href="space.php?do=friend">好友</a></li>
                        <li><a href="network.php">随便看看</a></li>
                <!--{else}-->
                        <li><a href="index.php">首页</a></li>
………………


然后更新缓存,显示如下。。

test02.jpg


啥原因? 是我的用法不对? 还是其他原因?
回复

使用道具 举报

littlehz 发表于 2009-10-6 11:31:53 | 显示全部楼层
不能放header.htm,可以放其他页面,例如随便看看network.htm
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-13 05:49 , Processed in 0.115684 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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