常见问题及答案 - 第一部分

Contents

每个CMS有它们自己的模板和样式处理方法。该FAQ包含了一般的问题和答案,特别是默认安装的CMS Made Simple的相关问题和你刚开始使用时的相关问题。在该FAQ中的很多材料都应该在手册中能够找到,如果你在论坛中发现别人常问的问题在FAQ中没有,请将它们添加到FAQ中。

CMSMS支持的最大页面数是多少?

唯一的页面数量限制是列出内容区域……因为每个页面都需要消耗内存,内容越多,加载页面的时间就越长。
从实际应用来讲,在一个正规的服务器上,并且一切都进行了扩展(即都满足了要求,例如内存),那么限制大概是6000左右。
来源: CMSMS Forum

我如何设置设置调试模式?

在管理控制台中发生错误?该页面将给你一般问题的答案!
要开启调试模式,在你的安装目录的根下编辑config.php,将$config['debug']设置为“true”:
   
  $config['debug'] = false
  to
  $config['debug'] = true

我的服务器日志在哪里?

要访问你的服务器日志,你必须问你的主机管理员(操作系统管理员)。
日志的位置以及显示工具一来与服务器的设置。

在xxxx模块中的标签窗口中我没有看到任何内容

这通常表示一个某种形式的错误,例如内存错误、有损坏的文件或者其它的一些错误。你首先应该检查httpd的错误日志或者其它相关的地方,如果错误仍然存在,那么就打开页面源代码查找发生错误的地方。

文件不能被上传,权限问题?

如果你正在尝试上传图片,你最可能需要做的事情就是将uploads/images目录的权限修改为777.将整个目录(包含子目录)的权限修改为可写应给可以解决该问题。

如何改变头部(Logo)图片?

头部的图片时在Layout样式表中指定的,它将被所有的模板使用,你可以通过下面的方法来改变该图片:
  • 首先通过“内容/图片管理”上传你想要的图片。并确保你上传的文件的文件名不包含空白字符(如果包含空白字符请重命名文件)。
  • 然后到“布局/模板”页面并在你想修改的模板行上点击CSS图标Css.png,出现的页面将显示当前模板正在使用的样式表,记住样式表的名称(大多数看起来应该像这样 Layout: Top menu + 2 columns)。
  • 然后到“布局/样式表”,并点击你上一步中记住的样式表的名称。
  • 滚动滚动条并找到下面显示的段落,并用你的新图片名(新logo的文件名)替换原来的文件名。不要在该行添加任何引号。
  • 同时修改高度和宽度以便与你的图片匹配(i.e. from 80px and 198px as shown)。注意,高度必须在两个地方都修改:
  div#header {
     height: 80px; /* adjust according your image size */
     background: #385C72;           
  }

  div#header h1 a {
  /* you can set your own image here */
     background: #385C72 url(images/cms/logo1.gif) no-repeat 0 12px; 
     display: block; 
     height: 80px;         /* adjust according your image size */
     text-indent: -999em;  /* this hides the text */
     text-decoration:none; /* old firefox would have shown  underline*/
  }                        /*  for the link, this explicitly hides it*/
最后点击“提交”保存你的修改,在浏览站点时你应该可以看到你的新Logo图片了。

How do i get the Menu Bar over the Header Image

If you want to make your main menu bar appear over, or next to, a main header image, this forum post describes how. An excerpt:
You can get the menu to appear beside the logo by playing around with the margins and padding in #top-nav and #menu_horiz, for example try margin-top: -50px; and margin-left: 250px;
Also you can adjust the width of #menu_horiz and float it to the right for some other options.

How do i get two Images in the Header

Following is one technique for having a header containing two images, one on the left and the other on the right (Adapted from the forum). What you want is a 'liquid' / 'stretchy' page so you need to do most of it in '%'.
  <div id="header">
  <div id="left">
  </div>
  <div id="right">
  </div>

  #header{width:**%}
  #left{float:left;width:**;height:**;margin:**;padding:**;}
  #right{float:right; bla bla bla}
The widths for left & right can be **px or **%, margins can be same: px or %. You may have to futz around for IE.

How can i install a Development Environment on my PC (1)

See Install on Local Windows PC

How can i install a Development Environment on my PC (2)

How to set up a Development Enviroment on your PC, so that you can try out CMSMS offline.
The simplest way is to downloade a server package, for instance XAMPP from apachefriends. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.
NOTES
  • Before you try to apply .htaccess for Pretty URLS, you might want to enable mod_rewrite in the file apache/conf/httpd.conf. Uncomment this codeline, by removing the #:
#LoadModule rewrite_module modules/mod_rewrite.so
  • Make sure to save the .htaccess file in ANSI format, not UTF-8.

How to Change the Width of Your Site

The default template and style sheets constrain each page of your site to a maximum and minimum width. Making the browswer window wider will not cause text to reformat beyond this width, and making it narrower will cause a horizontal scroll bar to appear.
Check which layout stylesheet you are using (Layout/Templates and click the CSS-icon Css.png for the template you are using). The stylesheet contains the minimum and maximum width settings. Look for div#pagewrapper and set the min and max width to your liking. The default settings in the Layout Stylesheet are:
  /* center wrapper, min max width */
  div#pagewrapper {
     border: 1px solid black;
     margin: 0 auto;     /* this centers wrapper */
     max-width: 80em; /* IE wont understand these, so we will use javascript magick */
     min-width: 60em;
     background-color: #fff;;
     color: black;
  }
The min and max page width for Internet Explorer is set here in the Template. For other browsers it's in the stylesheet called e.g. "Layout: Top menu + 2 columns".
  </script>
  <!--[if lte IE 6]>
  <style type="text/css">
  #pagewrapper {width:expression(P7_MinMaxW(720,950));}
  #container {height: 1%;}
  </style>
  <![endif]-->
  {/literal}

Adapt Your Template

Many people convert an existing website into CMS Made Simple. In that scenario, you likely have enough to do without tweaking yet another set of CSS pages and templates. What you really want to do, then, is simply replace all the supplied templates with your own.
As described [by Ted] in the forum, these are the basic steps:
  • Find a representative page from your current website.
  • Create a new blank template in CMS Made Simple.
  • Paste the HTML of your chosen page into the box.
  • Replace the body of it with a {content} tag (i.e. this is the part that will change from page to page)
  • Replace the menu section (Home, Contact, Link to Us) with {bulletmenu} or {cms_module module='phplayers'}.
  • Put a {stylesheet} tag somewhere in between the <head></head> tags.
  • Maybe put {title} in between the <title></title> tags.
Now you have a new template ready to go, you can create a content page to test it with. Do this by:
  • Create a new blank content page
  • Specify the template name you created above (you can make it the default template to save a step on each new content page).
  • Paste in the text you replaced with the {content} tag above
  • Save the page


Now step back and admire your handiwork. With luck, you'll have a page very similar to the one you started with. Note that the menus won't work correctly until you've added more pages -- they'll be automatically generated.
A longer example with more step by step information can be found in [this long forum post].


Cyrillic Support

The idea behind this page is to collect all the info, relating national Cyrillic alphabets support in CMS Made Simple. Although there shouldn’t be any major problems since CMSMS is UTF-8 based thus aware of national alphabets, it seems to be a good idea to share the tips and tricks here, so some valuable info won’t get lost into the forum archives.
WARNING! The information below might be outdated (trick based on an ancient 0.13 version of CMSMS). Refer to the forum thread at http://forum.cmsmadesimple.org/index.php/topic,12132.0.html for updated instructions.
Adding Cyrillic Support in auto_alias_content
First, turn on auto_alias_content in ./config.php:
  #Automatically assign alias based on page title?
  $config['auto_alias_content'] = true;
Then, download the excellent transliteration PHP class package by PixelApes from their website. Drop the translit.php file into the ./lib/ folder of your CMSMS installation. Then, you need to load it to CMSMS (probably loading it from some admin include file is a better idea?). Add the following code to ./include.php:
  ...
  require($dirname."/lib/classes/class.group.inc.php");

  // ZYV
  require_once($dirname."/lib/translit.php");
  ...
