【问题标题】:How can i solve this statement我该如何解决这个说法
【发布时间】:2012-02-23 00:13:31
【问题描述】:

我为我的 asp.net 网站下载了一个模板。模板适用于 Joomla CMS。我转换了所有,但我在标题中有一些问题,无法理解它的作用以及我如何专注于 asp.net:

    <jdoc:include type="head" /> 
 <link rel="stylesheet" href="<?php echo $this->baseurl ;?>/templates/system/css/system.css" type="text/css" /> 
 <link rel="stylesheet" href="<?php echo $this->baseurl ;?>/templates/system/css/general.css" type="text/css" /> 
 <link rel="stylesheet" href="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/css/template.css" type="text/css" /> 
<!--<?php if($this->direction == 'rtl') : ?> -->
 <link href="<?php echo $this->baseurl ;?>/templates/<?php echo $this->template ;?>/css/template_rtl.css" rel="stylesheet" type="text/css" /> 
 <?php endif; ?> 
 <!--[if lte IE 7]>
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if lte IE 6]>
<link href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/ie6.css" rel="stylesheet" type="text/css" />
<![endif]-->

 <link id="JTKLocalCss" href="css/template.css" rel="stylesheet" type="text/css" />

【问题讨论】:

    标签: asp.net html css


    【解决方案1】:

    其中大部分是样式表链接。它允许用户拥有外部样式。它在哪里说 php echo... 这基本上是指向基本 URL 的链接。你不需要那些,可以用 ~/

    【讨论】:

    • 除非代码在 元素中或 有 runat="server" 属性,否则这将不起作用。
    • 谢谢我的朋友,但我认为这是为其他浏览器(如 IE、safari 或 opera)配置网页的一种方式。我在网页设计中一直遇到的主要问题是当我的内容以 margin:auto 为中心时;声明它只成为火狐的中心,而不是在 IE 中执行我能为此做什么???!
    • 感谢 digbyswift 没有考虑添加这个。这确实是一个不同的问题侯赛因。自己编写模板并了解更多信息或获取原生 html 模板并避免除 joomla 之外的所有 Joomla 模板会容易得多。
    • 没有人能告诉我如何在 IE 的中心设置元素,在 Firefox 中我用来写这个语句:Margin:auto;
    • 如果您在问题中提出,我们可以。左边距:自动; margin-right:auto 跨浏览器应该没问题
    【解决方案2】:

    您可以将代码&lt;?php echo $this-&gt;baseurl ?&gt;/替换为&lt;% = this.ResolveUrl("~/") %&gt;

    对于代码&lt;?php echo $this-&gt;template ?&gt;,将其替换为&lt;% = this.ResolveUrl("~/") %&gt;,然后您必须在代码隐藏中定义一个模板访问器:

    protected string Template { get; set; }
    

    然后需要设置(例如在 PageLoad 上)属性以填充上面的代码。

    对于&lt;?php if($this-&gt;direction == 'rtl') : ?&gt; ... &lt;?php endif; ?&gt; 语句,这可以替换为:

    <% if(this.Direction) {%>...<%}%>
    

    同样,这将需要代码隐藏中的访问器,就像模板示例一样。

    【讨论】:

      【解决方案3】:

      我不是 php 大师,但这些代码的作用似乎很清楚:

      它在每个样式表链接中插入 baseUrl 常量

      如果页面有从右到左的文本,则加载从右到左的 css

      <!--<?php if($this->direction == 'rtl') : ?> -->
      

      【讨论】:

      • 谢谢我的朋友,但我认为这是为其他浏览器(如 IE、safari 或 opera)配置网页的一种方式。我在网页设计中一直遇到的主要问题是当我的内容以 margin:auto 为中心时;声明它只成为火狐的中心,而不是在 IE 中执行,我该怎么办???!
      • 对不起,我是开发者而不是网页设计者。我帮不了你。
      猜你喜欢
      • 2016-08-26
      • 2021-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-21
      • 2021-06-29
      • 2020-03-25
      相关资源
      最近更新 更多