我读了这个话题,但不知道从哪里开始 第一步是什么?我有这样的代码,被称为第一:rclayout.php
<!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" xml:lang="en" lang="en">
<head>
<?php include_http_metas() ?>
<?php include_metas() ?>
<?php include_title() ?>
<link rel="shortcut icon" href="/favicon.ico" />
<?php use_stylesheet('rainbow.css'); ?>
<?php use_javascript('rainbow.js'); ?>
<?php include_stylesheets(); ?>
<?php include_javascripts(); ?>
</head>
<body onload='ax_startup();'>
<center>
<?php
echo "<div id='div_main_container_rc'>";
?>
<div id='div_header_container_rc'>
<?php include_component('profile','header'); ?>
</div>
<?php
echo "<div id='div_content_container_rc'>";
echo $sf_content;
echo "</div>";
echo "<div id='div_footer'>";
?>
//show a footer menu here
</div>
</div>
</center>
</body>
</html>
然后_header.php是,它检查用户是否登录:
<?php
$USR_IS_ADMIN = false;
$USR_AUTH = false;
if($sf_user->hasAttribute('ADMIN'))
{
$USR_IS_ADMIN = true;
}
$id = $sf_user->getAttribute('profile_id');
if($sf_user->hasAttribute('profile_id') > 0)
{
$profile = RcProfileTablePeer::getById($id);
$activated = $profile->getActivated();
if($activated == 1)
{
//echo "activated".$activated;
$USR_AUTH = true;
}
else
{
//echo "NOT activated".$activated;
$USR_AUTH = false;
}
}
?>
<?php if(!$USR_AUTH) : ?>
//show a specific menu here
<?php endif;?>
<?php if($USR_AUTH):?>
//show a different menu here pertaining to logged in user
<?php endif;?>
我更新后的文件factories.yml中:
prod:
logger:
class: sfNoLogger
param:
level: err
loggers: ~
test:
storage:
class: sfSessionTestStorage
param:
session_path: %SF_TEST_CACHE_DIR%/sessions
response:
class: sfWebResponse
param:
send_http_headers: false
mailer:
param:
delivery_strategy: none
dev:
mailer:
param:
delivery_strategy: none
all:
routing:
class: sfPatternRouting
param:
generate_shortest_url: true
extra_parameters_as_query_string: true
view_cache_manager:
class: sfViewCacheManager
param:
cache_key_use_vary_headers: true
cache_key_use_host_name: true
user:
param:
timeout: 300
从哪里开始我该怎么做?我没有看到任何设置的会话 我配置php.ini文件,如果是这样的话?或者我会在会话中做到这一点?
请帮忙? 谢谢
非常感谢您在顶部看到我的工厂文件。我可以只添加你的代码,或者我该如何配置我的?从我的理解,用户是一个工厂,所以我怎么知道我要给班级什么名字?谢谢 –
看到我更新的答案,我澄清了一下... –
谢谢,请参阅我更新的工厂文件..我做了300,所以不必等待30/15分钟来测试这个......你能解释暂停后会发生什么吗?我有我的网站打开和用户登录,但没有任何反应?我仍然可以继续在网站上,因为我仍然登录?谢谢 –