Frequently Asked Questions and Answers - Part 2

Contents

Who's that Smarty guy?

Smarty is a template engine for PHP. In CMSMS it's the most obvious and most powerful feature provided. Smarty is the core behind each and every template in cms made simple, and if you see {some_tag} it means that smarty is at work. Smarty is most of what makes CMS Made Simple 'Simple' (for people experienced in web development).
The [Smarty website] provides some valuable information including a large set of standard Smarty tags and variables that are not explicitly documented in CMSMS. They are really useful so every one who tries to build a website with CMS Made simple should read the manual, and comprehend what is happening. It is only by doing this, and trying things out for yourself that you will learn to really understand the power behind CMS Made simple.

How to add multiple content blocks

If you want to output a page (what else :)) you have to add {content} tag in your template. But what's to do if you need more than one content block?
For that {content} tag has a useful parameter named block. Tag help says to this parameter:
  • (optional) block - Allows you to have more than one content block per page. When multiple content tags are put on a template, that number of edit boxes will be displayed when the page is edited.
Let's make an example. If you want a second text block (for instance named Textblock-2) you have to add the following:
  {content block="Textblock-2"}
in your template on place where you want to locate second content block. When you now edit a page (which is attached with this template) there will be a second textarea called "Textblock-2".
So it's very easy to add multiple content blocks. At the same way you can add a third, fourt, fifth, ... content block (like you want).
Note
The target of most module output will be the first content block (created with {content}).

How to modify template to show multiple content blocks only if they have text

Simple as this code bellow.
  {content block='mysidebar' assign='mysidebar'}{if !empty($mysidebar)}{$mysidebar}{/if}

How to add php code in a page

There are some ways to add php code inside templates or pages, which should be shown in the following:
  1. Use a User Defined Tag.
  2. Edit your config.php, change $config['use_smarty_php_tags'] from false to true and clear cache. Now you can insert php source with mask {php}your_source{/php}. Note: this option is risky, unsecure, and deprecated.
  3. This is a mix of both. Create a User Defined Tag named extfile and insert the following
  include($params['filename']);
Now you can call every php source with {extfile filename='path/to/your/file.php'}. Be sure that file.php is located inside a secure folder (not accessible to the web server).

Support for non-standard ports

There are some reasons to run a site on a non-standard port, ie. other than 80 (HTTP) or 443 (HTTPS). The default generated config.php does not take into account the port from the HTTP request when generating the root_url to be used throughout the system.
Open your config.php in your favourite editor and add this
  if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')
  {
  $config['root_url'] = str_replace('http','https',$config['root_url']);
  }

  /******************************************************************
  Start support for non-standard ports
  *******************************************************************/
  if (isset($_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT']!='80' && $_SERVER
  ['SERVER_PORT']!='443'))
  {
  $config['root_url'] = $config['root_url'] . ":" . $_SERVER['SERVER_PORT'];
  }
After line
  $config['root_url'] = 'http://www.yourdomain.com';
Now it will work for non-standard ports. This also handles cases where apache listens on port 80, but a firewall is allowing NAT access on a different port and translating it to 80.
Thanks goes to user akpraha.


How to find out username and password

Note This information applies to versions of CMSMS prior to 1.10
The username(s) and passwords are stored in database. The passwords are encrypted with a 1 way password scheme. If you search through the cms_users you'll see the usernames:
  mysql> select user_id,username,password from cms_users;
  +---------+----------+----------------------------------+
  | user_id | username | password                         |
  +---------+----------+----------------------------------+
  |       1 | admin    | 9dfb6c17c8992e3a821c47b68fe8e76a |
  |       2 | editor   | 5aee9dbd2a188839105073571bee1b1f |
This will tell you the username of the 'master' account (user_id == 1)
If you don't know (or forgot) password you just need to reset it.
The following SQL commands will reset the password to 'admin' - you can use either:
  UPDATE `cms_users` SET PASSWORD = md5('admin') WHERE user_id =1;
OR
  UPDATE `cms_users` SET password = '21232f297a57a5a743894a0e4a801fc3' WHERE user_id = 1;

