我在后台发布了一篇文章  如何在前台调用呢??  使用了smarty分离  smarty
<?php
include '../conn/conn.php';
require 'smarty.ini.php';// 在这里显示公司简介的信息
$sql="select * from fxz_article";
$description=$msql->query($sql);$smarty->assign("description",$description);
$smarty->display('CompanyProfile.html');
?>html
<!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=UTF-8" />
<title>风信子 - 公司简介 - 公司简介</title>
<link href="../css/common.css" rel="stylesheet" type="text/css" />
<link href="../css/right.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="warper">
<div class="right">
<div class="right_title">首页 >> <a href="#">公司简介</a> >> <a href="#">公司简介</a></div>
<div class="nr">
{$description}
<!--济南风信子信息科技有限公司是中国最早从事移动互联网业行业的开拓者之一。公司拥有专业的软件开发团队和核心研发能力,专业从事移动互联网应用软件的设计及开发,为企业提供基于3G平台的移动互联网解决方案,为帮助客户提升市场竞争力。
<p></p>
风信子在济南成立3G研发中心,是国内最具创造力的3G跨平台(iPhone/iPad、Android、Linux、Windows Mobile、Web OS)创新移动研发中心。风信子研发中心技术实力雄厚,拥有自主知识产权的创新3G跨平台开发框架。目前,风信子研发中心致力于Android、iPhone/iPad产品的开发,并为企业提供移动互联网解决方案。
<p></p>
<p></p>
我们基于3G平台进行应用软件开发,为企业提供量身定做跨平台的移动应用,帮助客户快速实现及提出业务。主要开发产品包括:电子媒体、电子书、网络教育、银行客户端,大型门户网站,远程培训,移动视频会议等。
<p></p>
根据客户实际需求,为企业提供基于3G平台的最佳解决方案。针对客户的项目需要,做最准确的开发计划,给出最合客户理想的成本分析。我们的核心软件开发团队己具备多年成功开发移动互联网应用软件项目,经验丰富,能满足不同企业的项目需求。
<p></p>
风信子本着“用户感受”(即User Experiences)的理念,即以用户最终对产品及服务的感受为目标,为您提供最佳3G平台移动方案的设计及开发服务,协助企业创新创建出色的3G移动业务,为客户创造更高价值。
随着我公司团队的成长,凭借公司雄厚的研发技术和运营实力为后盾,我公司的iPhone/iPad、Android等移动软件开发业务迅速发展,更具竞争力的产品将陆续进入市场,并在业界赢得广大企业客户的好评。
<p></p>-->
<div>
<img src="../iframe/images/research.jpg" width="568" height="113" alt="" />
</div>
<!--
<div class="name">日常用品</div>
<div class="nr">
<img src="img/right_left.jpg" width="3" height="211" alt="" title="" border="0"><div class="nr_min">
<div class="lunbo_left"><img src="img/right_lunbo_left.jpg" width="15" height="28" border="0" alt="" title=""></div><div class="nr_min_nr"></div><div class="lunbo_right"><img src="img/right_lunbo_right.jpg" width="15" height="28" border="0" alt="" title=""></div>
<div class="more1"><a href="http://192.168.0.2/" target="_blank">查看详细信息>></a></div></div><img src="img/right_right.jpg" width="3" height="211" alt="" title="" border="0">
</div>
-->
</div>
</div>
</div>
</body>
</html>