Now the final touch. You need patch the SetAlias function of the content class. Open ./lib/classes/class.content.inc.php and patch it accordingly:
  function SetAlias($alias) {
  ...
    if ($alias == '')
    {
      // ZYV
      if (isset($gCms->config['admin_encoding']) && isset($gCms->variables['convertclass'])) {
        $class =& $gCms->variables['convertclass'];
        $text = $class->Convert(trim($this->mMenuText), $gCms->config['admin_encoding'], "windows-1251");
      } else {
        $text = trim($this->mMenuText);
      }
      $alias = Translit::UrlTranslit($text);
  ...
Note that you need to decode mMenuText from UTF-8 only if you are using UTF-8 as the main CMSMS character set. If you use a different charset like KOI8-RU, then remove utf8_win1251 function from the code above and recode translit.php in KOI8-RU (file is originally shipped in Windows-1251 by PixelApes).
Enjoy, now your pretty URLs should be generated automatically by CMSMS in concordance with common Cyrillic transliteration rules.
Tip is contributed by --ZYV 08:46, 26 August 2006 (CDT)

Getting Started

This page describes common changes you're likely to want to make to your default installation of CMSMS. Its a quick and dirty guide, not meant to replace the excellent User Handbook design guide pages. Specifically, it tells you how to change:
  • modify the page title (i.e. <title> tags)
  • the top left hand side logo
  • choose your own font face, weight and size
  • the background color and font colours
  • change the menu colors to match
Some things are purposefully kept simple to get you going fast, but where available it will include links to more information. This guide assumes that you want to use the same general format of the sample pages (e.g. a 'main page' surrounded by a grey border that uses CSS styles for menus). If you have your own template and CSS already, then you don't really need this guide.
First, Save the Originals
Fight the urge to go right into the files and start changing them randomnly. This works well right up until you modify something critical and then can't work out how to get back to the original values. On the other hand, it is preferable to change the original files since there is a lot of integration between the templates and the styles which can make it hard to make completely new templates. You can quickly make backup copies of all the templates and styles by:
  • go to Layout -> Templates
  • for each template in turn, click on the 'copy' icon on the far right side (between the yellow icon and the checkbox)
  • when it asks for the new name, use Z oldname, e.g. Z Bulletmenu Vert 1 col. This causes the saved templates to sort in the same order as the original and pushes them out of the way to the bottom of the list
  • go to Layout -> Stylesheets
  • repeat the same for all stylesheets. Yes, this is tedious (Is there a better way using the Template manager?')


Note that the resulting copies aren't directly usable, for example because the Z templates are not hooked up to the Z stylesheets.
Change the Title Bar text
The default Title Bar text (i.e. as found in the <title> tags in the HTML header) is stored in each template as literal text. For example in the CSSMenu Vert 1 col template this is near the top:
  <!-- Type the title of your site here -->
  <title>CMS Made Simple Demo - {title}</title>
You can change this to suit your own website by simply changing it. And then repeat that for every template. However, if you're going to change each template, you could instead use a similar mechanism used for the footer text, and instead put the title into a Global Content Block. Do this by:
  • click on Content -> Global Content Blocks
  • Click on Add Global Content Block
  • Enter a name for the block, e.g. TitleText
  • Enter the title you wish, without any formatting. E.g. 'Super Widgets'
  • Click Submit to save
Now edit each template in turn, replacing the above text with:
  <!-- Type the title of your site here -->
  <title>{global_content name='TitleText'} - {title}</title>
Next time you want to change your title, simply modify the TitleText Global Content Block and all your pages will be immediately updated.
Modify the Logo
See Header Images for simplest possible change - switching the default CMS graphic - as well as more complex arrangements.
Changing Colours
Adjusting the colours from the default can be a little daunting and requires a lot of trial and error if you're not a CSS guru. This is a quick guide to some of the more common changes. Most colours are set in the stylesheet Colours. Here is the default version, but with comments added to explain what they affect. Note that a page has two main areas: the outside 'frame' area which is typically a neutral grey colour, and the content area that has the actual page contents.
  /* Layout sections */
  body {
    background: #ccc;  /* background of the area outside the content page */
    color: #333;       /* color of most text in content page (not menus or headings) */
    }
	
  div#pagewrapper {
    border: 1px solid #000;   /* the thin border that frames the page content */
    background: #fff;         /* background color of the content page */
    }
		
  div#header {
    color: #fff;               /* header text colour */
    background-color: #BF8D5A; /* header background colour */
    }
		
  div#footer {
    color: #fff;               /* footer text colour */
    background-color: #385C72; /* footer background colour */
    }
		
  /* Links */		
  a,
  a:link 
  a:active {
    color: #385C72;
  }
  a:visited {
    color: #E7D3AB;
  }

  /* Headings */	
  h1, h2, h3, h4, h5, h6 {
    color: #000;
  }