Increasing the maximum length of your content

MySQL TEXT fields have a limit of 64K. If you insert anything larger than that in to a normal TEXT field MySQL will silently truncate your data without telling you. MEDIUMTEXT will store 16MB and LONGTEXT can handle 4GB.
To change the maximum length of your content fields you need to use PhpMyAdmin, or some other database utility, to change the field type from TEXT to MEDIUMTEXT or LONGTEXT. In PhpMyAdmin, select your CMSMS database and click on the "cms_content_props" table (assuming a table prefix of cms_). Click on the edit icon next to the "content" field. Then, in the "Type" dropdown menu, select MEDIUMTEXT or LONGTEXT, depending on what you want, then click on the "Save" button.
This will update your field to the new type and allow you to enter more data into your pages.
NOTE
Longer pages will take longer to load, so keep this in mind.

Frontend Users And Custom Content

Here's a quick introduction to Frontend Users and Custom Content.
Assuming you have no properties in feusers defined
  • Create a property called "Full_Name", prompt: "Full Name", Type Text, Length 50, Maxlength 50
  • Create a property called "email", prompt "Email Address", type Email, Length 80, maxlength 80
  • Create a group called "Users", and add the give the "full_name" property a sort order of 1, and select required. give the email property a sort order of 2, and mark it as required also.
  • Create a new user "user1", full name "John Doe", email "somebody@somewhere.com", and make sure you check that he is in the Users group created above. Make sure you give the user a password.
And now for the content:
In a new page add this:
  {cms_module module=FrontEndUsers}
  {cms_module module=CustomContent}

  {if $customcontent_loggedin > 0}
    You are authorized to see this text
  {else}
    You are not authorized yet, you need to log in
  {/if}
That should give you a good example to go by.
Note:
You can place the code above also in your html-template. (one with the code and one without) But don't forget to check your printtemplate (Module Printing)! Probably you also have to add the code in there! Otherwise non-authorized visitors can see the secured content anyway, by just printing the page!

Is FTP Reliable

To achieve Quick Install via FTP you obviously need an FTP client program. You may already have one, the one you used to upload your static web pages to your old website in the good old days.
But beware not all file transfers are reliable. The CMSms support forum shows repeating problems on uploaded file corruption. To avoid this you should use an FTP program that is reliable such as FileZilla, which can monitor your FTP transfer logs.
Also, be sure to use the checksum feature in the last part of the install process.
There is an alternative to using FTP. Download the installation file to your computer. Convert it to the .zip format. Now go to the file manager provided by your hosting control panel. Upload the file from your computer. Most file managers will allow you to uncompress that file right on the server. This process is faster, less error prone, and easier.

How to Display Source Code as COntent

To display source code blocks on your site use the smarty {literal}{/literal} tags, i.e.
  <p>function to print hello world:</p>

  {literal}

  <pre>
  void Hello(void)
  {
    printf("%s","Hello World!");
  }
  </pre>
    
  {/literal}

  <p>and some more standard content.</p>

What is a free Extract (unzip) Program

7-zip

TrueType errors?

This modules uses TrueType fonts and the hn_captcha library by default.
To use TrueType fonts, you must have PHP compiled with GD and the FreeType library and configure PHP during installation to use FreeType. The FreeType main site is http://www.freetype.org. To enable FreeType 1.x support, use --with-ttf and for FreeType 2.x, pass --with-freetype-dir=DIR.
If you don't understand what all that means just copy the above paragraph and email it to your ISP as a request to install. Any decent ISP will comply.
See "Layout" -> "TemplateExternalizer"...

There are no files (Module TemplateExternalizer)

Q: I did as told on the help page, but there are just no files. How come?
A: Double check if you set file permissions correctly. The directory (tmp/externalizer/ by default) must be writable AND executable. Try also setting the full path to the folder, e.g. if your CMS is in /var/ww/html, use /var/www/html/tmp/externalizer/).

Go to FAQ Part 1

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..

How to connect to another database

There is a post about this subject.


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

FAQ2

From CMSMS

Arvixe - A CMSMS Partner