0

我有这个网站,index.php 与 html 结合在一起,我只需要为主页设置单独的标题(标题标签),但是每当我将主页名称添加到 index.php 页面时,它都会更改所有页面在网站上以该名称。我正在使用 Joomla 1.5...

这是代码部分:

<head>

<title> Home Page Title </title>

<jdoc:include type="head" />

<?php JHTML::_('behavior.mootools'); ?>

<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />

<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/menu.css" type="text/css" />

<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/style.css" type="text/css" />

<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/slideshow.css" type="text/css" />

<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/vns.script.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/mootools.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/toptool.js"></script>


<!--[if lte IE 6]>

<script type="text/javascript">

var siteurl = '<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/';



window.addEvent ('load', makeTransBG);

function makeTransBG() {

    fixIEPNG ($$('#toptools ul li a'), '', 'crop', 0, 0);

    fixIEPNG ($$('#nav_all ul.menu li ul'), '', 'scale', 0, 0);

    fixIEPNG($$('img'));



}

</script>

<style type="text/css">

#hd p.buttonheading {

    margin:8px 0;

}

#nav_all ul.menu ul a {

    width: 14.8em!important;

}



</style>

<![endif]-->





<style type="text/css">

body{

    font-size: <?php echo $vnsfont = $this->params->get ("vnsfont"); ?>px;

}

</style>



<?php if ($vnsshowcopyright = $this->params->get('showcopyright') == 'yes') { ?>

<style type="text/css">

#cpr{

    display:block;

}

</style>

<?php }else{ ?>

<style type="text/css">

#cpr{

    display:none;

}

</style>

<?php } ?>



<?php if ($vnsshowcomponent = $this->params->get('showcomponent') == 'yes') { ?>

<style type="text/css">

#component{

    display:block;

}

</style>

<?php }else{ ?>

<style type="text/css">

#component{

    display:none;

}

</style>

<?php } ?>

<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/sosdmenu.css" type="text/css" />

<?php if ($vnsmenu = $this->params->get('vnsmenu') == 'moo') { ?>

<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/vns.moomenu.js"></script>

<?php }else{ ?>

    <?php if ($vnsmenu = $this->params->get('vnsmenu') == 'css') { ?>

        <script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/js/vns.cssmenu.js"></script>

    <?php }else{ ?>



    <? } ?>

<? } ?>



<?php if ($vnsmenu = $this->params->get('vnsmenu') == 'none') { ?>

<style type="text/css">

#nav_all{

    display: none;

}

</style>

<?php  }?>



<?php if ($this->countModules('left')==0)  : ?>

<style type="text/css">

#ccenter {

    width:716px;

}

</style>

<?php endif; ?>

<?php if ($this->countModules('right')==0)  : ?>

<style type="text/css">

#ccenter {

    width:734px;

}

</style>

<?php endif; ?>

<?php if (($this->countModules('right')==0)&&($this->countModules('left')==0))  : ?>

<style type="text/css">

#ccenter {

    width:935px;

}

</style>

<?php endif; ?>



</head>
4

2 回答 2

1

由于您使用的是Joomla 1.5,请登录到您的后端,找到主页菜单项(带有星号的菜单项),并在其右侧的属性中设置页面标题

于 2013-02-16T20:00:01.203 回答
0

为什么不创建一个执行以下操作的脚本:

<?php $pages = array( 'index', 'test' ); $thispage = basename($_SERVER['PHP_SELF'], ".php");
if(in_array($thispage,$page)) { $titles = array( 'index' => 'Home Page', 'test' => 'Test Page' ); $title_final = $titles[$thispage]; } else { $title_final = 'Unknown Page'; }
?>

现在对于页面部分:

<html><head><title><?php echo $title_final; ?></title></head><body>blablabla</body></html>
于 2013-02-16T19:46:43.287 回答