Note that div#header background-color is not included in the standard template. The a:visited and a:active link colours are also listed separately, in case you like to give your visitors information about where they've already clicked.
If you want to make the individual page sections blend into each other, set the body background, div#pagewrapper background, div@header background-color and div#footer background-color all to the same value, and remove the border attribute from div#pagewrapper.

Modular CSS

This material overlaps a lot with this User Handbook page and probably should be consolidated with that (e.g. by adding the Mike Stenhouse links to that page)
The arrangement of the stylesheets follows a layout designed by Mike Stenhouse and documented at his site. The different stylesheets are:
Typography
Provides fundamental font information, including face, size and weight. Font colour is generally not defined here.
Colours
Specifies the font, background, border and link colors.
Layout various
Most of your site specific changes will occur here, especially in conjunction with the templates of the corresponding names.
Nav Vertical and Horizontal
Controls the menu navigation bars
Forms
All form related styles are defined here.
Tools
Various CSS idioms that help make the styles work better in different browsers. You'll rarely, if ever, need to modify these (background information).

Sub Menu Heading

The standard EllNav Horiz/Vert set of templates has a horizontal main menu and then a secondary vertical menu. Sometimes its nice to add a heading to the vertical menu to place it in context on the page. This article is taken from a []http://forum.cmsmadesimple.org/index.php/topic,4705.msg26467.html#msg26467 forum post]] which describes a solution.
The steps required are:
  • Create a new user-defined tag by going to Extensiosn -> User-Defined Tags
  • Click on Add User Defined Tag
  • Provide a tag name of parent_title
  • Provide code as follows:
  global $gCms;
  $db =& $gCms->GetDb();

  $vars =& $gCms->variables;

  $query = "SELECT content_name FROM "
    .cms_db_prefix()
    ."content WHERE content_id = (SELECT parent_id FROM "
    .cms_db_prefix()
    ."content WHERE content_id = '"
    .$vars['content_id']
    ."');";

  $dbresult = $db->Execute($query);
  if ($dbresult && $dbresult->RowCount() > 0) {
    $row = $dbresult->FetchRow();
    echo $row['content_name'];
  } else {
    echo $vars['pageinfo']->content_menutext;
  }
