聪明的路径问题

时间:2010-03-11 03:50:57

标签: smarty

这是我的文件夹

index.php
smartyhere
  -Smarty.class.php
admin
  -index.php
  -users.php
index.php中的

- > $ smarty->显示器( '在index.tpl');

在admin / index.php中 - > $ smarty->显示器( 'adminindex.tpl');      得到错误Smarty错误:无法读取资源:“adminindex.tpl”

任何想法? THX

1 个答案:

答案 0 :(得分:-2)

尝试理解代码

哪个urlencode正在执行路径

<?php

print_r($file);

if (isset($file)) {
    $var = explode("-", $file);
    print_r($var);
    $prefix = $var[0];
    $script = $var[1];
} else {
    $file = "c-home1";
    $prefix = "c";
    $script = "home";
    $modid = 0;
}

if ($script=="") {
    $script="prod_list";
}

/*
* following code finds out the modules from suffix
* and find out the script name
*/
switch ($prefix) {
    case "c":
        $module = "content";
        break;
    case "m":
        $module = "myaccount";
        break;
    default:
        $module = "content";
        break;
}

$smarty->assign("module",$module);

/*
* following code finds out the modules from suffix and
* find out the script name
*/
$include_script .= $module."/".$script.".php";

if (file_exists($include_script)) {
    include_once $include_script;
} else {
    include_once "content/error.php";
}

if ($script!='home') {
    if ($script == 'termsandcondition') {
        $smarty->display("content/termsandcondition.tpl");
    } else {
        $smarty->display("template.tpl");
    }
} else {
    $smarty->display("template_home.tpl");
    $smarty->assign("msg", $msg);
    $smarty->assign("msglogin", $msglogin);
}