解决方案 »

  1.   

    在html里面左边界符 $description.属性  有边界符,如:
    <!--{$description.name}-->
      

  2.   


    这样写不是吧<!--{$description.name}-->给疲敝了吗??
      

  3.   

    你的smarty边界符是啥,还有“给疲敝了”是啥意思啊
      

  4.   

    还有你用echo '<pre>';print_r($description);将输出的东西打出来看看是几维数组
      

  5.   

    Resource id #7
        不懂
      

  6.   


    $sql="select * from fxz_article";
    $description=$msql->query($sql);$smarty->assign("description",$description);
    $smarty->display('CompanyProfile.html');
    改为
    $sql="select * from fxz_article";
    $res=$msql->query($sql);//查询,返回资源,用$res接收
    $description = array();//定义一个空数组用来存放数据
    while($row = mysql_fetch_assoc($res)){//循环转换资源成数组(关联)类型
    $description[] = $row;//存入数组
    }
    echo '<pre>';print_r($description);exit;//打印结构
    $smarty->assign("description",$description);
    $smarty->display('CompanyProfile.html');看看输出的结构是什么样的
      

  7.   

    试过了  在HTML里面  
      

  8.   

    我晕了,你连smarty还没配置呢
    参考下吧 $s->template_dir = 'templates';
    $s->compile_dir = 'templates_c';
    $s->cache_dir = 'cache';
    $s->config_dir = 'config'; $s->debugging = false;
    $s->caching = false; $s->left_delimiter = '<%';
    $s->right_delimiter = '%>';假如$s是smarty对象
      

  9.   

    Array
    (
        [0] => Array
            (
                [aid] => 1
                [title] => 公司简介
                [smalltitle] => 
                [fid] => 42
                [mid] => 0
                [fname] => 公司简介
                [hits] => 2
                [pages] => 1
                [comments] => 0
                [posttime] => 1310978415
                [list] => 1704271940
                [uid] => 1
                [username] => admin
                [author] => 
                [copyfrom] => 
                [copyfromurl] => 
                [titlecolor] => 
                [fonttype] => 0
                [picurl] => 
                [ispic] => 0
                [yz] => 1
                [yzer] => admin
                [yztime] => 1311038837
                [levels] => 1
                [levelstime] => 1311038838
                [keywords] => 
                [jumpurl] => 
                [iframeurl] => 
                [style] => 
                [template] => a:3:{s:4:"head";s:0:"";s:4:"foot";s:0:"";s:8:"bencandy";s:0:"";}
                [target] => 0
                [ip] => 
                [lastfid] => 0
                [money] => 0
                [buyuser] => 
                [passwd] => 
                [allowdown] => 
                [allowview] => 
                [editer] => 
                [edittime] => 0
                [begintime] => 0
                [endtime] => 0
                [description] => 济南风信子信息科技有限公司是中国最早从事移动互联网业行业的开拓者之一。公司拥有专业的软件开发团队和核心研发能力,专业从事移动互联网应用软件的设计及开发,为企业提供基于3G平台的移动互联网解决方案,为帮助客户提升市场竞争力。 风信子在济南成立3G研发中心,是国内最具创造力的3G跨平台(iPhone/iPad、Android、Linux、Windows Mobile、Web OS)创新移动研发中心。风信子研发中心技术实力雄厚,拥有自主知识产权的创新3G跨平台开发框架。目前,风信子研发中心致力于Android、iPhone/iPad产品的开发,并为企业提供移动互联网解决方案。 
    我们基于3G平台进行应用软件开发,为企业提供量身定做跨平台的移动应用,帮助客户快速实现及提出业务。主要开发产品包括:电子媒体、电子书、网络教育、银行客户端,大型门户网站,远程培训,移动视频会议等。 根据客户实际需求,为企业提供基于3G平台的最佳解决方案。针对客户的项目需要,做最准确的开发计划,给出最合客户理想的成本分析。我们的核心软件开发团队己具备多年成功开发移动互联网应用软件项目,经验丰富,能满足不同企业的项目需求。 风信子本着“用户感受”(即User Experiences)的理念,即以用户最终对产品及服务的感受为目标,为您提供最佳3G平台移动方案的设计及开发服务,协助企业创新创建出色的3G移动业务,为客户创造更高价值。随着我公司团队的成长,凭借公司雄厚的研发技术和运营实力为后盾,我公司的iPhone/iPad、Android等移动软件开发业务迅速发展,更具竞争力的产品将陆续进入市场,并在业界赢得广大企业客户的好评。 
                [lastview] => 1310980552
                [digg_num] => 0
                [digg_time] => 0
                [forbidcomment] => 0
                [ifvote] => 0
                [heart] => 
                [htmlname] => 
            ))
      

  10.   

    剩下的就看你自己的了,下面的是我给你的参考
    include '../conn/conn.php';
    //require 'smarty.ini.php';//这个是啥啊?
    require 'Smarty.class.php';$tpl = new Smarty();//实例化smarty,你也可以用继承的方式将smarty弄过来$tpl->template_dir = 'templates';//模板目录
    $tpl->compile_dir = 'templates_c';//编译目录
    $tpl->cache_dir = 'cache';//缓存目录
    $tpl->config_dir = 'config';//配置目录$tpl->debugging = false;//关闭调试
    $tpl->caching = false;//关闭缓存$tpl->left_delimiter = '<%';//左边界符
    $tpl->right_delimiter = '%>';//有边界符
    $sql="select * from fxz_article";
    $res=$msql->query($sql);
    if($row = mysql_fetch_assoc($res)){
    $description = $row;
    }$smarty->assign("description",$description);
    $smarty->display('CompanyProfile.html');html中<% $description.title %>
      

  11.   

    //require 'smarty.ini.php';//<?php
    define('BASE_PATH','C:\wamp\www\gongsi\\'); //定义项目的绝对路径
    define('SMARTY_PATH','smarty\\'); //定义smarty目录的绝度路径
    require BASE_PATH.SMARTY_PATH.'Smarty.class.php';//加载smarty类库文件
    $smarty = new Smarty;//实例化一个smarty对象
    $smarty->template_dir = BASE_PATH.'template/';    //html文件存放的位置
    $smarty->compile_dir = BASE_PATH.'templates_c/';  //编译文件指定的目录
    $smarty->config_dir = BASE_PATH.'configs/';  //配置文件指定的目录
    $smarty->cache_dir = BASE_PATH.'cache/';  //缓存文件指定的目录
    ?>
      

  12.   

    {$description.description}  html中输出这个??
      

  13.   

    没看见你smarty配置边界符啊,默认的好像是<!--{}-->吧,你试一试<!--{$description.description}-->如果还不行说明你其他地方有问题了
      

  14.   

    我刚刚加上了 $smarty->left_delimiter = '{';//左边界符
    $smarty->right_delimiter = '}';//有边界符在html中输出的是{$description.description}   这个 
      

  15.   

    是啊  我在html里面写什么 输出什么  就是不给我输出数据库里面的内容