Submit, and the tag is now ready for use in any templte. For example, you can add this to the EllNav Horiz/Vert L 1col template (and likely also the EllNav Horiz/Vert L 2col template by matching the code below with the template code:
   <!-- Start Content (Navigation and Content columns) -->
   <div id="content" class="clearfix">

      <!-- Start Navigation -->
      <div id="menu_vert">
         <h2 class="accessibility">Sub Navigation</h2>
      <h2>{parent_title}</h2>
         {cms_module module='menumanager' template='ellnav-accessible.tpl' start_level='2' collapse='1'}
      <hr />
      </div>
      <!-- End Navigation -->
Notice the new line inserted which contains: {parent_title}.
Now open a page that uses this template, and, voila!, there is now a heading above the submenu that matches the first level menu.
Using the Menu Manager to Create Sub Menu Headings
Another way to create a menu header is to create a simplified template in the menu manager. Your header could be a styled text label or an image that changes depending on which section you're in.
Make a new menu template just for the header. The code for this header-only menu template is:
  {if $count > 0}
    {foreach from=$nodelist item=node}
      {if $node->current == true or $node->parent == true}
        {* ADD WHAT YOU WANT TO DISPLAY AS A HEADER HERE. *}
      {/if}
    {/foreach}
  {/if}
In this menu template, replace the comment line with the HTML/Smarty code that displays what you want in your menu header. You can make your own, or just copy/paste from your side menu template. A few examples are shown below.
In your page template, add {menu start_level ='1' number_of_levels='1'} where you want the header to appear — usually just before your side {menu}. Styling and formatting of the header can be included in either the menu template or page template.
Examples
  • For just the text, use "$node->menutext" in your menu template.
  • To use an image, use "<img src='__your_path__/{$node->alias}.jpg'/ alt="{$node->menutext}">". Simply name your header images after the page aliases of the top-level pages change __your_path__ to the folder where the images are saved.

Menu Manager Node Parameters

This list is taken from the help file available from the CMSMS menu manager layout page. References to additional parameters appear in the forums.
The parameters for the $node object used in the template are as follows:
  • $node->id -- Content ID
  • $node->url -- URL of the Content
  • $node->accesskey -- Access Key, if defined
  • $node->tabindex -- Tab Index, if defined
  • $node->titleattribute -- Description or Title Attribute (title), if defined
  • $node->hierarchy -- Hierarchy position, (e.g. 1.3.3)
  • $node->depth -- Depth (level) of this node in the current menu
  • $node->prevdepth -- Depth (level) of the node that was right before this one
  • $node->haschildren -- Returns true if this node has child nodes to be displayed
  • $node->menutext -- Menu Text
  • $node->alias -- Page alias
  • $node->target -- Target for the link. Will be empty if content doesn't set it.
  • $node->index -- Count of this node in the whole menu
  • $node->parent -- True if this node is a parent of the currently selected page


Optional Parameters

  • (optional) includeprefix="" - Include only those items who's page alias matches one of the specified (comma separated) prefixes. This parameter cannot be combined with the excludeprefix parameter.
  • (optional) excludeprefix="" - Exclude all items (and their children) who's page alias matches one of the specified (comma separated) prefixes. This parameter must not be used in conjunction with the includeprefix parameter.
  • (optional) template="bulletmenu.tpl" - The template to use for displaying the menu. Templates will come from the database templates unless the template name ends with .tpl, in which case it will come from a file in the MenuManager templates directory (defaults to simple_navigation.tpl)
  • (optional) start_page="home" - Starts the menu displaying at the given start_page and showing that element and it's children only. Takes a page alias.
  • (optional) start_element="1.2" - Starts the menu displaying at the given start_element and showing that element and it's children only. Takes a hierarchy position (e.g. 5.1.2).
  • (optional) start_level="2" - This option will have the menu only display items starting a the given level. An easy example would be if you had one menu on the page with number_of_levels='1'. Then as a second menu, you have start_level='2'. Now, your second menu will show items based on what is selected in the first menu.
  • (optional) show_root_siblings="1" - This option only becomes useful if start_element or start_page are used. It basically will display the siblings along side of the selected start_page/element.
  • (optional) show_all="0" - This option will cause the menu to show all nodes even if they are set to not show in the menu. It will still not display inactive pages however.
  • (optional) number_of_levels="1" - This setting will only allow the menu to only display a certain number of levels deep.
  • (optional) items="contact,home" - Use this item to select a list of pages that this menu should display. The value should be a list of page aliases separated with commas.
  • (optional) collapse="1" - Turn on (set to 1) to have the menu hide items not related to the current selected page.
  • (optional) lang="en_US" - Parameter is used to specify what language to use for display on the frontend. Not all modules support or need this.

Getting Javascript to work

See below

Using {} characters in your pages

{} characters are special in Smarty (the template system that CMSMS uses). Smarty recognizes several types of tags, some of which can be within JavaScript or CSS code. Since you do not want Smarty to try to parse the JavaScript or CSS as Smarty template code, you need to surround the offending code in {literal} {/literal} tags.
Just put {literal}{/literal} tags around it like this:
  {literal}
  {} {These now work.}
  {/literal}
Another example using Javascript or CSS:
  {literal}
  <script language="JavaScript" type="text/javascript">
  // code here
  </script>

  <style type="text/css">
  /* css here */
  </style>
  {/literal}
[More info]

Goto FAQ Part 2

This FAQ grew over the 32kb size of text which made the Mediawiki system complain that some browsers don't support text files above 32kb, not mine but some other browsers. So i divided the FAQ in a FAQ 1 and a FAQ 2..


This page in: English - Deutsch - Español - Français - Italiano - Lietuvių - Nederlands - Norsk - Polski - Česky - Русский - Svenska - Tiếng Việt - عربي - 日本語 简体中文

FAQ/zh

From CMSMS

Arvixe - A CMSMS Partner