天空是蓝色的

做好软件为中国 #gcc -c helloworld.c -o helloworld.o //编译目标文件 #gcc helloworld.o -o helloworld //编译成可执行exe #helloworld //运行exe
数据加载中……
smarty循环array-map显示
y.html 模板文件
                    <ul>
                    {{{section name=item loop=$menu_item}}}
                        
<li><href="{{{$menu_item[item][0]}}}">{{{$menu_item[item][1]}}}</a></li>
                    {{{/section}}}
                    
                        
<!--
                        格式
                             <li><a href="#">Index</a></li>
                            <li><a href="#">Selected Content</a></li>
                            <li><a href="#">Guestbook</a></li>
                            <li><a href="#">Toggle Sidebar</a></li>
                            <li><a href="#">Login</a></li>
                        
-->
                    
</ul>

head.php
<?php

require 'lib/Smarty-2.6.11/libs/Smarty.class.php';

$smarty = new Smarty;

//$smarty->compile_check = true;
//$smarty->debugging = true;

$smarty->left_delimiter = "{{{"
$smarty->right_delimiter = "}}}"

$site_title ="中文";
?>
ini.php
<?php
define('SITE_TITLE','中文');
define('SITE_LINK','');
define('AUTHER','bluesky');
define('BABY','');
define('WATCH','');
define('BLOG_TITLE','HELLOWORLD,BLOG');
define('BLOG_INDEX_LINK','HTTP://localhost:88/yy/xy.php');
?>

xy.php
<?php

//echo dirname(__FILE__);

require 'head.php';
require 'ini.php';

$page = 'y.html';
define('PAGE_TITLE','中国');
$smarty->assign('site_title',SITE_TITLE);
$smarty->assign('page_title',PAGE_TITLE);
$smarty->assign('blog_title',BLOG_TITLE);
$smarty->assign('blog_index_link',BLOG_INDEX_LINK);

$href = array();
$value = array();
$href[1= 'index.php'$value[1= '首页';
$href[2= 'guest.php'$value[2= '留言本';
$href[3= 'about.php'$value[3= '关于';
$href[4= 'link.php';  $value[4= '链接';


$map = array_map(null,$href,$value);

for($index=0;$index<count($c);$index++){
    
//echo "<a href=".$c[$index][0].">";
    //echo $c[$index][1]."</a><br/>";

}

//return;
$smarty->assign('menu_item',$map);

$smarty->display($page);
?>

posted on 2005-12-30 14:22 bluesky 阅读(1641) 评论(0)  编辑  收藏 所属分类: PHP


只有注册用户登录后才能发表评论。


网站导航: