CMS Made Simple: How to customize news title tag

April 27th
stephanie
cms
0 Comments

If you are using the News module you will notice that all of your title tags are the same. To customize this goto: Content → News in the admin panel and choose Detail Template. At the very top of the template add:
{assign var=”pagetitle” value=$entry->title|escape}

This line will generate the smarty variable {$pagetitle} containing the title of the news article. To add the variable to your page template, open it and replace your title tag with the following:

{if isset($pagetitle) && !empty($pagetitle)}

{else}

{/if}

Thanks to iCMSinfo.com for this one.

CMS Made Simple: How to create content blocks for title, meta description and meta keywords.

April 27th
stephanie
cms
0 Comments

If you would like to customize your title tag for better SEO follow replace this with the <title></title> in your template:
<title>{$meta_title|strip_tags|summarize:30:””}</title>

Then add this content block generating code with in the body of your page:
{content block=’meta_title’ wysiwyg=’false’ assign=’meta_title’ oneline=’true’}

Now you can customize your title tag. I figured this out by using CalGuy’s code for adding content blocks for meta discriptions and keywords. Here is the code for that:

Add this in the meta area of your template:
<meta name=”description” content=”{$meta_description|strip_tags|summarize:30:””}”>
<meta name=”keywords” content=”{$meta_keywords|strip_tags|summarize:30:””}”>

Add these to add the admin content blocks:
{content block=’meta_description’ wysiwyg=’false’ assign=’meta_description’ oneline=’true’}
{content block=’meta_keywords’ wysiwyg=’false’ assign=’meta_keywords’ oneline=’true’}

Thanks to CalGuy for this one! Remember if you are using the code here you need to retype the quote marks.

CMS Made Simple and random text jQuery. Great for Testimonials.

April 23rd
stephanie
cms
0 Comments

I created a very simple rotating testimonial feature using CMS Made Simple and jQuery. Note: this is a random rotation on page load. This does not rotate on it’s own. Here’s how:

1. Add jQueryTools module to your site (see this post step 1 and 2 for instructions).

2. Create a file named “jquery.randomtxt.js” and add this script below. The number 3 represents how many quotes you have to choose from. If you add another quoate change this number to 4…etc. Upload to the modules/jQueryTools/lib/ directory:

$(function() {
var randomNum = Math.floor(Math.random()*3);
$(‘div#quote-box-text div:eq(‘ + randomNum + ‘)’).css(“display”, “block”);
});

See my file here:
http://duttoncaseylaw.com/modules/JQueryTools/lib/jquery.randomtxt.js

3. Then update the action.incjs.php (located in the jQueryTools folder) to call this new randomtxt.js into your page. You will need to add ‘randomtxt’ to this two lines of code (around line 45). Make sure to add a comma before randomtxt:

$all_libs = array(‘base’,’tablesorter’,’cluetip’,’form’,’fancybox’,’json’,’cgform’,’randomtxt’);
$std_libs = array(‘base’,’tablesorter’,’cluetip’,’form’,’fancybox’,’form’,’cgform’,’randomtxt’);

You will also need to add a line of code around line 65:

$randomtxt_files = array(‘main’=>’jquery.randomtxt.js’);

4. Add this HTML to your page and swap out your content for the content below:

<div id=”quote-box-text”>
<div>This is my first quote</div>
<div>This is my second quote</div>
<div>This is my third quote</div>
</div>

5. Add this to your css file:

#quote-box-text div {
display: none;
}

6. Add the following smarty tags in the head of your template to activate jQuery on your site:
{JQueryTools action=incjs}
{JQueryTools action=ready}

CMSMS Front End Users and Restrict Pages by Group

April 22nd
stephanie
cms
0 Comments

It is easy to set up simple restricted pages using CMS Made Simple. It gets more complex with restricting menu items. For my project all I needed was three restricted areas for users.

First I added Front End Users Module and CustomContent Module. Then I created my directory and content pages and a login and logout page. On the login page I added this code:

{cms_module module=’FrontEndUsers’ form=’login’ returnto=”board-home”}

Note: if you are copying from here make sure to retype the quotes. The returnto is the page alias for the page you want them to go to after they login. For the logout I added this code:

{cms_module module=FrontEndUsers}

Then I created 3 templates for the three groups and added this code right below the body tag:

{if !$ccuser->memberof(‘board’)}{redirect_page page=’login’}{/if}

So if the user is a member of the “board” group then they will see the page content. If not they will be redirected to the login page. I added the 2 other lines in the 2 other templates for the 2 other groups. Then I updated the pages with the correct templates.

If you only have one group then the code in your template should look like this.

{if !$ccuser->loggedin()}{redirect_page page=’login’}{/if}