Page 1 of 1

Metas Module

Posted: Sat Nov 28, 2009 2:07 am
by scorche
I just started with CMSMS.

I don't like just how simple the metas are, so I'd like to expand them, and more importanly learn how to create modules.

So after reading some instructions, I'm thinking these are some of the things I'll need.

the main idea is to be able to set default metas, and have the ability to overwrite them.
If a meta doesn't exist, the default is used, but maybe a check-box would be helpful, whether to use default or not.

I was thinking about adding a table that will hold:
tag_name   C(64)
tag_description  TEXT
use_default BOOL
page_id  INT  (I'm assuming the int value is the way to go on this)

So the things I'm wondering about are how do I tie the data to the individual posts
I'd like the option to set these show up, by default, on all pages' options (and maybe remove the 'Page Specific Metadata')

The module should also show up elsewhere (either content, extensions or where would make most sense)


I'm thinking in the main module I would set the tag names, and if the tag name and default content, and if any tag is specified, it should show up under the options.

how do I sort through the tag data to get the information needed for the specific page?
I'm thinking - query the table for the default values and the values that match the page_id



anyhow I would appreciate if anyone who knows how to develop modules for CMSMS could give some guidance.
Any help is appreciated

Re: Metas Module

Posted: Sat Nov 28, 2009 3:50 am
by replytomk3
Also try the IRC for live help. But by all means do make the module work.

Re: Metas Module

Posted: Sat Nov 28, 2009 11:49 am
by tomgsd
scorche wrote: the main idea is to be able to set default metas, and have the ability to overwrite them.
If a meta doesn't exist, the default is used, but maybe a check-box would be helpful, whether to use default or not.
Just before you start doing loads of work on a module, I already do something similar using smarty (and the CGSimpleSmarty Module) and the existing content blocks.

In the "Global Metadata" box in settings I have:

{$cgsimple->get_page_content($content_id,"extra1",keywords)}
{if $keywords}

{else}

{/if}

Then, when editing a page just add the comma separated list of words in the "Extra 1" field.  If none are entered, the default words are used. You can also do the same thing for the description using the {description} tag and "Description (title attribute)" field.

Re: Metas Module

Posted: Sat Nov 28, 2009 11:55 am
by Sonya

Re: Metas Module

Posted: Sat Nov 28, 2009 4:58 pm
by scorche
thanks

Code: Select all

{$cgsimple->get_page_content($content_id,"extra1",keywords)}
{if $keywords}
<meta name="keywords" content="{$keywords}" />
{else}
<meta name="keywords" content="some, default, keywords" />
{/if}
works great.
Would be nice to be able to create dedicated fields for the tags, but that's just not that important right now.

But if I did want to do that, any idea where I could insert them?

Re: Metas Module

Posted: Sat Nov 28, 2009 5:06 pm
by Rolf
Would be nice to be able to create dedicated fields for the tags, but that's just not that important right now.
But if I did want to do that, any idea where I could insert them?
I think you will find info here:
http://forum.cmsmadesimple.org/index.ph ... 912.0.html #5

Rolf