Loading
Cancel
Webmail Login
Control Panel Login
CGBlog CMSMS Strip_tags and more
.CO.UK ONLY £5.33
Find your perfect domain here

CGBlog CMSMS Strip_tags and more

CGBlog CMSMS Strip_tags and more

CMS Made Simple : CGBlog tags

CMS Made Simple (CMSMS) has a fantastic blog module called CGBlog. This module (as the name would suggest) allows you to run a fully functional blog on your CMSMS site. The below guide will share a few tags that allow you to control the amount of characters or words and how to remove all the coding out of what is displayed.

When you log into your CMS Made Simple admin area (default is yourdomain.com/admin although you changed it from this for security reasons right? If not see rename CMSMS Admin guide) you will see under your Calguys Blog Module link 'Content > Calguys Blog Module'. When you click on this you should see two tabs 'Summary Templates' and 'Detail Templates'. The below code tags can be used in any of these.

Strip Tags

Striptags (or strip_tags) will attempt to remove all HTML and PHP from a string. This can be ideal if you want to display your blog posts on your main page but you don't want any images in the blog or coding messing up the look of the main page. To use strip tags, we add the following;

|strip_tags

to your summary or detailed code. For example;

{if $entry->content}
		{eval var=$entry->content|strip_tags}
{/if}

Summarize

Summarize is a great way of only displaying the amount of words you require. For example, if you have a CGBlog post with 1000 words and you only want to dispaly the first 30, you would use the following code;

|summarize:30

Again this can be added to your summary or content.

{if $entry->summary}
	<div id="CGBlogPostDetailSummary">
		<strong>
			{eval var=$entry->summary}
		</strong>
	</div>
{/if}

Truncate

Truncate will display a fixed amount of characters which can be controlled by adding a value at the end;

|truncate:100

As with the above codes this can be added to any field. So if you had a 'FirstName' field, you would use the following;

{if $entry->FirstName}
		{eval var=$entry->FirstName|truncate:100}
{/if}

Combining codes

The above codes can all be combined as needed. So you could use

|strip_tags|summarize:90

This would look like;

{else if $entry->content}

	<div class="CGBlogSummaryContent">
		{eval var=$entry->content|strip_tags|summarize:90}
	</div>
{/if}

Do you know any others you think we should mention above? If so drop them in the comments box blow explaining what they do in brief and we'll add them above.



Leave a comment

Has this guide helped you? Have an idea for a guide or need help? Let us know below.

© Copyright 2014 | Squirrel Hosting Limited
Company Number 9031308